Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for safeExpr (0.18 sec)

  1. src/cmd/compile/internal/walk/expr.go

    // result is assignable if n is.
    func safeExpr(n ir.Node, init *ir.Nodes) ir.Node {
    	if n == nil {
    		return nil
    	}
    
    	if len(n.Init()) != 0 {
    		walkStmtList(n.Init())
    		init.Append(ir.TakeInit(n)...)
    	}
    
    	switch n.Op() {
    	case ir.ONAME, ir.OLITERAL, ir.ONIL, ir.OLINKSYMOFFSET:
    		return n
    
    	case ir.OLEN, ir.OCAP:
    		n := n.(*ir.UnaryExpr)
    		l := safeExpr(n.X, init)
    		if l == n.X {
    			return n
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 27.6K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/walk/builtin.go

    	res := typecheck.Expr(ir.NewUnaryExpr(n.Pos(), ir.OSPTR, slice))
    	res.SetType(n.Type())
    	return walkExpr(res, init)
    }
    
    func walkUnsafeSlice(n *ir.BinaryExpr, init *ir.Nodes) ir.Node {
    	ptr := safeExpr(n.X, init)
    	len := safeExpr(n.Y, init)
    	sliceType := n.Type()
    
    	lenType := types.Types[types.TINT64]
    	unsafePtr := typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR])
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 22:35:22 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/walk/compare.go

    		}
    	}
    	and := func(cond ir.Node) {
    		if expr == nil {
    			expr = cond
    		} else {
    			expr = ir.NewLogicalExpr(base.Pos, andor, expr, cond)
    		}
    	}
    	cmpl = safeExpr(cmpl, init)
    	cmpr = safeExpr(cmpr, init)
    	if t.IsStruct() {
    		conds, _ := compare.EqStruct(t, cmpl, cmpr)
    		if n.Op() == ir.OEQ {
    			for _, cond := range conds {
    				and(cond)
    			}
    		} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 21:55:14 UTC 2023
    - 16.2K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/walk/order.go

    	return o.copyExpr(n)
    }
    
    // safeExpr returns a safe version of n.
    // The definition of safe is that n can appear multiple times
    // without violating the semantics of the original program,
    // and that assigning to the safe version has the same effect
    // as assigning to the original n.
    //
    // The intended use is to apply to x when rewriting x += y into x = x + y.
    func (o *orderState) safeExpr(n ir.Node) ir.Node {
    	switch n.Op() {
    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/cmd/compile/internal/walk/convert.go

    			arg = ir.NewStarExpr(pos, addr)
    			arg.SetType(argType)
    		}
    		args = []ir.Node{arg}
    	}
    	call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, nil)
    	call.Args = args
    	return safeExpr(walkExpr(typecheck.Expr(call), init), init)
    }
    
    // walkBytesRunesToString walks an OBYTES2STR or ORUNES2STR node.
    func walkBytesRunesToString(n *ir.ConvExpr, init *ir.Nodes) ir.Node {
    	a := typecheck.NodNil()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 17:28:22 UTC 2023
    - 18.2K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/walk/assign.go

    		mapAppend = right.(*ir.CallExpr)
    		if !ir.SameSafeExpr(left, mapAppend.Args[0]) {
    			base.Fatalf("not same expressions: %v != %v", left, mapAppend.Args[0])
    		}
    	}
    
    	left = walkExpr(left, init)
    	left = safeExpr(left, init)
    	if mapAppend != nil {
    		mapAppend.Args[0] = left
    	}
    
    	if n.Op() == ir.OASOP {
    		// Rewrite x op= y into x = x op y.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:09:06 UTC 2024
    - 20.3K bytes
    - Viewed (0)
Back to top