Skip to content

bug when expr contains Array #34

Description

@hustcc
const expr = compile("{a.type === 'dash' ? [2, 2] : [0, 0]}");
expect(expr({ type: 'line' })).toEqual([0, 0]);
expect(expr({ type: 'dash' })).toEqual([0, 0]);

Throw error:

FAIL  tests/case.test.ts > Some Integration Tests > should return valid value in lineDash
ExpressionError: Unexpected character: {
 ❯ tokenize src/tokenizer.ts:408:11
    406| 
    407|     // If we get here, we have an unexpected character
    408|     throw new ExpressionError(
       |           ^
    409|       `Unexpected character: ${input[pos]}`,
    410|       pos,
 ❯ compile src/compile.ts:19:18
 ❯ tests/case.test.ts:6:18
 ❯ node_modules/_@vitest_runner@3.2.4@@vitest/runner/dist/chunk-hooks.js:155:11

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions