Index: pkg/analyzer/lib/src/generated/parser.dart |
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart |
index 8e7bbe183cd00f3c6b07718bf878abdd9f03d63c..f72e1b189a905368e1e0e5ed84d7be2901d84080 100644 |
--- a/pkg/analyzer/lib/src/generated/parser.dart |
+++ b/pkg/analyzer/lib/src/generated/parser.dart |
@@ -96,10 +96,10 @@ Map<String, MethodTrampoline> methodTable_Parser = <String, MethodTrampoline>{ |
'parseWithClause_0': |
new MethodTrampoline(0, (Parser target) => target.parseWithClause()), |
'advance_0': new MethodTrampoline(0, (Parser target) => target._advance()), |
- 'appendScalarValue_5': new MethodTrampoline( |
+ 'appendCodePoint_5': new MethodTrampoline( |
5, |
(Parser target, arg0, arg1, arg2, arg3, arg4) => |
- target._appendScalarValue(arg0, arg1, arg2, arg3, arg4)), |
+ target._appendCodePoint(arg0, arg1, arg2, arg3, arg4)), |
'computeStringValue_3': new MethodTrampoline( |
3, |
(Parser target, arg0, arg1, arg2) => |
@@ -2076,25 +2076,24 @@ class Parser { |
} |
/** |
- * Append the character equivalent of the given [scalarValue] to the given |
+ * Append the character equivalent of the given [codePoint] to the given |
* [builder]. Use the [startIndex] and [endIndex] to report an error, and |
- * don't append anything to the builder, if the scalar value is invalid. The |
+ * don't append anything to the builder, if the code point is invalid. The |
* [escapeSequence] is the escape sequence that was parsed to produce the |
- * scalar value (used for error reporting). |
+ * code point (used for error reporting). |
*/ |
- void _appendScalarValue(StringBuffer buffer, String escapeSequence, |
- int scalarValue, int startIndex, int endIndex) { |
- if (scalarValue < 0 || |
- scalarValue > Character.MAX_CODE_POINT || |
- (scalarValue >= 0xD800 && scalarValue <= 0xDFFF)) { |
+ void _appendCodePoint(StringBuffer buffer, String source, |
+ int codePoint, int startIndex, int endIndex) { |
+ if (codePoint < 0 || codePoint > Character.MAX_CODE_POINT) { |
+ String escapeSequence = source.substring(startIndex, endIndex + 1); |
_reportErrorForCurrentToken( |
ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]); |
return; |
} |
- if (scalarValue < Character.MAX_VALUE) { |
- buffer.writeCharCode(scalarValue); |
+ if (codePoint < Character.MAX_VALUE) { |
+ buffer.writeCharCode(codePoint); |
} else { |
- buffer.write(Character.toChars(scalarValue)); |
+ buffer.write(Character.toChars(codePoint)); |
} |
} |
@@ -8093,8 +8092,7 @@ class Parser { |
// Illegal escape sequence: not enough or too many hex digits |
_reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE); |
} |
- _appendScalarValue(buffer, lexeme.substring(index, currentIndex + 1), |
- value, index, currentIndex); |
+ _appendCodePoint(buffer, lexeme, value, index, currentIndex); |
Lasse Reichstein Nielsen
2016/09/15 11:18:44
There was no need to create a new substring when y
floitsch
2016/09/15 15:09:19
Acknowledged.
|
return currentIndex + 1; |
} else { |
if (currentIndex + 3 >= length) { |
@@ -8113,9 +8111,9 @@ class Parser { |
// Illegal escape sequence: invalid hex digits |
_reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE); |
} else { |
- _appendScalarValue( |
+ _appendCodePoint( |
Lasse Reichstein Nielsen
2016/09/15 11:18:44
Retained the call to _appendCodePoint here, but it
floitsch
2016/09/15 15:09:19
Acknowledged.
|
buffer, |
- lexeme.substring(index, currentIndex + 1), |
Lasse Reichstein Nielsen
2016/09/15 11:18:43
+1 here should have been +4.
|
+ lexeme, |
(((((Character.digit(firstDigit, 16) << 4) + |
Character.digit(secondDigit, 16)) << |
4) + |