Revert "refactor(compiler): share `isQuote()` via `chars.ts` (#42062)" (#43033)

This reverts commit 3d3b69ff81.

PR Close #43033
This commit is contained in:
atscott 2021-08-03 14:49:13 -07:00
parent 77731b8fe8
commit 443ece4587
3 changed files with 7 additions and 7 deletions

View File

@ -98,7 +98,3 @@ export function isNewLine(code: number): boolean {
export function isOctalDigit(code: number): boolean {
return $0 <= code && code <= $7;
}
export function isQuote(code: number): boolean {
return code === $SQ || code === $DQ || code === $BT;
}

View File

@ -436,6 +436,10 @@ function isExponentSign(code: number): boolean {
return code == chars.$MINUS || code == chars.$PLUS;
}
export function isQuote(code: number): boolean {
return code === chars.$SQ || code === chars.$DQ || code === chars.$BT;
}
function unescape(code: number): number {
switch (code) {
case chars.$n:

View File

@ -10,7 +10,7 @@ import * as chars from '../chars';
import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../ml_parser/interpolation_config';
import {AbsoluteSourceSpan, AST, AstVisitor, ASTWithSource, Binary, BindingPipe, Chain, Conditional, EmptyExpr, ExpressionBinding, FunctionCall, ImplicitReceiver, Interpolation, KeyedRead, KeyedWrite, LiteralArray, LiteralMap, LiteralMapKey, LiteralPrimitive, MethodCall, NonNullAssert, ParserError, ParseSpan, PrefixNot, PropertyRead, PropertyWrite, Quote, RecursiveAstVisitor, SafeKeyedRead, SafeMethodCall, SafePropertyRead, TemplateBinding, TemplateBindingIdentifier, ThisReceiver, Unary, VariableBinding} from './ast';
import {EOF, isIdentifier, Lexer, Token, TokenType} from './lexer';
import {EOF, isIdentifier, isQuote, Lexer, Token, TokenType} from './lexer';
export interface InterpolationPiece {
text: string;
@ -291,7 +291,7 @@ export class Parser {
if (outerQuote === char) {
outerQuote = null;
} else if (outerQuote == null && chars.isQuote(char)) {
} else if (outerQuote == null && isQuote(char)) {
outerQuote = char;
}
}
@ -355,7 +355,7 @@ export class Parser {
const char = input[i];
// Skip the characters inside quotes. Note that we only care about the outer-most
// quotes matching up and we need to account for escape characters.
if (chars.isQuote(input.charCodeAt(i)) && (currentQuote === null || currentQuote === char) &&
if (isQuote(input.charCodeAt(i)) && (currentQuote === null || currentQuote === char) &&
escapeCount % 2 === 0) {
currentQuote = currentQuote === null ? char : null;
} else if (currentQuote === null) {