Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for constDecl (0.16 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/types2/decl.go

    	pkg := check.pkg
    
    	first := -1                // index of first ConstDecl in the current group, or -1
    	var last *syntax.ConstDecl // last ConstDecl with init expressions, or nil
    	for index, decl := range list {
    		if _, ok := decl.(*syntax.ConstDecl); !ok {
    			first = -1 // we're not in a constant declaration
    		}
    
    		switch s := decl.(type) {
    		case *syntax.ConstDecl:
    			top := len(check.delayed)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 29.6K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types2/resolver.go

    		first := -1                // index of first ConstDecl in the current group, or -1
    		var last *syntax.ConstDecl // last ConstDecl with init expressions, or nil
    		for index, decl := range file.DeclList {
    			if _, ok := decl.(*syntax.ConstDecl); !ok {
    				first = -1 // we're not in a constant declaration
    			}
    
    			switch s := decl.(type) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 26.3K bytes
    - Viewed (0)
  5. 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)
  6. src/cmd/compile/internal/syntax/syntax.go

    // and it returns an updated pragma value.
    // The text is the directive, with the "//" prefix stripped.
    // The current pragma is saved at each package, import, const, func, type, or var
    // declaration, into the File, ImportDecl, ConstDecl, FuncDecl, TypeDecl, or VarDecl node.
    //
    // If text is the empty string, the pragma is being returned
    // to the handler unused, meaning it appeared before a non-declaration.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 01 18:18:07 UTC 2022
    - 3.1K bytes
    - Viewed (0)
  7. src/go/types/decl.go

    	importDecl struct{ spec *ast.ImportSpec }
    	constDecl  struct {
    		spec      *ast.ValueSpec
    		iota      int
    		typ       ast.Expr
    		init      []ast.Expr
    		inherited bool
    	}
    	varDecl  struct{ spec *ast.ValueSpec }
    	typeDecl struct{ spec *ast.TypeSpec }
    	funcDecl struct{ decl *ast.FuncDecl }
    )
    
    func (d importDecl) node() ast.Node { return d.spec }
    func (d constDecl) node() ast.Node  { return d.spec }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 31K bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. src/cmd/compile/internal/syntax/printer.go

    		p.print(n.Body)
    
    	case *ImportDecl:
    		if n.Group == nil {
    			p.print(_Import, blank)
    		}
    		if n.LocalPkgName != nil {
    			p.print(n.LocalPkgName, blank)
    		}
    		p.print(n.Path)
    
    	case *ConstDecl:
    		if n.Group == nil {
    			p.print(_Const, blank)
    		}
    		p.printNameList(n.NameList)
    		if n.Type != nil {
    			p.print(blank, n.Type)
    		}
    		if n.Values != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 24 07:17:27 UTC 2023
    - 21.5K bytes
    - Viewed (0)
Back to top