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

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

Issue 1952663006: Support for NamedExpression(s) as constructor initializer arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 final UnlinkedConst uc; 276 final UnlinkedConst uc;
277 277
278 int intPtr = 0; 278 int intPtr = 0;
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 build() {
287 Expression expr = _build();
288 if (uc.name.isNotEmpty) {
289 return AstFactory.namedExpression2(uc.name, expr);
290 }
291 return expr;
292 }
287 293
288 Expression build() { 294 Expression _build() {
289 if (!uc.isValidConst) { 295 if (!uc.isValidConst) {
290 return AstFactory.identifier3(r'$$invalidConstExpr$$'); 296 return AstFactory.identifier3(r'$$invalidConstExpr$$');
291 } 297 }
292 for (UnlinkedConstOperation operation in uc.operations) { 298 for (UnlinkedConstOperation operation in uc.operations) {
293 switch (operation) { 299 switch (operation) {
294 case UnlinkedConstOperation.pushNull: 300 case UnlinkedConstOperation.pushNull:
295 _push(AstFactory.nullLiteral()); 301 _push(AstFactory.nullLiteral());
296 break; 302 break;
297 // bool 303 // bool
298 case UnlinkedConstOperation.pushFalse: 304 case UnlinkedConstOperation.pushFalse:
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 static String _getElementIdentifier(String name, ReferenceKind kind) { 2656 static String _getElementIdentifier(String name, ReferenceKind kind) {
2651 if (kind == ReferenceKind.topLevelPropertyAccessor || 2657 if (kind == ReferenceKind.topLevelPropertyAccessor ||
2652 kind == ReferenceKind.propertyAccessor) { 2658 kind == ReferenceKind.propertyAccessor) {
2653 if (!name.endsWith('=')) { 2659 if (!name.endsWith('=')) {
2654 return name + '?'; 2660 return name + '?';
2655 } 2661 }
2656 } 2662 }
2657 return name; 2663 return name;
2658 } 2664 }
2659 } 2665 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698