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

Side by Side Diff: dart/frog/leg/ssa/nodes.dart

Issue 9114053: Record names of constructors and use that to implement Object.toString. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Avoid constant folding 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 | « dart/frog/leg/lib/core.dart ('k') | dart/frog/tests/leg_only/src/ToStringTest.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface HVisitor<R> { 5 interface HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBitAnd(HBitAnd node); 7 R visitBitAnd(HBitAnd node);
8 R visitBitNot(HBitNot node); 8 R visitBitNot(HBitNot node);
9 R visitBitOr(HBitOr node); 9 R visitBitOr(HBitOr node);
10 R visitBitXor(HBitXor node); 10 R visitBitXor(HBitXor node);
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 bool hasExpectedType() => builtin || type.isUnknown() || left.isString(); 1190 bool hasExpectedType() => builtin || type.isUnknown() || left.isString();
1191 1191
1192 HType computeDesiredInputType(HInstruction input) { 1192 HType computeDesiredInputType(HInstruction input) {
1193 // TODO(floitsch): we want the target to be a function. 1193 // TODO(floitsch): we want the target to be a function.
1194 if (input == target) return HType.UNKNOWN; 1194 if (input == target) return HType.UNKNOWN;
1195 if (isString() || left.isString()) { 1195 if (isString() || left.isString()) {
1196 return (input == left) ? HType.STRING : HType.UNKNOWN; 1196 return (input == left) ? HType.STRING : HType.UNKNOWN;
1197 } 1197 }
1198 if (right.isString()) return HType.STRING; 1198 if (right.isString()) return HType.STRING;
1199 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; 1199 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER;
1200 if (type.isUnknown()) return HType.NUMBER;
ngeoffray 2012/01/11 12:30:13 Crying :-)
1201 return HType.UNKNOWN; 1200 return HType.UNKNOWN;
1202 } 1201 }
1203 } 1202 }
1204 1203
1205 class HDivide extends HBinaryArithmetic { 1204 class HDivide extends HBinaryArithmetic {
1206 HDivide(HStatic target, HInstruction left, HInstruction right) 1205 HDivide(HStatic target, HInstruction left, HInstruction right)
1207 : super(target, left, right); 1206 : super(target, left, right);
1208 accept(HVisitor visitor) => visitor.visitDivide(this); 1207 accept(HVisitor visitor) => visitor.visitDivide(this);
1209 num evaluate(num a, num b) => a / b; 1208 num evaluate(num a, num b) => a / b;
1210 bool typeEquals(other) => other is HDivide; 1209 bool typeEquals(other) => other is HDivide;
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 HInstruction first, 1985 HInstruction first,
1987 HInstruction second) 1986 HInstruction second)
1988 : super(<HInstruction>[first, second]); 1987 : super(<HInstruction>[first, second]);
1989 toString() => operation; 1988 toString() => operation;
1990 accept(HVisitor visitor) => visitor.visitLogicalOperator(this); 1989 accept(HVisitor visitor) => visitor.visitLogicalOperator(this);
1991 HInstruction get left() => inputs[0]; 1990 HInstruction get left() => inputs[0];
1992 HInstruction get right() => inputs[1]; 1991 HInstruction get right() => inputs[1];
1993 HType computeType() => HType.BOOLEAN; 1992 HType computeType() => HType.BOOLEAN;
1994 bool hasExpectedType() => true; 1993 bool hasExpectedType() => true;
1995 } 1994 }
OLDNEW
« no previous file with comments | « dart/frog/leg/lib/core.dart ('k') | dart/frog/tests/leg_only/src/ToStringTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698