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

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

Issue 2990733002: Don't resynthesize invalid constant expressions at all. (Closed)
Patch Set: Created 3 years, 5 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/element_text.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 15fe567f16fb775b682a216e8fd0bdb1151a2121..11b74c309f8749ab336798b14323625a8e2f8b25 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -330,7 +330,7 @@ class _ConstExprBuilder {
Expression build() {
if (!uc.isValidConst) {
- return AstTestFactory.identifier3(r'$$invalidConstExpr$$');
+ return null;
}
for (UnlinkedExprOperation operation in uc.operations) {
switch (operation) {
@@ -1572,7 +1572,9 @@ class _UnitResynthesizer {
ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedExpr uc) {
ElementAnnotationImpl elementAnnotation = new ElementAnnotationImpl(unit);
Expression constExpr = _buildConstExpression(context, uc);
- if (constExpr is Identifier) {
+ if (constExpr == null) {
+ // Invalid constant expression.
+ } else if (constExpr is Identifier) {
ArgumentList arguments =
constExpr.getProperty(_ConstExprBuilder.ARGUMENT_LIST);
elementAnnotation.element = constExpr.staticElement;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/element_text.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698