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

Side by Side Diff: src/pkg/exp/ssa/interp/value.go

Issue 7392053: code review 7392053: exp/ssa: a number of bug fixes. (Closed)
Patch Set: diff -r 1a366df36e95 https://code.google.com/p/go/ Created 12 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/exp/ssa/interp/testdata/coverage.go ('k') | src/pkg/exp/ssa/ssadump.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package interp 1 package interp
2 2
3 // Values 3 // Values
4 // 4 //
5 // All interpreter values are "boxed" in the empty interface, value. 5 // All interpreter values are "boxed" in the empty interface, value.
6 // The range of possible dynamic types within value are: 6 // The range of possible dynamic types within value are:
7 // 7 //
8 // - bool 8 // - bool
9 // - numbers (all built-in int/float/complex types are distinguished) 9 // - numbers (all built-in int/float/complex types are distinguished)
10 // - string 10 // - string
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 case rtype: 219 case rtype:
220 return x.eq(y) 220 return x.eq(y)
221 221
222 // Since the following types don't support comparison, 222 // Since the following types don't support comparison,
223 // these cases are only reachable if one of x or y is 223 // these cases are only reachable if one of x or y is
224 // (literally) nil. 224 // (literally) nil.
225 case *hashmap: 225 case *hashmap:
226 return x == y.(*hashmap) 226 return x == y.(*hashmap)
227 case map[value]value: 227 case map[value]value:
228 return (x != nil) == (y.(map[value]value) != nil) 228 return (x != nil) == (y.(map[value]value) != nil)
229 » case *ssa.Function: 229 » case *ssa.Function, *closure:
230 » » return x == y.(*ssa.Function) 230 » » return x == y
231 » case *closure:
232 » » return x == y.(*closure)
233 case []value: 231 case []value:
234 return (x != nil) == (y.([]value) != nil) 232 return (x != nil) == (y.([]value) != nil)
235 } 233 }
236 panic(fmt.Sprintf("comparing incomparable type %T", x)) 234 panic(fmt.Sprintf("comparing incomparable type %T", x))
237 } 235 }
238 236
239 // Returns an integer hash of x such that equals(x, y) => hash(x) == hash(y). 237 // Returns an integer hash of x such that equals(x, y) => hash(x) == hash(y).
240 func hash(x value) int { 238 func hash(x value) int {
241 switch x := x.(type) { 239 switch x := x.(type) {
242 case bool: 240 case bool:
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 it.i += n 456 it.i += n
459 return okv 457 return okv
460 } 458 }
461 459
462 type mapIter chan [2]value 460 type mapIter chan [2]value
463 461
464 func (it mapIter) next() tuple { 462 func (it mapIter) next() tuple {
465 kv, ok := <-it 463 kv, ok := <-it
466 return tuple{ok, kv[0], kv[1]} 464 return tuple{ok, kv[0], kv[1]}
467 } 465 }
OLDNEW
« no previous file with comments | « src/pkg/exp/ssa/interp/testdata/coverage.go ('k') | src/pkg/exp/ssa/ssadump.go » ('j') | no next file with comments »

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