Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 26 for TypeAssertExpr (0.16 sec)

  1. src/go/printer/testdata/parser.go

    	p.expect(token.LPAREN)
    	var typ ast.Expr
    	if p.tok == token.TYPE {
    		// type switch: typ == nil
    		p.next()
    	} else {
    		typ = p.parseType()
    	}
    	p.expect(token.RPAREN)
    
    	return &ast.TypeAssertExpr{x, typ}
    }
    
    func (p *parser) parseIndexOrSlice(x ast.Expr) ast.Expr {
    	if p.trace {
    		defer un(trace(p, "IndexOrSlice"))
    	}
    
    	lbrack := p.expect(token.LBRACK)
    	p.exprLev++
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 20 20:19:51 UTC 2023
    - 50.5K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/typecheck/stmt.go

    		stmt := stmt.(*ir.AssignListStmt)
    		r := rhs[0]
    
    		switch r.Op() {
    		case ir.OINDEXMAP:
    			stmt.SetOp(ir.OAS2MAPR)
    		case ir.ORECV:
    			stmt.SetOp(ir.OAS2RECV)
    		case ir.ODOTTYPE:
    			r := r.(*ir.TypeAssertExpr)
    			stmt.SetOp(ir.OAS2DOTTYPE)
    			r.SetOp(ir.ODOTTYPE2)
    		case ir.ODYNAMICDOTTYPE:
    			r := r.(*ir.DynamicTypeAssertExpr)
    			stmt.SetOp(ir.OAS2DOTTYPE)
    			r.SetOp(ir.ODYNAMICDOTTYPE2)
    		default:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 20 15:10:54 UTC 2023
    - 17.8K bytes
    - Viewed (0)
  3. src/cmd/fix/typecheck.go

    			}
    			typeof[n] = join(out)
    			for i, arg := range n.Args {
    				if i >= len(in) {
    					break
    				}
    				if typeof[arg] == "" {
    					typeof[arg] = in[i]
    				}
    			}
    
    		case *ast.TypeAssertExpr:
    			// x.(type) has type of x.
    			if n.Type == nil {
    				typeof[n] = typeof[n.X]
    				return
    			}
    			// x.(T) has type T.
    			if t := typeof[n.Type]; isType(t) {
    				typeof[n] = getType(t)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 16 22:02:42 UTC 2022
    - 20.1K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/walk/order.go

    	case ir.OAS2DOTTYPE, ir.OAS2RECV, ir.OAS2MAPR:
    		n := n.(*ir.AssignListStmt)
    		t := o.markTemp()
    		o.exprList(n.Lhs)
    
    		switch r := n.Rhs[0]; r.Op() {
    		case ir.ODOTTYPE2:
    			r := r.(*ir.TypeAssertExpr)
    			r.X = o.expr(r.X, nil)
    		case ir.ODYNAMICDOTTYPE2:
    			r := r.(*ir.DynamicTypeAssertExpr)
    			r.X = o.expr(r.X, nil)
    			r.RType = o.expr(r.RType, nil)
    			r.ITab = o.expr(r.ITab, nil)
    		case ir.ORECV:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:33 UTC 2024
    - 42.7K bytes
    - Viewed (0)
  5. src/go/types/expr.go

    		return // nothing to do
    	}
    
    	// update operands of x if necessary
    	switch x := x.(type) {
    	case *ast.BadExpr,
    		*ast.FuncLit,
    		*ast.CompositeLit,
    		*ast.IndexExpr,
    		*ast.SliceExpr,
    		*ast.TypeAssertExpr,
    		*ast.StarExpr,
    		*ast.KeyValueExpr,
    		*ast.ArrayType,
    		*ast.StructType,
    		*ast.FuncType,
    		*ast.InterfaceType,
    		*ast.MapType,
    		*ast.ChanType:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 49.7K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/typecheck/expr.go

    		n.SetOp(ir.OMETHVALUE)
    		n.SetType(NewMethodType(n.Type(), nil))
    	}
    	return n
    }
    
    // tcDotType typechecks an ODOTTYPE node.
    func tcDotType(n *ir.TypeAssertExpr) ir.Node {
    	n.X = Expr(n.X)
    	n.X = DefaultLit(n.X, nil)
    	l := n.X
    	t := l.Type()
    	if t == nil {
    		n.SetType(nil)
    		return n
    	}
    	if !t.IsInterface() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/ir/fmt.go

    		n := n.(*SelectorExpr)
    		exprFmt(n.X, s, nprec)
    		if n.Sel == nil {
    			fmt.Fprint(s, ".<nil>")
    			return
    		}
    		fmt.Fprintf(s, ".%s", n.Sel.Name)
    
    	case ODOTTYPE, ODOTTYPE2:
    		n := n.(*TypeAssertExpr)
    		exprFmt(n.X, s, nprec)
    		fmt.Fprintf(s, ".(%v)", n.Type())
    
    	case OINDEX, OINDEXMAP:
    		n := n.(*IndexExpr)
    		exprFmt(n.X, s, nprec)
    		fmt.Fprintf(s, "[%v]", n.Index)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 05 15:20:28 UTC 2023
    - 26K bytes
    - Viewed (0)
  8. src/go/types/stmt.go

    		default:
    			check.error(s, InvalidSyntaxTree, "incorrect form of type switch guard")
    			return
    		}
    
    		// rhs must be of the form: expr.(type) and expr must be an ordinary interface
    		expr, _ := rhs.(*ast.TypeAssertExpr)
    		if expr == nil || expr.Type != nil {
    			check.error(s, InvalidSyntaxTree, "incorrect form of type switch guard")
    			return
    		}
    		var x operand
    		check.expr(nil, &x, expr.X)
    		if x.mode == invalid {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/typecheck/typecheck.go

    	// exprs
    	case ir.OCOMPLIT:
    		return tcCompLit(n.(*ir.CompLitExpr))
    
    	case ir.OXDOT, ir.ODOT:
    		n := n.(*ir.SelectorExpr)
    		return tcDot(n, top)
    
    	case ir.ODOTTYPE:
    		n := n.(*ir.TypeAssertExpr)
    		return tcDotType(n)
    
    	case ir.OINDEX:
    		n := n.(*ir.IndexExpr)
    		return tcIndex(n)
    
    	case ir.ORECV:
    		n := n.(*ir.UnaryExpr)
    		return tcRecv(n)
    
    	case ir.OSEND:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 20 19:08:34 UTC 2024
    - 30.5K bytes
    - Viewed (0)
  10. src/go/parser/parser.go

    	var typ ast.Expr
    	if p.tok == token.TYPE {
    		// type switch: typ == nil
    		p.next()
    	} else {
    		typ = p.parseType()
    	}
    	rparen := p.expect(token.RPAREN)
    
    	return &ast.TypeAssertExpr{X: x, Type: typ, Lparen: lparen, Rparen: rparen}
    }
    
    func (p *parser) parseIndexOrSliceOrInstance(x ast.Expr) ast.Expr {
    	if p.trace {
    		defer un(trace(p, "parseIndexOrSliceOrInstance"))
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 08 20:07:50 UTC 2023
    - 72.2K bytes
    - Viewed (0)
Back to top