Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: frog/value.dart

Issue 9107067: Work in progress: changes to interpretation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: work in progress Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/utils.dart ('k') | frog/var_member.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * Represents a meta-value for code generation. 7 * Represents a meta-value for code generation.
8 */ 8 */
9 class Value { 9 class Value {
10 /** The inferred (i.e. most precise) [Type] of the [Value]. */ 10 /** The inferred (i.e. most precise) [Type] of the [Value]. */
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 var ret = x._tryUnion(y); 60 var ret = x._tryUnion(y);
61 if (ret != null) return ret; 61 if (ret != null) return ret;
62 62
63 // TODO(jmesserly): might want to call a _tryUnionReversed here. 63 // TODO(jmesserly): might want to call a _tryUnionReversed here.
64 ret = y._tryUnion(x); 64 ret = y._tryUnion(x);
65 if (ret != null) return ret; 65 if (ret != null) return ret;
66 66
67 // TODO(jmesserly): should use something like UnionValue and track the 67 // TODO(jmesserly): should use something like UnionValue and track the
68 // precise set of types. For now we find the Type.union. 68 // precise set of types. For now we find the Type.union.
69 var t = Type.union(x.type, y.type);
70 if (t == x.type) return x;
71 if (t == y.type) return y;
69 72
70 // TODO(jmesserly): What to do about code? Right now, we're intentionally 73 // TODO(jmesserly): What to do about code? Right now, we're intentionally
71 // throwing it away because they aren't used in the current flow-insensitive 74 // throwing it away because they aren't used in the current flow-insensitive
72 // inference. 75 // inference.
73 return new Value(Type.union(x.type, y.type), null, null); 76 return new Value(t, null, null);
74 } 77 }
75 78
76 Value _tryUnion(Value right) => null; 79 Value _tryUnion(Value right) => null;
77 80
78 // TODO(jimhug): remove once type system works better. 81 // TODO(jimhug): remove once type system works better.
79 setField(Member field, Value value, [bool duringInit = false]) { } 82 setField(Member field, Value value, [bool duringInit = false]) { }
80 83
81 // Nothing to do in general? 84 // Nothing to do in general?
82 validateInitialized(SourceSpan span) { } 85 validateInitialized(SourceSpan span) { }
83 86
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 } 1470 }
1468 return super.unop(kind, context, node); 1471 return super.unop(kind, context, node);
1469 } 1472 }
1470 Value binop(int kind, var other, MethodGenerator context, var node) { 1473 Value binop(int kind, var other, MethodGenerator context, var node) {
1471 if (value != null) { 1474 if (value != null) {
1472 return replaceValue(value.binop(kind, _unwrap(other), context, node)); 1475 return replaceValue(value.binop(kind, _unwrap(other), context, node));
1473 } 1476 }
1474 return super.binop(kind, other, context, node); 1477 return super.binop(kind, other, context, node);
1475 } 1478 }
1476 } 1479 }
1480
OLDNEW
« no previous file with comments | « frog/utils.dart ('k') | frog/var_member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698