Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(86)

Delta Between Two Patch Sets: src/pkg/exp/eval/expr1.go

Issue 850041: code review 850041: single argument panic (Closed)
Left Patch Set: Created 15 years ago
Right Patch Set: code review 850041: single argument panic Created 15 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/exp/eval/expr.go ('k') | src/pkg/exp/eval/gen.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // This file is machine generated by gen.go. 1 // This file is machine generated by gen.go.
2 // 6g gen.go && 6l gen.6 && ./6.out >expr1.go 2 // 6g gen.go && 6l gen.6 && ./6.out >expr1.go
3 3
4 package eval 4 package eval
5 5
6 import ( 6 import (
7 "bignum" 7 "bignum"
8 "log" 8 "log"
9 ) 9 )
10 10
11 /* 11 /*
12 * "As" functions. These retrieve evaluator functions from an 12 * "As" functions. These retrieve evaluator functions from an
13 * expr, panicking if the requested evaluator has the wrong type. 13 * expr, panicking if the requested evaluator has the wrong type.
14 */ 14 */
15 func (a *expr) asBool() func(*Thread) bool { 15 func (a *expr) asBool() func(*Thread) bool {
16 return a.eval.(func(*Thread) bool) 16 return a.eval.(func(*Thread) bool)
17 } 17 }
18 func (a *expr) asUint() func(*Thread) uint64 { 18 func (a *expr) asUint() func(*Thread) uint64 {
19 return a.eval.(func(*Thread) uint64) 19 return a.eval.(func(*Thread) uint64)
20 } 20 }
21 func (a *expr) asInt() func(*Thread) int64 { 21 func (a *expr) asInt() func(*Thread) int64 {
22 return a.eval.(func(*Thread) int64) 22 return a.eval.(func(*Thread) int64)
23 } 23 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return func(t *Thread) interface{} { return sf(t) } 83 return func(t *Thread) interface{} { return sf(t) }
84 case func(t *Thread) Map: 84 case func(t *Thread) Map:
85 return func(t *Thread) interface{} { return sf(t) } 85 return func(t *Thread) interface{} { return sf(t) }
86 default: 86 default:
87 log.Crashf("unexpected expression node type %T at %v", a.eval, a .pos) 87 log.Crashf("unexpected expression node type %T at %v", a.eval, a .pos)
88 } 88 }
89 panic("fail") 89 panic("fail")
90 } 90 }
91 91
92 /* 92 /*
93 * Operator generators. 93 * Operator generators.
94 */ 94 */
95 95
96 func (a *expr) genConstant(v Value) { 96 func (a *expr) genConstant(v Value) {
97 switch a.t.lit().(type) { 97 switch a.t.lit().(type) {
98 case *boolType: 98 case *boolType:
99 a.eval = func(t *Thread) bool { return v.(BoolValue).Get(t) } 99 a.eval = func(t *Thread) bool { return v.(BoolValue).Get(t) }
100 case *uintType: 100 case *uintType:
101 a.eval = func(t *Thread) uint64 { return v.(UintValue).Get(t) } 101 a.eval = func(t *Thread) uint64 { return v.(UintValue).Get(t) }
102 case *intType: 102 case *intType:
103 a.eval = func(t *Thread) int64 { return v.(IntValue).Get(t) } 103 a.eval = func(t *Thread) int64 { return v.(IntValue).Get(t) }
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 rf := r.asSlice() 1896 rf := r.asSlice()
1897 return func(lv Value, t *Thread) { lv.(SliceValue).Set(t, rf(t)) } 1897 return func(lv Value, t *Thread) { lv.(SliceValue).Set(t, rf(t)) }
1898 case *MapType: 1898 case *MapType:
1899 rf := r.asMap() 1899 rf := r.asMap()
1900 return func(lv Value, t *Thread) { lv.(MapValue).Set(t, rf(t)) } 1900 return func(lv Value, t *Thread) { lv.(MapValue).Set(t, rf(t)) }
1901 default: 1901 default:
1902 log.Crashf("unexpected left operand type %v at %v", lt, r.pos) 1902 log.Crashf("unexpected left operand type %v at %v", lt, r.pos)
1903 } 1903 }
1904 panic("fail") 1904 panic("fail")
1905 } 1905 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b