(tag int)
| 198 | } |
| 199 | |
| 200 | func (p *gc_bin_parser) obj(tag int) { |
| 201 | switch tag { |
| 202 | case constTag: |
| 203 | p.pos() |
| 204 | pkg, name := p.qualifiedName() |
| 205 | typ := p.typ("") |
| 206 | p.skipValue() // ignore const value, gocode's not interested |
| 207 | p.callback(pkg, &ast.GenDecl{ |
| 208 | Tok: token.CONST, |
| 209 | Specs: []ast.Spec{ |
| 210 | &ast.ValueSpec{ |
| 211 | Names: []*ast.Ident{ast.NewIdent(name)}, |
| 212 | Type: typ, |
| 213 | Values: []ast.Expr{&ast.BasicLit{Kind: token.INT, Value: "0"}}, |
| 214 | }, |
| 215 | }, |
| 216 | }) |
| 217 | |
| 218 | case aliasTag: |
| 219 | // TODO(gri) verify type alias hookup is correct |
| 220 | p.pos() |
| 221 | pkg, name := p.qualifiedName() |
| 222 | typ := p.typ("") |
| 223 | p.callback(pkg, &ast.GenDecl{ |
| 224 | Tok: token.TYPE, |
| 225 | Specs: []ast.Spec{typeAliasSpec(name, typ)}, |
| 226 | }) |
| 227 | |
| 228 | case typeTag: |
| 229 | _ = p.typ("") |
| 230 | |
| 231 | case varTag: |
| 232 | p.pos() |
| 233 | pkg, name := p.qualifiedName() |
| 234 | typ := p.typ("") |
| 235 | p.callback(pkg, &ast.GenDecl{ |
| 236 | Tok: token.VAR, |
| 237 | Specs: []ast.Spec{ |
| 238 | &ast.ValueSpec{ |
| 239 | Names: []*ast.Ident{ast.NewIdent(name)}, |
| 240 | Type: typ, |
| 241 | }, |
| 242 | }, |
| 243 | }) |
| 244 | |
| 245 | case funcTag: |
| 246 | p.pos() |
| 247 | pkg, name := p.qualifiedName() |
| 248 | params := p.paramList() |
| 249 | results := p.paramList() |
| 250 | p.callback(pkg, &ast.FuncDecl{ |
| 251 | Name: ast.NewIdent(name), |
| 252 | Type: &ast.FuncType{Params: params, Results: results}, |
| 253 | }) |
| 254 | |
| 255 | default: |
| 256 | panic(fmt.Sprintf("unexpected object tag %d", tag)) |
| 257 | } |
no test coverage detected