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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1067533003: cps-ir: Handle factories and redirecting constructors with JS backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix in test case Created 5 years, 8 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index 946cdb55d82f09bdc4ebbaee426677fffabc4715..8963247eb9d4510d4812b190ecaa65947a79de88 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -95,6 +95,9 @@ class IrBuilderTask extends CompilerTask {
}
bool canBuild(Element element) {
+ // If using JavaScript backend, don't try to bail out early.
+ if (compiler.backend is JavaScriptBackend) return true;
+
if (element is TypedefElement) return false;
if (element is FunctionElement) {
// TODO(sigurdm): Support native functions for dart2js.
@@ -1754,21 +1757,6 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
});
}
- @override
- ir.Primitive handleConstructorInvoke(
- ast.NewExpression node,
- ConstructorElement constructor,
- DartType type,
- ast.NodeList arguments,
- Selector selector, _) {
- List<ir.Primitive> arguments =
- node.send.arguments.mapToList(visit, growable:false);
- arguments = normalizeStaticArguments(
- selector.callStructure, constructor, arguments);
- return irBuilder.buildConstructorInvocation(
- constructor, selector, type, arguments);
- }
-
ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) {
assert(irBuilder.isOpen);
ir.Primitive first = visit(node.first);
@@ -2121,6 +2109,22 @@ class DartIrBuilderVisitor extends IrBuilderVisitor {
irBuilder.add(new ir.LetPrim(prim));
return prim;
}
+
+ @override
+ ir.Primitive handleConstructorInvoke(
+ ast.NewExpression node,
+ ConstructorElement constructor,
+ DartType type,
+ ast.NodeList arguments,
+ Selector selector, _) {
+ List<ir.Primitive> arguments =
+ node.send.arguments.mapToList(visit, growable:false);
+ return irBuilder.buildConstructorInvocation(
+ constructor,
+ selector,
+ type,
+ arguments);
+ }
}
/// The [IrBuilder]s view on the information about the program that has been
@@ -2707,6 +2711,24 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
irBuilder.add(new ir.LetPrim(type));
return type;
}
+
+ @override
+ ir.Primitive handleConstructorInvoke(
+ ast.NewExpression node,
+ ConstructorElement constructor,
+ DartType type,
+ ast.NodeList arguments,
+ Selector selector, _) {
+ List<ir.Primitive> arguments =
+ node.send.arguments.mapToList(visit, growable:false);
+ arguments = normalizeStaticArguments(
+ selector.callStructure, constructor, arguments);
+ return irBuilder.buildConstructorInvocation(
+ constructor.effectiveTarget,
+ selector,
+ constructor.computeEffectiveTargetType(type),
+ arguments);
+ }
}
/// Interface for generating [SourceInformation] for the CPS.
« no previous file with comments | « no previous file | tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698