Skip to content

Commit

Permalink
Detect server-side CAST in variable tokenizer. (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Oct 13, 2023
1 parent 4b02470 commit 2199f15
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions lib/src/v3/variable_tokenizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,21 +304,33 @@ class VariableTokenizer {

while (!_isAtEnd) {
final nextChar = _peek();
if (isReadingName && _canAppearInVariable(nextChar)) {
nameBuffer.writeCharCode(nextChar);
_advance();
continue;
}
if (isReadingName && nextChar != $colon) {
break;
}
if (isReadingName) {
assert(nextChar == $colon);
// part of name
if (_canAppearInVariable(nextChar)) {
nameBuffer.writeCharCode(nextChar);
_advance();
continue;
}

// next non-name character is not a colon
if (nextChar != $colon) {
break;
}

// we have double colons (server-side CAST)
if (_index + 1 < _codeUnits.length &&
_codeUnits[_index + 1] == $colon) {
break;
}

// switching to reading the type
_advance();
consumedColonForType = true;
isReadingName = false;
continue;
}

// reading the type
if (_canAppearInVariable(nextChar)) {
typeBuffer.writeCharCode(nextChar);
_advance();
Expand Down

0 comments on commit 2199f15

Please sign in to comment.