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

Side by Side Diff: pkg/analyzer-experimental/lib/src/generated/ast.dart

Issue 12543003: Use limited JavaStringBuilder implementation instead of Dart StringBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.ast; 4 library engine.ast;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart'; 8 import 'java_engine.dart';
9 import 'error.dart'; 9 import 'error.dart';
10 import 'source.dart' show LineInfo; 10 import 'source.dart' show LineInfo;
(...skipping 6780 matching lines...) Expand 10 before | Expand all | Expand 10 after
6791 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); 6791 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this);
6792 Token get beginToken => _components.beginToken; 6792 Token get beginToken => _components.beginToken;
6793 /** 6793 /**
6794 * Return the components of the identifier. 6794 * Return the components of the identifier.
6795 * @return the components of the identifier 6795 * @return the components of the identifier
6796 */ 6796 */
6797 NodeList<SimpleIdentifier> get components => _components; 6797 NodeList<SimpleIdentifier> get components => _components;
6798 Element get element => null; 6798 Element get element => null;
6799 Token get endToken => _components.endToken; 6799 Token get endToken => _components.endToken;
6800 String get name { 6800 String get name {
6801 StringBuffer builder = new StringBuffer(); 6801 JavaStringBuilder builder = new JavaStringBuilder();
6802 bool needsPeriod = false; 6802 bool needsPeriod = false;
6803 for (SimpleIdentifier identifier in _components) { 6803 for (SimpleIdentifier identifier in _components) {
6804 if (needsPeriod) { 6804 if (needsPeriod) {
6805 builder.write("."); 6805 builder.append(".");
6806 } else { 6806 } else {
6807 needsPeriod = true; 6807 needsPeriod = true;
6808 } 6808 }
6809 builder.write(identifier.name); 6809 builder.append(identifier.name);
6810 } 6810 }
6811 return builder.toString(); 6811 return builder.toString();
6812 } 6812 }
6813 void visitChildren(ASTVisitor<Object> visitor) { 6813 void visitChildren(ASTVisitor<Object> visitor) {
6814 _components.accept(visitor); 6814 _components.accept(visitor);
6815 } 6815 }
6816 } 6816 }
6817 /** 6817 /**
6818 * Instances of the class {@code ListLiteral} represent a list literal. 6818 * Instances of the class {@code ListLiteral} represent a list literal.
6819 * <pre> 6819 * <pre>
(...skipping 4022 matching lines...) Expand 10 before | Expand all | Expand 10 after
10842 * conditions encountered during evaluation. These are documented with the stati c field that define 10842 * conditions encountered during evaluation. These are documented with the stati c field that define
10843 * those values. 10843 * those values.
10844 */ 10844 */
10845 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { 10845 class ConstantEvaluator extends GeneralizingASTVisitor<Object> {
10846 /** 10846 /**
10847 * The value returned for expressions (or non-expression nodes) that are not c ompile-time constant 10847 * The value returned for expressions (or non-expression nodes) that are not c ompile-time constant
10848 * expressions. 10848 * expressions.
10849 */ 10849 */
10850 static Object NOT_A_CONSTANT = new Object(); 10850 static Object NOT_A_CONSTANT = new Object();
10851 Object visitAdjacentStrings(AdjacentStrings node) { 10851 Object visitAdjacentStrings(AdjacentStrings node) {
10852 StringBuffer builder = new StringBuffer(); 10852 JavaStringBuilder builder = new JavaStringBuilder();
10853 for (StringLiteral string in node.strings) { 10853 for (StringLiteral string in node.strings) {
10854 Object value = string.accept(this); 10854 Object value = string.accept(this);
10855 if (identical(value, NOT_A_CONSTANT)) { 10855 if (identical(value, NOT_A_CONSTANT)) {
10856 return value; 10856 return value;
10857 } 10857 }
10858 builder.write(value); 10858 builder.append(value);
10859 } 10859 }
10860 return builder.toString(); 10860 return builder.toString();
10861 } 10861 }
10862 Object visitBinaryExpression(BinaryExpression node) { 10862 Object visitBinaryExpression(BinaryExpression node) {
10863 Object leftOperand2 = node.leftOperand.accept(this); 10863 Object leftOperand2 = node.leftOperand.accept(this);
10864 if (identical(leftOperand2, NOT_A_CONSTANT)) { 10864 if (identical(leftOperand2, NOT_A_CONSTANT)) {
10865 return leftOperand2; 10865 return leftOperand2;
10866 } 10866 }
10867 Object rightOperand2 = node.rightOperand.accept(this); 10867 Object rightOperand2 = node.rightOperand.accept(this);
10868 if (identical(rightOperand2, NOT_A_CONSTANT)) { 10868 if (identical(rightOperand2, NOT_A_CONSTANT)) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
11047 } 11047 }
11048 } 11048 }
11049 break; 11049 break;
11050 } 11050 }
11051 return NOT_A_CONSTANT; 11051 return NOT_A_CONSTANT;
11052 } 11052 }
11053 Object visitPropertyAccess(PropertyAccess node) => getConstantValue(null); 11053 Object visitPropertyAccess(PropertyAccess node) => getConstantValue(null);
11054 Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null); 11054 Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null);
11055 Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value; 11055 Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value;
11056 Object visitStringInterpolation(StringInterpolation node) { 11056 Object visitStringInterpolation(StringInterpolation node) {
11057 StringBuffer builder = new StringBuffer(); 11057 JavaStringBuilder builder = new JavaStringBuilder();
11058 for (InterpolationElement element in node.elements) { 11058 for (InterpolationElement element in node.elements) {
11059 Object value = element.accept(this); 11059 Object value = element.accept(this);
11060 if (identical(value, NOT_A_CONSTANT)) { 11060 if (identical(value, NOT_A_CONSTANT)) {
11061 return value; 11061 return value;
11062 } 11062 }
11063 builder.write(value); 11063 builder.append(value);
11064 } 11064 }
11065 return builder.toString(); 11065 return builder.toString();
11066 } 11066 }
11067 /** 11067 /**
11068 * Return the constant value of the static constant represented by the given e lement. 11068 * Return the constant value of the static constant represented by the given e lement.
11069 * @param element the element whose value is to be returned 11069 * @param element the element whose value is to be returned
11070 * @return the constant value of the static constant 11070 * @return the constant value of the static constant
11071 */ 11071 */
11072 Object getConstantValue(Element element) { 11072 Object getConstantValue(Element element) {
11073 if (element is FieldElement) { 11073 if (element is FieldElement) {
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
12721 return elements[elements.length - 1].endToken; 12721 return elements[elements.length - 1].endToken;
12722 } 12722 }
12723 /** 12723 /**
12724 * Return the node that is the parent of each of the elements in the list. 12724 * Return the node that is the parent of each of the elements in the list.
12725 * @return the node that is the parent of each of the elements in the list 12725 * @return the node that is the parent of each of the elements in the list
12726 */ 12726 */
12727 ASTNode getOwner() { 12727 ASTNode getOwner() {
12728 return owner; 12728 return owner;
12729 } 12729 }
12730 } 12730 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698