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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1949603003: Finer grain control over specifying which variables have invalid constant initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 4fdd54e4abe956dd1f078f315ca8b8522698c096..891300e27ede08d486603db82654905a0029b383 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -286,6 +286,9 @@ class _ConstExprBuilder {
Expression get expr => stack.single;
Expression build() {
+ if (!uc.isValidConst) {
+ return AstFactory.identifier3(r'$$invalidConstExpr$$');
+ }
for (UnlinkedConstOperation operation in uc.operations) {
switch (operation) {
case UnlinkedConstOperation.pushNull:
@@ -459,7 +462,8 @@ class _ConstExprBuilder {
case UnlinkedConstOperation.typeCast:
case UnlinkedConstOperation.typeCheck:
case UnlinkedConstOperation.throwException:
- return AstFactory.identifier3(r'$notConst$');
+ throw new UnimplementedError(
+ 'Unexpected $operation in a constant expression.');
}
}
return stack.single;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698