mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
perf: parse filenames in parse() insteadof render()
This commit is contained in:
@@ -5,19 +5,15 @@ import { TokenKind } from '../parser/token-kind'
|
||||
import { parseStringLiteral } from '../parser/parse-string-literal'
|
||||
|
||||
export class PropertyAccessToken extends Token {
|
||||
public propertyName: string
|
||||
constructor (
|
||||
public variable: IdentifierToken | QuotedToken,
|
||||
public props: (IdentifierToken | QuotedToken | PropertyAccessToken)[],
|
||||
end: number
|
||||
) {
|
||||
super(TokenKind.PropertyAccess, variable.input, variable.begin, end, variable.file)
|
||||
}
|
||||
|
||||
getVariableAsText () {
|
||||
if (this.variable instanceof IdentifierToken) {
|
||||
return this.variable.getText()
|
||||
} else {
|
||||
return parseStringLiteral(this.variable.getText())
|
||||
}
|
||||
this.propertyName = this.variable instanceof IdentifierToken
|
||||
? this.variable.getText()
|
||||
: parseStringLiteral(this.variable.getText())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user