Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
This repository was 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

@PlNG

Description

@PlNG

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.

Metadata

Metadata

Assignees

No one assigned

    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