mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-29 15:15:23 -07:00
* fix: more flexible squared property read expression, fixes #643 * fix: unecessary error wrapping in browser bundles * style: update code style and types * perf: use token.value when evalToken
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
import { Token } from './token'
|
||||
import { LiteralToken } from './literal-token'
|
||||
import { ValueToken } from './value-token'
|
||||
import { IdentifierToken } from './identifier-token'
|
||||
import { NumberToken } from './number-token'
|
||||
import { RangeToken } from './range-token'
|
||||
import { QuotedToken } from './quoted-token'
|
||||
import { TokenKind, parseStringLiteral } from '../parser'
|
||||
import { TokenKind } from '../parser'
|
||||
|
||||
export class PropertyAccessToken extends Token {
|
||||
public propertyName: string
|
||||
constructor (
|
||||
public variable: IdentifierToken | QuotedToken,
|
||||
public props: (IdentifierToken | QuotedToken | PropertyAccessToken)[],
|
||||
end: number
|
||||
public variable: QuotedToken | RangeToken | LiteralToken | NumberToken | undefined,
|
||||
public props: (ValueToken | IdentifierToken)[],
|
||||
input: string,
|
||||
begin: number,
|
||||
end: number,
|
||||
file?: string
|
||||
) {
|
||||
super(TokenKind.PropertyAccess, variable.input, variable.begin, end, variable.file)
|
||||
this.propertyName = this.variable instanceof IdentifierToken
|
||||
? this.variable.getText()
|
||||
: parseStringLiteral(this.variable.getText())
|
||||
super(TokenKind.PropertyAccess, input, begin, end, file)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user