Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Include function arguments in the demo as declared variables and update acorn #21

Open
PlNG opened this issue Dec 20, 2014 · 1 comment

Comments

@PlNG
Copy link

PlNG commented Dec 20, 2014

Just a tweak to the example.

ast.traverseTopDown(
    'VarDecl(x)',
    function(b) {
        declared[b.x.value] = true;
    },
    'VarDeclInit(x, _)',
    function(b) {
        declared[b.x.value] = true;
    },
    'FArg(x)',
    function(b) {
        declared[b.x.value] = true;
    },
    'Var(x)',
    function(b) {
        if (!declared[b.x.value]) {
            log("Variable " + b.x.value + " is not declared.");
        }
    }
);

And requesting that acorn be updated (with a link to the commit that you're modifying somewhere before modification to make it easier to track down just what changes you're doing for future updates). Acorn now handles ECMA 3-6 where 0.4.1 didn't.

Great program, looking forward to working on it.

@lennartcl
Copy link
Contributor

Thanks for the feedback @PlNG. We are working on integrating a newer Acorn. Feel free to file a pull request with demo improvements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants