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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 25478009: Handle compile-time constness for conditionals and type literal calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 years, 2 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/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 10680e7c2ec6dae3cba62a4b36c20e652414a225..7a27b1d398e436ca27dc88b2d924da81808c55bf 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -2441,7 +2441,9 @@ class ResolverVisitor extends MappingVisitor<Element> {
// type literal.
mapping.setType(node, compiler.typeClass.computeType(compiler));
world.registerTypeLiteral(target, mapping);
- analyzeConstant(node);
+
+ // Don't try to make constants of calls to type literals.
+ analyzeConstant(node, isConst: !node.isCall);
}
}
@@ -2892,11 +2894,10 @@ class ResolverVisitor extends MappingVisitor<Element> {
return null;
}
- void analyzeConstant(Node node) {
+ void analyzeConstant(Node node, {bool isConst: true}) {
addPostProcessAction(enclosingElement, () {
- mapping.setConstant(node,
- compiler.constantHandler.compileNodeWithDefinitions(
- node, mapping, isConst: true));
+ compiler.constantHandler.compileNodeWithDefinitions(
+ node, mapping, isConst: isConst);
});
}

Powered by Google App Engine
This is Rietveld 408576698