MCPcopy Create free account
hub / github.com/despiteallobjections/amigo / constSpec

Method constSpec

syntax/parser.go:483–501  ·  view source on GitHub ↗

ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] .

()

Source from the content-addressed store, hash-verified

481
482// ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] .
483func (p *parser) constSpec() Spec {
484 if trace {
485 defer p.trace("constDecl")()
486 }
487
488 d := new(ConstSpec)
489 d.pos = p.pos()
490 d.Pragma = p.takePragma()
491
492 d.NameList = p.nameList(p.name())
493 if p.tok != _EOF && p.tok != _Semi && p.tok != _Rparen {
494 d.Type = p.typeOrNil()
495 if p.gotAssign() {
496 d.Values = p.exprList()
497 }
498 }
499
500 return d
501}
502
503// TypeSpec = identifier [ TypeParams ] [ "=" ] Type .
504func (p *parser) typeSpec() Spec {

Callers

nothing calls this directly

Calls 9

traceMethod · 0.95
posMethod · 0.95
takePragmaMethod · 0.95
nameListMethod · 0.95
nameMethod · 0.95
typeOrNilMethod · 0.95
gotAssignMethod · 0.95
exprListMethod · 0.95
newFunction · 0.50

Tested by

no test coverage detected