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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 12095011: Properly register types on the JS foreign instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (revision 17700)
+++ sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (working copy)
@@ -1547,42 +1547,29 @@
final bool isStatement;
HForeign(this.code,
- DartString declaredType,
+ this.foreignType,
List<HInstruction> inputs,
{this.isStatement: false})
- : foreignType = computeTypeFromDeclaredType(declaredType),
- super(inputs) {
+ : super(inputs) {
setAllSideEffects();
setDependsOnSomething();
}
HForeign.statement(code, List<HInstruction> inputs)
- : this(code, const LiteralDartString('var'), inputs, isStatement: true);
+ : this(code, HType.UNKNOWN, inputs, isStatement: true);
accept(HVisitor visitor) => visitor.visitForeign(this);
- static HType computeTypeFromDeclaredType(DartString declaredType) {
- if (declaredType.slowToString() == 'bool') return HType.BOOLEAN;
- if (declaredType.slowToString() == 'int') return HType.INTEGER;
- if (declaredType.slowToString() == 'double') return HType.DOUBLE;
- if (declaredType.slowToString() == 'num') return HType.NUMBER;
- if (declaredType.slowToString() == 'String') return HType.STRING;
- if (declaredType.slowToString() == '=List') return HType.READABLE_ARRAY;
- return HType.UNKNOWN;
- }
-
HType get guaranteedType => foreignType;
bool isJsStatement() => isStatement;
bool canThrow() => true;
-
}
class HForeignNew extends HForeign {
ClassElement element;
- HForeignNew(this.element, List<HInstruction> inputs)
- : super(const LiteralDartString("new"),
- const LiteralDartString("Object"), inputs);
+ HForeignNew(this.element, HType type, List<HInstruction> inputs)
+ : super(const LiteralDartString("new"), type, inputs);
accept(HVisitor visitor) => visitor.visitForeignNew(this);
}

Powered by Google App Engine
This is Rietveld 408576698