Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 31 for makeslice (0.47 sec)

  1. src/encoding/json/decode.go

    			for ; i < v.Len(); i++ {
    				v.Index(i).SetZero() // zero remainder of array
    			}
    		} else {
    			v.SetLen(i) // truncate the slice
    		}
    	}
    	if i == 0 && v.Kind() == reflect.Slice {
    		v.Set(reflect.MakeSlice(v.Type(), 0, 0))
    	}
    	return nil
    }
    
    var nullLiteral = []byte("null")
    var textUnmarshalerType = reflect.TypeFor[encoding.TextUnmarshaler]()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 35.3K bytes
    - Viewed (0)
  2. src/fmt/scan.go

    			typ := v.Type()
    			if typ.Elem().Kind() != reflect.Uint8 {
    				s.errorString("can't scan type: " + val.Type().String())
    			}
    			str := s.convertString(verb)
    			v.Set(reflect.MakeSlice(typ, len(str), len(str)))
    			for i := 0; i < len(str); i++ {
    				v.Index(i).SetUint(uint64(str[i]))
    			}
    		case reflect.Float32, reflect.Float64:
    			s.SkipSpace()
    			s.notEOF()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:56:20 UTC 2024
    - 31.9K bytes
    - Viewed (0)
  3. src/fmt/scan_test.go

    			t.Errorf("count error on entry (%q, %q): expected %d got %d", test.format, test.text, len(test.out), n)
    			continue
    		}
    		// Convert the slice of pointers into a slice of values
    		resultVal := reflect.MakeSlice(sliceType, n, n)
    		for i := 0; i < n; i++ {
    			v := reflect.ValueOf(test.in[i]).Elem()
    			resultVal.Index(i).Set(v)
    		}
    		result := resultVal.Interface()
    		if !reflect.DeepEqual(result, test.out) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 23 20:25:13 UTC 2023
    - 39.3K bytes
    - Viewed (0)
  4. src/cmd/internal/src/pos.go

    // NoPos is a valid unknown position.
    var NoPos Pos
    
    // MakePos creates a new Pos value with the given base, and (file-absolute)
    // line and column.
    func MakePos(base *PosBase, line, col uint) Pos {
    	return Pos{base, makeLico(line, col)}
    }
    
    // IsKnown reports whether the position p is known.
    // A position is known if it either has a non-nil
    // position base, or a non-zero line number.
    func (p Pos) IsKnown() bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 01 15:52:41 UTC 2023
    - 15.5K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/ir/fmt.go

    			fmt.Fprintf(s, "%v", n.ReturnVars[0])
    			return
    		}
    		fmt.Fprintf(s, "(.%v)", n.ReturnVars)
    
    	case OMAKEMAP, OMAKECHAN, OMAKESLICE:
    		n := n.(*MakeExpr)
    		if n.Cap != nil {
    			fmt.Fprintf(s, "make(%v, %v, %v)", n.Type(), n.Len, n.Cap)
    			return
    		}
    		if n.Len != nil && (n.Op() == OMAKESLICE || !n.Len.Type().IsUntyped()) {
    			fmt.Fprintf(s, "make(%v, %v)", n.Type(), n.Len)
    			return
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 05 15:20:28 UTC 2023
    - 26K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/walk/order.go

    func (o *orderState) stmtList(l ir.Nodes) {
    	s := l
    	for i := range s {
    		orderMakeSliceCopy(s[i:])
    		o.stmt(s[i])
    	}
    }
    
    // orderMakeSliceCopy matches the pattern:
    //
    //	m = OMAKESLICE([]T, x); OCOPY(m, s)
    //
    // and rewrites it to:
    //
    //	m = OMAKESLICECOPY([]T, x, s); nil
    func orderMakeSliceCopy(s []ir.Node) {
    	if base.Flag.N != 0 || base.Flag.Cfg.Instrumenting {
    		return
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:33 UTC 2024
    - 42.7K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/staticinit/sched.go

    			return true
    		}
    
    	// Only possible side effect is panic on invalid size.
    	// TODO(rsc): Merge with previous case (probably breaks toolstash -cmp).
    	case ir.OMAKESLICE, ir.OMAKESLICECOPY:
    		return true
    	}
    	return false
    }
    
    // AnySideEffects reports whether n contains any operations that could have observable side effects.
    func AnySideEffects(n ir.Node) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 17:16:14 UTC 2024
    - 30.7K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/walk/assign.go

    		base.Fatalf("missing typecheck: %+v", n)
    	}
    
    	if n.Op() != ir.OAPPEND {
    		return false
    	}
    	call := n.(*ir.CallExpr)
    	if !call.IsDDD || len(call.Args) != 2 || call.Args[1].Op() != ir.OMAKESLICE {
    		return false
    	}
    
    	mk := call.Args[1].(*ir.MakeExpr)
    	if mk.Cap != nil {
    		return false
    	}
    
    	// y must be either an integer constant or the largest possible positive value
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:09:06 UTC 2024
    - 20.3K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/typecheck/expr.go

    	// Errors here are Fatalf instead of Errorf because only the compiler
    	// can construct an OSLICEHEADER node.
    	// Components used in OSLICEHEADER that are supplied by parsed source code
    	// have already been typechecked in e.g. OMAKESLICE earlier.
    	t := n.Type()
    	if t == nil {
    		base.Fatalf("no type specified for OSLICEHEADER")
    	}
    
    	if !t.IsSlice() {
    		base.Fatalf("invalid type %v for OSLICEHEADER", n.Type())
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/typecheck/func.go

    			base.Errorf("len larger than cap in make(%v)", t)
    			n.SetType(nil)
    			return n
    		}
    		nn = ir.NewMakeExpr(n.Pos(), ir.OMAKESLICE, l, r)
    
    	case types.TMAP:
    		if i < len(args) {
    			l = args[i]
    			i++
    			l = Expr(l)
    			l = DefaultLit(l, types.Types[types.TINT])
    			if l.Type() == nil {
    				n.SetType(nil)
    				return n
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 06 15:23:18 UTC 2024
    - 21.1K bytes
    - Viewed (0)
Back to top