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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart

Issue 147353010: Infer types for compile-time constant closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file and one more test. Created 6 years, 10 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/dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
index b568d03b6da29db177fe171cfacd09fa6c0868a1..e5201e9805974bd336bc69298287dd91e85acad1 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
@@ -17,7 +17,7 @@ import '../native_handler.dart' as native;
import '../util/util.dart' show Spannable, Setlet;
import 'simple_types_inferrer.dart';
import 'ir_type_inferrer.dart';
-import '../dart2jslib.dart' show invariant, Constant;
+import '../dart2jslib.dart' show invariant, Constant, FunctionConstant;
part 'type_graph_nodes.dart';
part 'closure_tracer.dart';
@@ -555,7 +555,12 @@ class TypeGraphInferrerEngine
Constant value =
compiler.constantHandler.getConstantForVariable(element);
if (value != null) {
- type = types.getConcreteTypeFor(value.computeMask(compiler));
+ if (value.isFunction()) {
+ FunctionConstant functionConstant = value;
+ type = types.allocateClosure(node, functionConstant.element);
+ } else {
+ type = types.getConcreteTypeFor(value.computeMask(compiler));
+ }
}
}
recordType(element, type);
« no previous file with comments | « no previous file | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698