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

Side by Side Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1864753002: Use isValidConst flag to distinguish between const / final expressions. (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library summary_resynthesizer; 5 library summary_resynthesizer;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 int doublePtr = 0; 279 int doublePtr = 0;
280 int stringPtr = 0; 280 int stringPtr = 0;
281 int refPtr = 0; 281 int refPtr = 0;
282 final List<Expression> stack = <Expression>[]; 282 final List<Expression> stack = <Expression>[];
283 283
284 _ConstExprBuilder(this.resynthesizer, this.uc); 284 _ConstExprBuilder(this.resynthesizer, this.uc);
285 285
286 Expression get expr => stack.single; 286 Expression get expr => stack.single;
287 287
288 Expression build() { 288 Expression build() {
289 if (uc.isInvalid) { 289 if (!uc.isValidConst) {
290 return AstFactory.identifier3(r'$$invalidConstExpr$$'); 290 return AstFactory.identifier3(r'$$invalidConstExpr$$');
291 } 291 }
292 for (UnlinkedConstOperation operation in uc.operations) { 292 for (UnlinkedConstOperation operation in uc.operations) {
293 switch (operation) { 293 switch (operation) {
294 case UnlinkedConstOperation.pushNull: 294 case UnlinkedConstOperation.pushNull:
295 _push(AstFactory.nullLiteral()); 295 _push(AstFactory.nullLiteral());
296 break; 296 break;
297 // bool 297 // bool
298 case UnlinkedConstOperation.pushFalse: 298 case UnlinkedConstOperation.pushFalse:
299 _push(AstFactory.booleanLiteral(false)); 299 _push(AstFactory.booleanLiteral(false));
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 static String _getElementIdentifier(String name, ReferenceKind kind) { 2636 static String _getElementIdentifier(String name, ReferenceKind kind) {
2637 if (kind == ReferenceKind.topLevelPropertyAccessor || 2637 if (kind == ReferenceKind.topLevelPropertyAccessor ||
2638 kind == ReferenceKind.propertyAccessor) { 2638 kind == ReferenceKind.propertyAccessor) {
2639 if (!name.endsWith('=')) { 2639 if (!name.endsWith('=')) {
2640 return name + '?'; 2640 return name + '?';
2641 } 2641 }
2642 } 2642 }
2643 return name; 2643 return name;
2644 } 2644 }
2645 } 2645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698