Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
cbcd146f
Commit
cbcd146f
authored
Sep 25, 2009
by
Austin Clements
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s/switch _ :=/switch/
R=rsc APPROVED=rsc DELTA=36 (0 added, 0 deleted, 36 changed) OCL=34971 CL=35006
parent
19b1d35d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
36 deletions
+36
-36
usr/austin/eval/expr.go
usr/austin/eval/expr.go
+2
-2
usr/austin/eval/expr1.go
usr/austin/eval/expr1.go
+25
-25
usr/austin/eval/gen.go
usr/austin/eval/gen.go
+7
-7
usr/austin/eval/typec.go
usr/austin/eval/typec.go
+1
-1
usr/austin/eval/world.go
usr/austin/eval/world.go
+1
-1
No files found.
usr/austin/eval/expr.go
View file @
cbcd146f
...
...
@@ -153,7 +153,7 @@ func (a *expr) convertTo(t Type) *expr {
// exceeds max. If negErr is not "", produces an error if possible if
// the value is negative.
func
(
a
*
expr
)
convertToInt
(
max
int64
,
negErr
string
,
errOp
string
)
*
expr
{
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
idealIntType
:
val
:=
a
.
asIdealInt
()();
if
negErr
!=
""
&&
val
.
IsNeg
()
{
...
...
@@ -1773,7 +1773,7 @@ func (a *compiler) compileArrayLen(b *block, expr ast.Expr) (int64, bool) {
return
0
,
false
;
}
switch
_
:=
lenExpr
.
t
.
lit
()
.
(
type
)
{
switch
lenExpr
.
t
.
lit
()
.
(
type
)
{
case
*
intType
:
return
lenExpr
.
asInt
()(
nil
),
true
;
case
*
uintType
:
...
...
usr/austin/eval/expr1.go
View file @
cbcd146f
...
...
@@ -95,7 +95,7 @@ func (a *expr) asInterface() (func(*Thread) interface{}) {
*/
func
(
a
*
expr
)
genConstant
(
v
Value
)
{
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
a
.
eval
=
func
(
t
*
Thread
)
bool
{
return
v
.
(
BoolValue
)
.
Get
(
t
)
}
case
*
uintType
:
...
...
@@ -131,7 +131,7 @@ func (a *expr) genConstant(v Value) {
func
(
a
*
expr
)
genIdentOp
(
level
,
index
int
)
{
a
.
evalAddr
=
func
(
t
*
Thread
)
Value
{
return
t
.
f
.
Get
(
level
,
index
)
};
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
a
.
eval
=
func
(
t
*
Thread
)
bool
{
return
t
.
f
.
Get
(
level
,
index
)
.
(
BoolValue
)
.
Get
(
t
)
}
case
*
uintType
:
...
...
@@ -161,7 +161,7 @@ func (a *expr) genIdentOp(level, index int) {
func
(
a
*
expr
)
genFuncCall
(
call
func
(
t
*
Thread
)
[]
Value
)
{
a
.
exec
=
func
(
t
*
Thread
)
{
call
(
t
)};
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
a
.
eval
=
func
(
t
*
Thread
)
bool
{
return
call
(
t
)[
0
]
.
(
BoolValue
)
.
Get
(
t
)
}
case
*
uintType
:
...
...
@@ -193,7 +193,7 @@ func (a *expr) genFuncCall(call func(t *Thread) []Value) {
func
(
a
*
expr
)
genValue
(
vf
func
(
*
Thread
)
Value
)
{
a
.
evalAddr
=
vf
;
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
a
.
eval
=
func
(
t
*
Thread
)
bool
{
return
vf
(
t
)
.
(
BoolValue
)
.
Get
(
t
)
}
case
*
uintType
:
...
...
@@ -222,7 +222,7 @@ func (a *expr) genValue(vf func(*Thread) Value) {
}
func
(
a
*
expr
)
genUnaryOpNeg
(
v
*
expr
)
{
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
vf
:=
v
.
asUint
();
a
.
eval
=
func
(
t
*
Thread
)
uint64
{
v
:=
vf
(
t
);
return
-
v
}
...
...
@@ -246,7 +246,7 @@ func (a *expr) genUnaryOpNeg(v *expr) {
}
func
(
a
*
expr
)
genUnaryOpNot
(
v
*
expr
)
{
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
vf
:=
v
.
asBool
();
a
.
eval
=
func
(
t
*
Thread
)
bool
{
v
:=
vf
(
t
);
return
!
v
}
...
...
@@ -256,7 +256,7 @@ func (a *expr) genUnaryOpNot(v *expr) {
}
func
(
a
*
expr
)
genUnaryOpXor
(
v
*
expr
)
{
switch
_
:=
a
.
t
.
lit
()
.
(
type
)
{
switch
a
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
vf
:=
v
.
asUint
();
a
.
eval
=
func
(
t
*
Thread
)
uint64
{
v
:=
vf
(
t
);
return
^
v
}
...
...
@@ -273,7 +273,7 @@ func (a *expr) genUnaryOpXor(v *expr) {
}
func
(
a
*
expr
)
genBinOpAdd
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -306,7 +306,7 @@ func (a *expr) genBinOpAdd(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpSub
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -335,7 +335,7 @@ func (a *expr) genBinOpSub(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpMul
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -364,7 +364,7 @@ func (a *expr) genBinOpMul(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpQuo
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -393,7 +393,7 @@ func (a *expr) genBinOpQuo(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpRem
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -413,7 +413,7 @@ func (a *expr) genBinOpRem(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpAnd
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -433,7 +433,7 @@ func (a *expr) genBinOpAnd(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpOr
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -453,7 +453,7 @@ func (a *expr) genBinOpOr(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpXor
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -473,7 +473,7 @@ func (a *expr) genBinOpXor(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpAndNot
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -493,7 +493,7 @@ func (a *expr) genBinOpAndNot(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpShl
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -508,7 +508,7 @@ func (a *expr) genBinOpShl(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpShr
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -523,7 +523,7 @@ func (a *expr) genBinOpShr(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpLss
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -556,7 +556,7 @@ func (a *expr) genBinOpLss(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpGtr
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -589,7 +589,7 @@ func (a *expr) genBinOpGtr(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpLeq
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -622,7 +622,7 @@ func (a *expr) genBinOpLeq(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpGeq
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
uintType
:
lf
:=
l
.
asUint
();
rf
:=
r
.
asUint
();
...
...
@@ -655,7 +655,7 @@ func (a *expr) genBinOpGeq(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpEql
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
lf
:=
l
.
asBool
();
rf
:=
r
.
asBool
();
...
...
@@ -704,7 +704,7 @@ func (a *expr) genBinOpEql(l, r *expr) {
}
func
(
a
*
expr
)
genBinOpNeq
(
l
,
r
*
expr
)
{
switch
_
:=
l
.
t
.
lit
()
.
(
type
)
{
switch
l
.
t
.
lit
()
.
(
type
)
{
case
*
boolType
:
lf
:=
l
.
asBool
();
rf
:=
r
.
asBool
();
...
...
@@ -753,7 +753,7 @@ func (a *expr) genBinOpNeq(l, r *expr) {
}
func
genAssign
(
lt
Type
,
r
*
expr
)
(
func
(
lv
Value
,
t
*
Thread
))
{
switch
_
:=
lt
.
lit
()
.
(
type
)
{
switch
lt
.
lit
()
.
(
type
)
{
case
*
boolType
:
rf
:=
r
.
asBool
();
return
func
(
lv
Value
,
t
*
Thread
)
{
lv
.
(
BoolValue
)
.
Set
(
t
,
rf
(
t
))
}
...
...
usr/austin/eval/gen.go
View file @
cbcd146f
...
...
@@ -181,7 +181,7 @@ func (a *expr) asInterface() (func(*Thread) interface{}) {
*/
func (a *expr) genConstant(v Value) {
switch
_ :=
a.t.lit().(type) {
switch a.t.lit().(type) {
«.repeated section Types»
case «Repr»:
«.section IsIdeal»
...
...
@@ -198,7 +198,7 @@ func (a *expr) genConstant(v Value) {
func (a *expr) genIdentOp(level, index int) {
a.evalAddr = func(t *Thread) Value { return t.f.Get(level, index) };
switch
_ :=
a.t.lit().(type) {
switch a.t.lit().(type) {
«.repeated section Types»
«.section IsIdeal»
«.or»
...
...
@@ -213,7 +213,7 @@ func (a *expr) genIdentOp(level, index int) {
func (a *expr) genFuncCall(call func(t *Thread) []Value) {
a.exec = func(t *Thread) { call(t)};
switch
_ :=
a.t.lit().(type) {
switch a.t.lit().(type) {
«.repeated section Types»
«.section IsIdeal»
«.or»
...
...
@@ -230,7 +230,7 @@ func (a *expr) genFuncCall(call func(t *Thread) []Value) {
func (a *expr) genValue(vf func(*Thread) Value) {
a.evalAddr = vf;
switch
_ :=
a.t.lit().(type) {
switch a.t.lit().(type) {
«.repeated section Types»
«.section IsIdeal»
«.or»
...
...
@@ -245,7 +245,7 @@ func (a *expr) genValue(vf func(*Thread) Value) {
«.repeated section UnaryOps»
func (a *expr) genUnaryOp«Name»(v *expr) {
switch
_ :=
a.t.lit().(type) {
switch a.t.lit().(type) {
«.repeated section Types»
case «Repr»:
«.section IsIdeal»
...
...
@@ -265,7 +265,7 @@ func (a *expr) genUnaryOp«Name»(v *expr) {
«.end»
«.repeated section BinaryOps»
func (a *expr) genBinOp«Name»(l, r *expr) {
switch
_ :=
l.t.lit().(type) {
switch l.t.lit().(type) {
«.repeated section Types»
case «Repr»:
«.section IsIdeal»
...
...
@@ -290,7 +290,7 @@ func (a *expr) genBinOp«Name»(l, r *expr) {
«.end»
func genAssign(lt Type, r *expr) (func(lv Value, t *Thread)) {
switch
_ :=
lt.lit().(type) {
switch lt.lit().(type) {
«.repeated section Types»
«.section IsIdeal»
«.or»
...
...
usr/austin/eval/typec.go
View file @
cbcd146f
...
...
@@ -241,7 +241,7 @@ func (a *typeCompiler) compileMapType(x *ast.MapType) Type {
}
// XXX(Spec) The Map types section explicitly lists all types
// that can be map keys except for function types.
switch
_
:=
key
.
lit
()
.
(
type
)
{
switch
key
.
lit
()
.
(
type
)
{
case
*
StructType
:
a
.
diagAt
(
x
,
"map key cannot be a struct type"
);
return
nil
;
...
...
usr/austin/eval/world.go
View file @
cbcd146f
...
...
@@ -129,7 +129,7 @@ func (e *exprCode) Type() Type {
func
(
e
*
exprCode
)
Run
()
(
Value
,
os
.
Error
)
{
t
:=
new
(
Thread
);
t
.
f
=
e
.
w
.
scope
.
NewFrame
(
nil
);
switch
_
:=
e
.
e
.
t
.
(
type
)
{
switch
e
.
e
.
t
.
(
type
)
{
case
*
idealIntType
:
return
&
idealIntV
{
e
.
e
.
asIdealInt
()()},
nil
;
case
*
idealFloatType
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment