wcandillon / jsoniq

JSONiq Implementation that compiles to JavaScript
Apache License 2.0
65 stars 7 forks source link

Group by queries fails #69

Open jonathanhuet opened 7 years ago

jonathanhuet commented 7 years ago

Hi,

I'm implementing JSONiq queries with group by clause and the compilation fails. I have searched for a simple query with group by and found your test_reserved_keywords.jq test but the result stills the same:

/source/lib/compiler/Translator.ts:102
        this.sctx.getParent().addVarRefs(this.sctx.getUnusedVarRefs());
                             ^
TypeError: Cannot read property 'addVarRefs' of null
    at Translator.popCtx (/source/lib/compiler/Translator.ts:102:30)
    at Translator.FLWORExpr (/source/lib/compiler/Translator.ts:163:18)
    at Translator.visit (/source/lib/compiler/Translator.ts:460:30)
    at node.getChildren.forEach.child (/source/lib/compiler/Translator.ts:471:18)
    at Array.forEach (native)
    at Translator.visitChildren (/source/lib/compiler/Translator.ts:470:28)
    at Translator.visit (/source/lib/compiler/Translator.ts:464:18)
    at node.getChildren.forEach.child (/source/lib/compiler/Translator.ts:471:18)
    at Array.forEach (native)
    at Translator.visitChildren (/source/lib/compiler/Translator.ts:470:28)` 

How to reproduce

  1. Create a file jsoniq.jq with test_reserved_keywords.jq
  2. Execute jsoniq compile jsoniq.jq
  3. Above error is shown

Note: run and plan commands also fails, but not ast

Expected results

The creation of the jsoniq.js file.

Can you help please?