adobe / htlengine

An HTL (Sightly) Interpreter/Compiler for Node.js
Apache License 2.0
47 stars 20 forks source link

Error in generated JS from compiler #287

Closed benoit-adobe closed 3 years ago

benoit-adobe commented 3 years ago

Since the last update, with most of the WCM Core Components and the default data, an error occured, similar to all components erroring.

For instance for the breadcrumb component:

ReferenceError: Cannot access 'breadcrumb' before initialization
    at eval (eval at compileToFunction (/Users/benoit/Desktop/projects/practice/aem-styleguide/tests/htl-engine-latest/node_modules/@adobe/htlengine/src/compiler/Compiler.js:281:22), <anonymous>:108:31)
    at Generator.next (<anonymous>)
    at Runtime.run (/Users/benoit/Desktop/projects/practice/aem-styleguide/tests/htl-engine-latest/node_modules/@adobe/htlengine/src/runtime/Runtime.js:86:17)

Part of the generated JS for it would be:

...
module.exports = function main($) {
    ...
    return $.run(function* () {
        let $t, $n = $.dom.start();
        $.dom.text($n,"\n");
        const var_testVariable0 = (breadcrumb["items"]["size"]) > (0);
        const breadcrumb = yield $.use($use_0, {});
        ...
};

The error comes from the line const var_testVariable0 = (breadcrumb["items"]["size"]) > (0); that uses the constant breadcrumb right before it is instantiated.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 6.2.14 :tada:

The release is available on:

Your semantic-release bot :package::rocket: