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

Unified Diff: pkg/compiler/lib/src/string_validator.dart

Issue 1859343004: dartfmt pkg/compiler (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/variable_allocator.dart ('k') | pkg/compiler/lib/src/tokens/keyword.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/string_validator.dart
diff --git a/pkg/compiler/lib/src/string_validator.dart b/pkg/compiler/lib/src/string_validator.dart
index 60f31dc623c4799d0188716080a35859205b87be..70a90b9fad1c322124e019b1b3a8d96327145375 100644
--- a/pkg/compiler/lib/src/string_validator.dart
+++ b/pkg/compiler/lib/src/string_validator.dart
@@ -19,18 +19,15 @@ class StringValidator {
StringValidator(this.reporter);
DartString validateInterpolationPart(Token token, StringQuoting quoting,
- {bool isFirst: false,
- bool isLast: false}) {
+ {bool isFirst: false, bool isLast: false}) {
String source = token.value;
int leftQuote = 0;
int rightQuote = 0;
if (isFirst) leftQuote = quoting.leftQuoteLength;
if (isLast) rightQuote = quoting.rightQuoteLength;
String content = copyWithoutQuotes(source, leftQuote, rightQuote);
- return validateString(token,
- token.charOffset + leftQuote,
- content,
- quoting);
+ return validateString(
+ token, token.charOffset + leftQuote, content, quoting);
}
static StringQuoting quotingFromString(String sourceString) {
@@ -50,7 +47,7 @@ class StringValidator {
// and end after the second quote.
if (source.moveNext() && source.current == quoteChar && source.moveNext()) {
int code = source.current;
- assert(code == quoteChar); // If not, there is a bug in the parser.
+ assert(code == quoteChar); // If not, there is a bug in the parser.
leftQuoteLength = 3;
// Check if a multiline string starts with optional whitespace followed by
@@ -109,10 +106,8 @@ class StringValidator {
* Validates the escape sequences and special characters of a string literal.
* Returns a DartString if valid, and null if not.
*/
- DartString validateString(Token token,
- int startOffset,
- String string,
- StringQuoting quoting) {
+ DartString validateString(
+ Token token, int startOffset, String string, StringQuoting quoting) {
// We need to check for invalid x and u escapes, for line
// terminators in non-multiline strings, and for invalid Unicode
// scalar values (either directly or as u-escape values). We also check
@@ -123,7 +118,7 @@ class StringValidator {
bool previousWasLeadSurrogate = false;
bool invalidUtf16 = false;
var stringIter = string.codeUnits.iterator;
- for(HasNextIterator<int> iter = new HasNextIterator(stringIter);
+ for (HasNextIterator<int> iter = new HasNextIterator(stringIter);
iter.hasNext;
length++) {
index++;
@@ -132,7 +127,7 @@ class StringValidator {
if (quoting.raw) continue;
containsEscape = true;
if (!iter.hasNext) {
- stringParseError("Incomplete escape sequence",token, index);
+ stringParseError("Incomplete escape sequence", token, index);
return null;
}
index++;
@@ -146,8 +141,8 @@ class StringValidator {
index++;
code = iter.next();
if (!isHexDigit(code)) {
- stringParseError("Invalid character in escape sequence",
- token, index);
+ stringParseError(
+ "Invalid character in escape sequence", token, index);
return null;
}
}
@@ -167,8 +162,8 @@ class StringValidator {
break;
}
if (!isHexDigit(code)) {
- stringParseError("Invalid character in escape sequence",
- token, index);
+ stringParseError(
+ "Invalid character in escape sequence", token, index);
return null;
}
count++;
@@ -177,8 +172,8 @@ class StringValidator {
if (code != $CLOSE_CURLY_BRACKET || count == 0 || count > 6) {
int errorPosition = index - count;
if (count > 6) errorPosition += 6;
- stringParseError("Invalid character in escape sequence",
- token, errorPosition);
+ stringParseError(
+ "Invalid character in escape sequence", token, errorPosition);
return null;
}
} else {
@@ -193,8 +188,8 @@ class StringValidator {
}
}
if (!isHexDigit(code)) {
- stringParseError("Invalid character in escape sequence",
- token, index);
+ stringParseError(
+ "Invalid character in escape sequence", token, index);
return null;
}
value = value * 16 + hexDigitValue(code);
« no previous file with comments | « pkg/compiler/lib/src/ssa/variable_allocator.dart ('k') | pkg/compiler/lib/src/tokens/keyword.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698