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

Unified Diff: pkg/analyzer/lib/src/generated/ast.dart

Issue 680863002: Remove JavaStringBuilder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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/lib/src/generated/constant.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/ast.dart
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart
index bb44db5d5b3ccdd49d072ada95d431440bd68955..89ac67d8336d2832a39b8c86da584e406dd72a7c 100644
--- a/pkg/analyzer/lib/src/generated/ast.dart
+++ b/pkg/analyzer/lib/src/generated/ast.dart
@@ -69,9 +69,9 @@ class AdjacentStrings extends StringLiteral {
}
@override
- void appendStringValue(JavaStringBuilder builder) {
+ void appendStringValue(StringBuffer buffer) {
for (StringLiteral stringLiteral in strings) {
- stringLiteral.appendStringValue(builder);
+ stringLiteral.appendStringValue(buffer);
}
}
}
@@ -4526,15 +4526,15 @@ class ConstantEvaluator extends GeneralizingAstVisitor<Object> {
@override
Object visitAdjacentStrings(AdjacentStrings node) {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (StringLiteral string in node.strings) {
Object value = string.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
return value;
}
- builder.append(value);
+ buffer.write(value);
}
- return builder.toString();
+ return buffer.toString();
}
@override
@@ -4797,28 +4797,28 @@ class ConstantEvaluator extends GeneralizingAstVisitor<Object> {
@override
Object visitStringInterpolation(StringInterpolation node) {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (InterpolationElement element in node.elements) {
Object value = element.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
return value;
}
- builder.append(value);
+ buffer.write(value);
}
- return builder.toString();
+ return buffer.toString();
}
@override
Object visitSymbolLiteral(SymbolLiteral node) {
// TODO(brianwilkerson) This isn't optimal because a Symbol is not a String.
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (Token component in node.components) {
- if (builder.length > 0) {
- builder.appendChar(0x2E);
+ if (buffer.length > 0) {
+ buffer.writeCharCode(0x2E);
scheglov 2014/10/26 19:13:53 buffer.write('.') here and everywhere else?
Brian Wilkerson 2014/10/26 20:16:36 As long as there isn't a performance penalty, then
}
- builder.append(component.lexeme);
+ buffer.write(component.lexeme);
}
- return builder.toString();
+ return buffer.toString();
}
/**
@@ -10825,17 +10825,17 @@ class LibraryIdentifier extends Identifier {
@override
String get name {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
bool needsPeriod = false;
for (SimpleIdentifier identifier in _components) {
if (needsPeriod) {
- builder.append(".");
+ buffer.write(".");
} else {
needsPeriod = true;
}
- builder.append(identifier.name);
+ buffer.write(identifier.name);
}
- return builder.toString();
+ return buffer.toString();
}
@override
@@ -16104,8 +16104,8 @@ class SimpleStringLiteral extends SingleStringLiteral {
}
@override
- void appendStringValue(JavaStringBuilder builder) {
- builder.append(value);
+ void appendStringValue(StringBuffer buffer) {
+ buffer.write(value);
}
}
@@ -16181,7 +16181,7 @@ class StringInterpolation extends SingleStringLiteral {
}
@override
- void appendStringValue(JavaStringBuilder builder) {
+ void appendStringValue(StringBuffer buffer) {
throw new IllegalArgumentException();
}
@@ -16232,29 +16232,25 @@ class StringInterpolation extends SingleStringLiteral {
*/
abstract class StringLiteral extends Literal {
/**
- * Return the value of the string literal, or `null` if the string is not a constant string
- * without any string interpolation.
- *
- * @return the value of the string literal
+ * Return the value of the string literal, or `null` if the string is not a
+ * constant string without any string interpolation.
*/
String get stringValue {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
try {
- appendStringValue(builder);
+ appendStringValue(buffer);
} on IllegalArgumentException catch (exception) {
return null;
}
- return builder.toString();
+ return buffer.toString();
}
/**
- * Append the value of the given string literal to the given string builder.
- *
- * @param builder the builder to which the string's value is to be appended
- * @throws IllegalArgumentException if the string is not a constant string without any string
- * interpolation
+ * Append the value of this string literal to the given [buffer]. Throw an
+ * [IllegalArgumentException] if the string is not a constant string without
+ * any string interpolation.
*/
- void appendStringValue(JavaStringBuilder builder);
+ void appendStringValue(StringBuffer buffer);
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/constant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698