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

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

Issue 85813002: Revert "Revert "Build new IR for functions returning a constant."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: feedback by kasper Created 7 years, 1 month 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/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 1eed9f52c74e1f34d71d51d709ae1a574b3f8be9..58fa571b419ca431365667d006cd4c623edde538 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
@@ -15,6 +15,7 @@ import 'inferrer_visitor.dart' show TypeSystem, ArgumentsTypes;
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;
part 'type_graph_nodes.dart';
@@ -472,8 +473,12 @@ class TypeGraphInferrerEngine
if (analyzedElements.contains(element)) return;
analyzedElements.add(element);
- SimpleTypeInferrerVisitor visitor =
- new SimpleTypeInferrerVisitor(element, compiler, this);
+ var visitor;
+ if (compiler.irBuilder.hasIr(element)) {
+ visitor = new IrTypeInferrerVisitor(compiler, element, this);
+ } else {
+ visitor = new SimpleTypeInferrerVisitor(element, compiler, this);
+ }
TypeInformation type;
compiler.withCurrentElement(element, () {
type = visitor.run();
@@ -684,6 +689,7 @@ class TypeGraphInferrerEngine
void recordReturnType(Element element, TypeInformation type) {
TypeInformation info = types.getInferredTypeOf(element);
if (element.name == '==') {
+ // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'.
info.addAssignment(types.boolType);
}
// TODO(ngeoffray): Clean up. We do these checks because

Powered by Google App Engine
This is Rietveld 408576698