Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for isMapClear (0.09 sec)

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

    	n.TypeWord = typeWord
    	n.SrcRType = srcRType
    	return typecheck.Expr(n)
    }
    
    // isMapClear checks if n is of the form:
    //
    //	for k := range m {
    //		delete(m, k)
    //	}
    //
    // where == for keys of map m is reflexive.
    func isMapClear(n *ir.RangeStmt) bool {
    	if base.Flag.N != 0 || base.Flag.Cfg.Instrumenting {
    		return false
    	}
    
    	t := n.X.Type()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 20 14:52:33 UTC 2023
    - 17.6K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/walk/order.go

    				r = ir.NewConvExpr(base.Pos, ir.OCONV, nil, r)
    				r.SetType(types.Types[types.TSTRING])
    				r = typecheck.Expr(r)
    			}
    
    			n.X = o.copyExpr(r)
    
    		case k == types.TMAP:
    			if isMapClear(n) {
    				// Preserve the body of the map clear pattern so it can
    				// be detected during walk. The loop body will not be used
    				// when optimizing away the range loop to a runtime call.
    				orderBody = false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:33 UTC 2024
    - 42.7K bytes
    - Viewed (0)
Back to top