Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 3,450 for switch2 (0.27 sec)

  1. test/switch2.go

    // Verify that erroneous switch statements are detected by the compiler.
    // Does not compile.
    
    package main
    
    func f() {
    	switch {
    	case 0; // ERROR "expecting := or = or : or comma|expected :"
    	}
    
    	switch {
    	case 0; // ERROR "expecting := or = or : or comma|expected :"
    	default:
    	}
    
    	switch {
    	case 0: case 0: default:
    	}
    
    	switch {
    	case 0: f(); case 0:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 01 22:37:04 UTC 2022
    - 775 bytes
    - Viewed (0)
  2. src/go/scanner/scanner.go

    		case '=':
    			tok = s.switch2(token.ASSIGN, token.EQL)
    		case '!':
    			tok = s.switch2(token.NOT, token.NEQ)
    		case '&':
    			if s.ch == '^' {
    				s.next()
    				tok = s.switch2(token.AND_NOT, token.AND_NOT_ASSIGN)
    			} else {
    				tok = s.switch3(token.AND, token.AND_ASSIGN, '&', token.LAND)
    			}
    		case '|':
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 24.3K bytes
    - Viewed (0)
  3. src/cmd/go/internal/toolchain/switch.go

    	}
    }
    
    // NeedSwitch reports whether Switch would attempt to switch toolchains.
    func (s *Switcher) NeedSwitch() bool {
    	return s.TooNew != nil && (HasAuto() || HasPath())
    }
    
    // Switch decides whether to switch to a newer toolchain
    // to resolve any of the saved errors.
    // It switches if toolchain switches are permitted and there is at least one TooNewError.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 18:15:22 UTC 2024
    - 7K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/walk/switch.go

    // expression switch.
    func walkSwitchExpr(sw *ir.SwitchStmt) {
    	lno := ir.SetPos(sw)
    
    	cond := sw.Tag
    	sw.Tag = nil
    
    	// convert switch {...} to switch true {...}
    	if cond == nil {
    		cond = ir.NewBool(base.Pos, true)
    		cond = typecheck.Expr(cond)
    		cond = typecheck.DefaultLit(cond, nil)
    	}
    
    	// Given "switch string(byteslice)",
    	// with all cases being side-effect free,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 30.1K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/parser.go

    		}
    		return p.simpleStmt(lhs, 0)
    	}
    
    	switch p.tok {
    	case _Var:
    		return p.declStmt(p.varDecl)
    
    	case _Const:
    		return p.declStmt(p.constDecl)
    
    	case _Type:
    		return p.declStmt(p.typeDecl)
    	}
    
    	p.clearPragma()
    
    	switch p.tok {
    	case _Lbrace:
    		return p.blockStmt("")
    
    	case _Operator, _Star:
    		switch p.op {
    		case Add, Sub, Mul, And, Xor, Not:
    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. test/switch6.go

    func f1(e interface{}) {
    	switch e {
    	default:
    	default: // ERROR "multiple defaults( in switch)?"
    	}
    	switch e.(type) {
    	default:
    	default: // ERROR "multiple defaults( in switch)?"
    	}
    }
    
    type I interface {
    	Foo()
    }
    
    type X int
    
    func (*X) Foo() {}
    func f2() {
    	var i I
    	switch i.(type) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Sep 24 17:04:15 UTC 2022
    - 1.1K bytes
    - Viewed (0)
  7. test/switch.go

    	// switch on nil-only comparison types
    	switch f := func() {}; f {
    	case nil:
    		assert(false, "f should not be nil")
    	default:
    	}
    
    	switch m := make(map[int]int); m {
    	case nil:
    		assert(false, "m should not be nil")
    	default:
    	}
    
    	switch a := make([]int, 1); a {
    	case nil:
    		assert(false, "m should not be nil")
    	default:
    	}
    
    	// switch on interface.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jul 19 23:30:49 UTC 2022
    - 6.5K bytes
    - Viewed (0)
  8. test/codegen/switch.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // These tests check code generation of switch statements.
    
    package codegen
    
    // see issue 33934
    func f(x string) int {
    	// amd64:-`cmpstring`
    	switch x {
    	case "":
    		return -1
    	case "1", "2", "3":
    		return -2
    	default:
    		return -3
    	}
    }
    
    // use jump tables for 8+ int cases
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 18:39:50 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  9. src/net/internal/socktest/switch.go

    package socktest
    
    import (
    	"fmt"
    	"sync"
    )
    
    // A Switch represents a callpath point switch for socket system
    // calls.
    type Switch struct {
    	once sync.Once
    
    	fmu   sync.RWMutex
    	fltab map[FilterType]Filter
    
    	smu   sync.RWMutex
    	sotab Sockets
    	stats stats
    }
    
    func (sw *Switch) init() {
    	sw.fltab = make(map[FilterType]Filter)
    	sw.sotab = make(Sockets)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 10 03:29:50 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  10. src/internal/abi/switch.go

    	if !go122InterfaceSwitchCache {
    		return false
    	}
    	// We need an atomic load instruction to make the cache multithreaded-safe.
    	// (AtomicLoadPtr needs to be implemented in cmd/compile/internal/ssa/_gen/ARCH.rules.)
    	switch goarch {
    	case "amd64", "arm64", "loong64", "mips", "mipsle", "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x":
    		return true
    	default:
    		return false
    	}
    }
    
    type TypeAssert struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 06 17:02:53 UTC 2023
    - 1.6K bytes
    - Viewed (0)
Back to top