Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 19 of 19 for CompositeLit (0.24 sec)

  1. src/go/types/generate_test.go

    		switch n := n.(type) {
    		case *ast.ValueSpec:
    			// rewrite type Typ = [...]Type{...} to type Typ = []Type{...}
    			if len(n.Names) == 1 && n.Names[0].Name == "Typ" && len(n.Values) == 1 {
    				n.Values[0].(*ast.CompositeLit).Type.(*ast.ArrayType).Len = nil
    				return false
    			}
    		}
    		return true
    	})
    }
    
    // fixSprintf adds an extra nil argument for the *token.FileSet parameter in sprintf calls.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 16.5K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. src/go/printer/printer_test.go

    		panic(err)
    	}
    
    	// Replace the result with call(), which is on the next line.
    	fd := file.Decls[0].(*ast.FuncDecl)
    	ret := fd.Body.List[0].(*ast.ReturnStmt)
    	ret.Results[0] = ret.Results[0].(*ast.CompositeLit).Elts[0]
    
    	var buf bytes.Buffer
    	if err := Fprint(&buf, fset, ret); err != nil {
    		t.Fatal(err)
    	}
    	want := "return call()"
    	if got := buf.String(); got != want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:25 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"CommentGroup", Type, 0},
    		{"CommentGroup.List", Field, 0},
    		{"CommentMap", Type, 1},
    		{"CompositeLit", Type, 0},
    		{"CompositeLit.Elts", Field, 0},
    		{"CompositeLit.Incomplete", Field, 11},
    		{"CompositeLit.Lbrace", Field, 0},
    		{"CompositeLit.Rbrace", Field, 0},
    		{"CompositeLit.Type", Field, 0},
    		{"Con", Const, 0},
    		{"Decl", Type, 0},
    		{"DeclStmt", Type, 0},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. doc/go1.17_spec.html

    operand only on the left-hand side of an <a href="#Assignments">assignment</a>.
    </p>
    
    <pre class="ebnf">
    Operand     = Literal | OperandName | "(" Expression ")" .
    Literal     = BasicLit | CompositeLit | FunctionLit .
    BasicLit    = int_lit | float_lit | imaginary_lit | rune_lit | string_lit .
    OperandName = identifier | QualifiedIdent .
    </pre>
    
    <h3 id="Qualified_identifiers">Qualified identifiers</h3>
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 20:22:45 UTC 2024
    - 211.6K bytes
    - Viewed (0)
  9. doc/go_spec.html

    <a href="#Function_declarations">function</a>,
    or a parenthesized expression.
    </p>
    
    <pre class="ebnf">
    Operand     = Literal | OperandName [ TypeArgs ] | "(" Expression ")" .
    Literal     = BasicLit | CompositeLit | FunctionLit .
    BasicLit    = int_lit | float_lit | imaginary_lit | rune_lit | string_lit .
    OperandName = identifier | QualifiedIdent .
    </pre>
    
    <p>
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 21:07:21 UTC 2024
    - 281.5K bytes
    - Viewed (1)
Back to top