Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for varDecl (0.21 sec)

  1. src/cmd/compile/internal/syntax/positions.go

    		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
    				continue
    			}
    			return n.Pos()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 17:49:19 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  2. src/go/types/decl.go

    		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 }
    func (d varDecl) node() ast.Node    { return d.spec }
    func (d typeDecl) 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)
  3. src/cmd/compile/internal/types2/decl.go

    	switch obj := obj.(type) {
    	case *Const:
    		check.decl = d // new package-level const decl
    		check.constDecl(obj, d.vtyp, d.init, d.inherited)
    	case *Var:
    		check.decl = d // new package-level var decl
    		check.varDecl(obj, d.lhs, d.vtyp, d.init)
    	case *TypeName:
    		// invalid recursive types are detected via path
    		check.typeDecl(obj, d.tdecl, def)
    		check.collectMethods(obj) // methods can only be added to top-level types
    	case *Func:
    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/labels.go

    		return false
    	}
    
    	var stmtBranches func(syntax.Stmt)
    	stmtBranches = func(s syntax.Stmt) {
    		switch s := s.(type) {
    		case *syntax.DeclStmt:
    			for _, d := range s.DeclList {
    				if d, _ := d.(*syntax.VarDecl); d != nil {
    					recordVarDecl(d.Pos())
    				}
    			}
    
    		case *syntax.LabeledStmt:
    			// declare non-blank label
    			if name := s.Label.Value; name != "_" {
    				lbl := NewLabel(s.Label.Pos(), check.pkg, name)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/parser.go

    		return isTypeElem(x.X)
    	}
    	return false
    }
    
    // VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
    func (p *parser) varDecl(group *Group) Decl {
    	if trace {
    		defer p.trace("varDecl")()
    	}
    
    	d := new(VarDecl)
    	d.pos = p.pos()
    	d.Group = group
    	d.Pragma = p.takePragma()
    
    	d.NameList = p.nameList(p.name())
    	if p.gotAssign() {
    		d.Values = p.exprList()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 62.9K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/rangefunc/rewrite.go

    	return x
    }
    
    func (r *rewriter) stateVar(pos syntax.Pos) (*types2.Var, *syntax.VarDecl) {
    	r.stateVarCount++
    
    	name := fmt.Sprintf("#state%d", r.stateVarCount)
    	typ := r.int.Type()
    	obj := types2.NewVar(pos, r.pkg, name, typ)
    	n := syntax.NewName(pos, name)
    	setValueType(n, typ)
    	r.info.Defs[n] = obj
    
    	return obj, &syntax.VarDecl{NameList: []*syntax.Name{n}, Values: r.stateConst(abi.RF_READY)}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:05:44 UTC 2024
    - 41.6K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/resolver.go

    					check.declarePkgObj(name, obj, d)
    				}
    
    				// Constants must always have init values.
    				check.arity(s.Pos(), s.NameList, values, true, inherited)
    
    			case *syntax.VarDecl:
    				lhs := make([]*Var, len(s.NameList))
    				// If there's exactly one rhs initializer, use
    				// the same declInfo d1 for all lhs variables
    				// so that each lhs variable depends on the same
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 26.3K bytes
    - Viewed (0)
  8. src/go/types/resolver.go

    					if i < len(d.init) {
    						init = d.init[i]
    					}
    
    					d := &declInfo{file: fileScope, vtyp: d.typ, init: init, inherited: d.inherited}
    					check.declarePkgObj(name, obj, d)
    				}
    
    			case varDecl:
    				lhs := make([]*Var, len(d.spec.Names))
    				// If there's exactly one rhs initializer, use
    				// the same declInfo d1 for all lhs variables
    				// so that each lhs variable depends on the same
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 16:22:59 UTC 2024
    - 26.1K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/types2/api_test.go

    			}
    			if got := tv.Type.String(); got != want {
    				t.Errorf("%s: got %v, want %s", test.lit, got, want)
    			}
    		}
    
    		// 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)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 93.3K bytes
    - Viewed (0)
  10. doc/go1.17_spec.html

    <a href="#Package_initialization"><code>init</code> function</a> declarations,
    and like the blank identifier it does not introduce a new binding.
    </p>
    
    <pre class="ebnf">
    Declaration   = ConstDecl | TypeDecl | VarDecl .
    TopLevelDecl  = Declaration | FunctionDecl | MethodDecl .
    </pre>
    
    <p>
    The <i>scope</i> of a declared identifier is the extent of source text in which
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 20:22:45 UTC 2024
    - 211.6K bytes
    - Viewed (0)
Back to top