- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for CompositeLit (0.19 sec)
-
src/cmd/compile/internal/syntax/parser.go
return p.complitexpr() } return p.expr() } // LiteralValue = "{" [ ElementList [ "," ] ] "}" . func (p *parser) complitexpr() *CompositeLit { if trace { defer p.trace("complitexpr")() } x := new(CompositeLit) x.pos = p.pos() p.xnest++ p.want(_Lbrace) x.Rbrace = p.list("composite literal", _Comma, _Rbrace, func() bool { // value
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 62.9K bytes - Viewed (0) -
src/go/types/expr.go
return } op := e.Op switch op { case token.AND: // spec: "As an exception to the addressability // requirement x may also be a composite literal." if _, ok := ast.Unparen(e.X).(*ast.CompositeLit); !ok && x.mode != variable { check.errorf(x, UnaddressableOperand, invalidOp+"cannot take address of %s", x) x.mode = invalid return } x.mode = value x.typ = &Pointer{base: x.typ} return
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 29 02:09:54 UTC 2024 - 49.7K bytes - Viewed (0) -
src/cmd/compile/internal/types2/expr.go
return } op := e.Op switch op { case syntax.And: // spec: "As an exception to the addressability // requirement x may also be a composite literal." if _, ok := syntax.Unparen(e.X).(*syntax.CompositeLit); !ok && x.mode != variable { check.errorf(x, UnaddressableOperand, invalidOp+"cannot take address of %s", x) x.mode = invalid return } x.mode = value x.typ = &Pointer{base: x.typ} return
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 29 02:09:54 UTC 2024 - 51.7K bytes - Viewed (0) -
src/go/printer/testdata/parser.go
p.exprLev-- rbrace := p.expect(token.RBRACE) return &ast.CompositeLit{typ, lbrace, elts, rbrace} } // checkExpr checks that x is an expression (and not a type). func (p *parser) checkExpr(x ast.Expr) ast.Expr { switch t := ast.Unparen(x).(type) { case *ast.BadExpr: case *ast.Ident: case *ast.BasicLit: case *ast.FuncLit: case *ast.CompositeLit: case *ast.ParenExpr: panic("unreachable")
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jul 20 20:19:51 UTC 2023 - 50.5K bytes - Viewed (0) -
src/go/printer/nodes.go
} else { p.exprList(x.Lparen, x.Args, depth, commaTerm, x.Rparen, false) } p.setPos(x.Rparen) p.print(token.RPAREN) if wasIndented { p.print(unindent) } case *ast.CompositeLit: // composite literal elements that are composite literals themselves may have the type omitted if x.Type != nil { p.expr1(x.Type, token.HighestPrec, depth) } p.level++ p.setPos(x.Lbrace)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 17 18:53:17 UTC 2023 - 52.6K bytes - Viewed (0) -
src/go/parser/parser.go
var elts []ast.Expr p.exprLev++ if p.tok != token.RBRACE { elts = p.parseElementList() } p.exprLev-- rbrace := p.expectClosing(token.RBRACE, "composite literal") return &ast.CompositeLit{Type: typ, Lbrace: lbrace, Elts: elts, Rbrace: rbrace} } func (p *parser) parsePrimaryExpr(x ast.Expr) ast.Expr { if p.trace { defer un(trace(p, "PrimaryExpr")) } if x == nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Dec 08 20:07:50 UTC 2023 - 72.2K bytes - Viewed (0) -
src/cmd/compile/internal/types2/api_test.go
} // test type of composite literal expression rhs := f.DeclList[0].(*syntax.VarDecl).Values cmptype(rhs, test.typ) // test type of composite literal type expression cmptype(rhs.(*syntax.CompositeLit).Type, test.typ) } } // TestObjectParents verifies that objects have parent scopes or not // as specified by the Object interface. func TestObjectParents(t *testing.T) { const src = `
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 07 20:08:23 UTC 2024 - 93.3K bytes - Viewed (0) -
src/go/types/api_test.go
rhs := f.Decls[0].(*ast.GenDecl).Specs[0].(*ast.ValueSpec).Values[0] cmptype(rhs, test.typ) // test type of composite literal type expression cmptype(rhs.(*ast.CompositeLit).Type, test.typ) } } // TestObjectParents verifies that objects have parent scopes or not // as specified by the Object interface. func TestObjectParents(t *testing.T) { const src = `
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 94.2K bytes - Viewed (0)