@@ -23,28 +23,28 @@ struct Builder {
2323
2424impl Builder {
2525 // Formats node and returns formatted code (including documentation comments).
26- fn formatNode(self, mut node: ast::Node): str {
26+ fn formatNode(* self, mut node: ast::Node): str {
2727 self.fmt.buf.Clear()
2828 self.fmt.node(node)
2929 ret strings::TrimSpace(self.fmt.buf.Str())
3030 }
3131
3232 // Formats type and returns formatted code.
33- fn formatType(self, mut t: &ast::Expr): str {
33+ fn formatType(* self, mut t: &ast::Expr): str {
3434 self.fmt.buf.Clear()
3535 self.fmt.formatType(t)
3636 ret strings::TrimSpace(self.fmt.buf.Str())
3737 }
3838
3939 // Builds context from doc comments.
40- fn buildCtx(self, doc: str): []doc::Context {
40+ fn buildCtx(* self, doc: str): []doc::Context {
4141 ctxb := ctxBuilder{}
4242 ret ctxb.build(doc)
4343 }
4444
4545 // Reads documentation comments from code and returns meta.
4646 // Also returns code with no documentation comments.
47- fn readDocComments(self, mut code: str): (str, []doc::Context) {
47+ fn readDocComments(* self, mut code: str): (str, []doc::Context) {
4848 // Read doc comments.
4949 mut doc := strings::Builder{}
5050 for len(code) > 0 {
@@ -74,25 +74,25 @@ impl Builder {
7474 ret code, ctx
7575 }
7676
77- fn formatMainNode(self, mut ast: &ast::AST, mut &i: int): str {
78- mut data, ok := ast.Nodes[i].Data.(&ast::Var)
77+ fn formatMainNode(* self, mut ast: &ast::AST, mut &i: * int): str {
78+ mut data, ok := ast.Nodes[* i].Data.(&ast::Var)
7979 if !ok {
80- ret self.formatNode(ast.Nodes[i])
80+ ret self.formatNode(ast.Nodes[* i])
8181 }
8282 // For variables, do not use plain node formatting.
8383 // Variables may be grouped with a common documentation.
8484 // Do not waste it.
8585 self.fmt.buf.Clear()
8686 {
87- mut row := ast.Nodes[i].Token.Row
87+ mut row := ast.Nodes[* i].Token.Row
8888 if len(data.Directives) > 0 {
8989 row = data.Directives[0].Tag.Row
9090 }
9191 if row-self.fmt.writeCommentsExcept(row, true) > 1 {
9292 self.fmt.write("\n")
9393 }
9494 }
95- self.fmt.groupDecls[&ast::Var, ast::Node](ast.Nodes, i, fn(mut & d: &ast::Var) {
95+ self.fmt.groupDecls[&ast::Var, ast::Node](ast.Nodes, i, fn(mut d: &ast::Var) {
9696 unsafe {
9797 if !d.Bind && isPub(d.Name) {
9898 self.fmt.buf.Write(self.fmt.indent)!
@@ -103,12 +103,12 @@ impl Builder {
103103 // If variable is not grouped, the build function will advance the offset,
104104 // avoid false offset.
105105 if len(data.Group) == 0 {
106- i--
106+ * i--
107107 }
108108 ret strings::TrimSpace(self.fmt.buf.Str())
109109 }
110110
111- fn handleNodeDoc(self, node: ast::Node, mut doc: &doc::Doc): &doc::Doc {
111+ fn handleNodeDoc(* self, node: ast::Node, mut doc: &doc::Doc): &doc::Doc {
112112 match type node.Data {
113113 | &ast::Var:
114114 // NOTE:
@@ -172,16 +172,16 @@ impl Builder {
172172 ret doc
173173 }
174174
175- fn mainNode(self, mut ast: &ast::AST, mut &i: int): &doc::Doc {
175+ fn mainNode(* self, mut ast: &ast::AST, mut &i: * int): &doc::Doc {
176176 mut doc := new(doc::Doc)
177177 code, mut ctx := self.readDocComments(self.formatMainNode(ast, i))
178178 doc.Code = code
179179 doc.Ctx = ctx
180- node := ast.Nodes[i]
180+ node := ast.Nodes[* i]
181181 ret self.handleNodeDoc(node, doc)
182182 }
183183
184- fn node(self, mut node: ast::Node): &doc::Doc {
184+ fn node(* self, mut node: ast::Node): &doc::Doc {
185185 mut doc := new(doc::Doc)
186186 code, mut ctx := self.readDocComments(self.formatNode(node))
187187 doc.Code = code
@@ -191,7 +191,7 @@ impl Builder {
191191
192192 // Returns MetaStruct by ident.
193193 // If not exist already, appends new MetaStruct by ident and returns it.
194- fn getStructMeta(self, ident: str): &doc::MetaStruct {
194+ fn getStructMeta(* self, ident: str): &doc::MetaStruct {
195195 for (_, mut hash) in self.structMetas {
196196 if hash.ident == ident {
197197 ret hash.meta
@@ -205,7 +205,7 @@ impl Builder {
205205 ret meta
206206 }
207207
208- fn analysisImpl(self, mut ast: &ast::Impl) {
208+ fn analysisImpl(* self, mut ast: &ast::Impl) {
209209 // Destination type should be simple identifier type.
210210 // Otherwise we have to assume this implementation is not suitable to analysis.
211211 dest, _ := ast.Dest.Data.(&ast::NameExpr)
@@ -239,7 +239,7 @@ impl Builder {
239239 }
240240
241241 // Dispatches all collected struct meta.
242- fn dispatchStructMeta(self, mut doc: []&doc::Doc) {
242+ fn dispatchStructMeta(* self, mut doc: []&doc::Doc) {
243243 for (_, mut hash) in self.structMetas {
244244 for (_, mut node) in doc {
245245 if (node.Owner == doc::Struct || node.Owner == doc::StrictTypeAlias) &&
@@ -251,13 +251,13 @@ impl Builder {
251251 }
252252
253253 // Dispatches all collected meta.
254- fn DispatchMeta(self, mut doc: []&doc::Doc) {
254+ fn DispatchMeta(* self, mut doc: []&doc::Doc) {
255255 self.dispatchStructMeta(doc)
256256 }
257257
258258 // Builds and returns documentation.
259259 // Will not dispatch meta.
260- fn BuildPartial(self, mut ast: &ast::AST, mut cm: &CommentMap): []&doc::Doc {
260+ fn BuildPartial(* self, mut ast: &ast::AST, mut cm: &CommentMap): []&doc::Doc {
261261 if ast == nil {
262262 ret nil
263263 }
@@ -274,7 +274,7 @@ impl Builder {
274274 |:
275275 // no-op
276276 }
277- mut nodeDoc := self.mainNode(ast, i)
277+ mut nodeDoc := self.mainNode(ast, & i)
278278 if nodeDoc == nil {
279279 continue
280280 }
@@ -288,7 +288,7 @@ impl Builder {
288288 }
289289
290290 // Builds and returns documentation with dispatched meta.
291- fn Build(self, mut ast: &ast::AST, mut cm: &CommentMap): []&doc::Doc {
291+ fn Build(* self, mut ast: &ast::AST, mut cm: &CommentMap): []&doc::Doc {
292292 mut doc := self.BuildPartial(ast, cm)
293293 self.DispatchMeta(doc)
294294 ret doc
0 commit comments