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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2049343002: Revert "check that Class and typedef refs are const" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index a87e6771b4a700017d9e6626bd18510164dc9866..871f6afcae0fcc50079894b67c19f372c6585494 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -1996,15 +1996,17 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// TODO(23998): Remove this when all information goes through
// the [SendStructure].
registry.setSelector(node, selector);
-
+
+ // The node itself is not a constant but we register the selector (the
+ // identifier that refers to the class/typedef) as a constant.
registry.useElement(node.selector, element);
- analyzeConstantDeferred(node.selector);
+ analyzeConstantDeferred(node.selector, enforceConst: false);
registry.registerSendStructure(
node, new InvokeStructure(semantics, selector));
return const NoneResult();
} else {
- analyzeConstantDeferred(node);
+ analyzeConstantDeferred(node, enforceConst: false);
registry.setConstant(node, semantics.constant);
registry.registerSendStructure(node, new GetStructure(semantics));
@@ -4003,9 +4005,9 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
}
- void analyzeConstant(Node node) {
- ConstantExpression constant =
- compiler.resolver.constantCompiler.compileNode(node, registry.mapping);
+ void analyzeConstant(Node node, {enforceConst: true}) {
+ ConstantExpression constant = compiler.resolver.constantCompiler
+ .compileNode(node, registry.mapping, enforceConst: enforceConst);
if (constant == null) {
assert(invariant(node, compiler.compilationFailed));
@@ -4018,9 +4020,10 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
}
- void analyzeConstantDeferred(Node node, {void onAnalyzed()}) {
+ void analyzeConstantDeferred(Node node,
+ {bool enforceConst: true, void onAnalyzed()}) {
addDeferredAction(enclosingElement, () {
- analyzeConstant(node);
+ analyzeConstant(node, enforceConst: enforceConst);
if (onAnalyzed != null) {
onAnalyzed();
}
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698