Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for constDecl (0.32 sec)

  1. src/internal/types/testdata/check/constdecl.go

    // Copyright 2013 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package constdecl
    
    import "math"
    import "unsafe"
    
    var v int
    
    // Const decls must be initialized by constants.
    const _ = v /* ERROR "not constant" */
    const _ = math /* ERROR "not constant" */ .Sin(0)
    const _ = int /* ERROR "not an expression" */
    
    func _() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 31 16:11:16 UTC 2023
    - 3.7K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/syntax/nodes_test.go

    	{"ImportDecl", `import (@"math")`},
    	{"ImportDecl", `import (@mymath "math")`},
    	{"ImportDecl", `import (@. "math")`},
    
    	{"ConstDecl", `const @x`},
    	{"ConstDecl", `const @x = 0`},
    	{"ConstDecl", `const @x, y, z = 0, 1, 2`},
    	{"ConstDecl", `const (@x)`},
    	{"ConstDecl", `const (@x = 0)`},
    	{"ConstDecl", `const (@x, y, z = 0, 1, 2)`},
    
    	{"TypeDecl", `type @T int`},
    	{"TypeDecl", `type @T = int`},
    	{"TypeDecl", `type (@T int)`},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 02 18:45:06 UTC 2023
    - 8.7K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/syntax/positions.go

    			panic("nil node")
    
    		// packages
    		case *File:
    			// file block starts at the beginning of the file
    			return MakePos(n.Pos().Base(), 1, 1)
    
    		// declarations
    		// case *ImportDecl:
    		// case *ConstDecl:
    		// case *TypeDecl:
    		// case *VarDecl:
    		// case *FuncDecl:
    
    		// expressions
    		// case *BadExpr:
    		// case *Name:
    		// case *BasicLit:
    		case *CompositeLit:
    			if n.Type != nil {
    				m = n.Type
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 17:49:19 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/syntax/walk.go

    	// packages
    	case *File:
    		w.node(n.PkgName)
    		w.declList(n.DeclList)
    
    	// declarations
    	case *ImportDecl:
    		if n.LocalPkgName != nil {
    			w.node(n.LocalPkgName)
    		}
    		w.node(n.Path)
    
    	case *ConstDecl:
    		w.nameList(n.NameList)
    		if n.Type != nil {
    			w.node(n.Type)
    		}
    		if n.Values != nil {
    			w.node(n.Values)
    		}
    
    	case *TypeDecl:
    		w.node(n.Name)
    		w.fieldList(n.TParamList)
    		w.node(n.Type)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:55:04 UTC 2023
    - 5.7K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/nodes.go

    		Path         *BasicLit // Path.Bad || Path.Kind == StringLit; nil means no path
    		decl
    	}
    
    	// NameList
    	// NameList      = Values
    	// NameList Type = Values
    	ConstDecl struct {
    		Group    *Group // nil means not part of a group
    		Pragma   Pragma
    		NameList []*Name
    		Type     Expr // nil means no type
    		Values   Expr // nil means no values
    		decl
    	}
    
    	// Name Type
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 20 14:52:38 UTC 2023
    - 9K bytes
    - Viewed (0)
Back to top