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

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

Issue 2539243002: Transition analyzer and analysis_server to new astFactory; remove old AST factory methods. (Closed)
Patch Set: Update CHANGELOG Created 4 years 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/standard_ast_factory.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 11 import 'package:analyzer/dart/ast/token.dart';
11 import 'package:analyzer/dart/element/element.dart'; 12 import 'package:analyzer/dart/element/element.dart';
12 import 'package:analyzer/dart/element/type.dart'; 13 import 'package:analyzer/dart/element/type.dart';
13 import 'package:analyzer/src/dart/element/element.dart'; 14 import 'package:analyzer/src/dart/element/element.dart';
14 import 'package:analyzer/src/dart/element/handle.dart'; 15 import 'package:analyzer/src/dart/element/handle.dart';
15 import 'package:analyzer/src/dart/element/member.dart'; 16 import 'package:analyzer/src/dart/element/member.dart';
16 import 'package:analyzer/src/dart/element/type.dart'; 17 import 'package:analyzer/src/dart/element/type.dart';
17 import 'package:analyzer/src/generated/engine.dart'; 18 import 'package:analyzer/src/generated/engine.dart';
18 import 'package:analyzer/src/generated/resolver.dart'; 19 import 'package:analyzer/src/generated/resolver.dart';
19 import 'package:analyzer/src/generated/source_io.dart'; 20 import 'package:analyzer/src/generated/source_io.dart';
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 node.type = type; 582 node.type = type;
582 (node.name as SimpleIdentifier).staticElement = type.element; 583 (node.name as SimpleIdentifier).staticElement = type.element;
583 return node; 584 return node;
584 } 585 }
585 586
586 PropertyAccessorElement _getStringLengthElement() => 587 PropertyAccessorElement _getStringLengthElement() =>
587 resynthesizer.typeProvider.stringType.getGetter('length'); 588 resynthesizer.typeProvider.stringType.getGetter('length');
588 589
589 InterpolationElement _newInterpolationElement(Expression expr) { 590 InterpolationElement _newInterpolationElement(Expression expr) {
590 if (expr is SimpleStringLiteral) { 591 if (expr is SimpleStringLiteral) {
591 return new InterpolationString(expr.literal, expr.value); 592 return astFactory.interpolationString(expr.literal, expr.value);
592 } else { 593 } else {
593 return new InterpolationExpression( 594 return astFactory.interpolationExpression(
594 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION), 595 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION),
595 expr, 596 expr,
596 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); 597 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
597 } 598 }
598 } 599 }
599 600
600 /** 601 /**
601 * Convert the next reference to the [DartType] and return the AST 602 * Convert the next reference to the [DartType] and return the AST
602 * corresponding to this type. 603 * corresponding to this type.
603 */ 604 */
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 TypeArgumentList typeArguments; 708 TypeArgumentList typeArguments;
708 int numTypeArguments = uc.ints[intPtr++]; 709 int numTypeArguments = uc.ints[intPtr++];
709 if (numTypeArguments > 0) { 710 if (numTypeArguments > 0) {
710 List<TypeName> typeNames = new List<TypeName>(numTypeArguments); 711 List<TypeName> typeNames = new List<TypeName>(numTypeArguments);
711 for (int i = 0; i < numTypeArguments; i++) { 712 for (int i = 0; i < numTypeArguments; i++) {
712 typeNames[i] = _newTypeName(); 713 typeNames[i] = _newTypeName();
713 } 714 }
714 typeArguments = AstTestFactory.typeArgumentList(typeNames); 715 typeArguments = AstTestFactory.typeArgumentList(typeNames);
715 } 716 }
716 if (node is SimpleIdentifier) { 717 if (node is SimpleIdentifier) {
717 _push(new MethodInvocation( 718 _push(astFactory.methodInvocation(
718 null, 719 null,
719 TokenFactory.tokenFromType(TokenType.PERIOD), 720 TokenFactory.tokenFromType(TokenType.PERIOD),
720 node, 721 node,
721 typeArguments, 722 typeArguments,
722 AstTestFactory.argumentList(arguments))); 723 AstTestFactory.argumentList(arguments)));
723 } else { 724 } else {
724 throw new UnimplementedError('For ${node?.runtimeType}: $node'); 725 throw new UnimplementedError('For ${node?.runtimeType}: $node');
725 } 726 }
726 } 727 }
727 728
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 static String _getElementIdentifier(String name, ReferenceKind kind) { 1888 static String _getElementIdentifier(String name, ReferenceKind kind) {
1888 if (kind == ReferenceKind.topLevelPropertyAccessor || 1889 if (kind == ReferenceKind.topLevelPropertyAccessor ||
1889 kind == ReferenceKind.propertyAccessor) { 1890 kind == ReferenceKind.propertyAccessor) {
1890 if (!name.endsWith('=')) { 1891 if (!name.endsWith('=')) {
1891 return name + '?'; 1892 return name + '?';
1892 } 1893 }
1893 } 1894 }
1894 return name; 1895 return name;
1895 } 1896 }
1896 } 1897 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698