| Index: pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| index f4de827c7fa5399a8d90e8207653e0b2503b8d77..e1dd5f4d2eab75789939f0072a15dbe7e28f65c1 100644
|
| --- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| +++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
|
| @@ -241,7 +241,7 @@ abstract class AbstractScanner implements Scanner {
|
| if (($A <= next && next <= $Z) ||
|
| identical(next, $_) ||
|
| identical(next, $$)) {
|
| - return tokenizeIdentifier(next, scanOffset, true);
|
| + return tokenizeKeywordOrIdentifier(next, true);
|
| }
|
|
|
| if (identical(next, $LT)) {
|
| @@ -808,6 +808,16 @@ abstract class AbstractScanner implements Scanner {
|
| int tokenizeKeywordOrIdentifier(int next, bool allowDollar) {
|
| KeywordState state = KeywordState.KEYWORD_STATE;
|
| int start = scanOffset;
|
| + // We allow a leading capital character.
|
| + if ($A <= next && next <= $Z) {
|
| + state = state.nextCapital(next);
|
| + next = advance();
|
| + } else if ($a <= next && next <= $z){
|
| + // Do the first next call outside the loop to avoid an additional test
|
| + // and to make the loop monomorphic.
|
| + state = state.next(next);
|
| + next = advance();
|
| + }
|
| while (state != null && $a <= next && next <= $z) {
|
| state = state.next(next);
|
| next = advance();
|
| @@ -945,12 +955,11 @@ abstract class AbstractScanner implements Scanner {
|
| int tokenizeInterpolatedIdentifier(int next) {
|
| appendPrecedenceToken(STRING_INTERPOLATION_IDENTIFIER_INFO);
|
|
|
| - if ($a <= next && next <= $z) {
|
| + if ($a <= next && next <= $z ||
|
| + $A <= next && next <= $Z ||
|
| + identical(next, $_)) {
|
| beginToken(); // The identifier starts here.
|
| next = tokenizeKeywordOrIdentifier(next, false);
|
| - } else if (($A <= next && next <= $Z) || identical(next, $_)) {
|
| - beginToken(); // The identifier starts here.
|
| - next = tokenizeIdentifier(next, scanOffset, false);
|
| } else {
|
| unterminated(r'$', shouldAdvance: false);
|
| }
|
|
|