Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when using printAst and other helper methods related to parsed ASTs #9

Open
dylemma opened this issue Feb 13, 2017 · 2 comments

Comments

@dylemma
Copy link

dylemma commented Feb 13, 2017

In versions 0.9.0 and up, I can't successfully call any of the AST helper methods.

> var ast = require('lively.ast')
undefined
> ast.printAst(ast.parse("1 + 2"))
TypeError: Cannot read property 'string' of undefined
    at Object.printAst (<yadda\yadda>\node_modules\lively.ast\dist\lively.ast.js:12910:23)
    at repl:1:5
    at sigintHandlersWrap (vm.js:32:31)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInContext (vm.js:31:12)
    at REPLServer.defaultEval (repl.js:308:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:489:10)
    at emitOne (events.js:101:20)
>

The code above works fine if I use 0.8.1.

@rksm
Copy link
Member

rksm commented Feb 13, 2017

Yeah, we don't auto-load the dependencies anymore, we will probably do that in the future again.

require('lively.lang');
var ast = require('lively.ast');
ast.printAst(ast.parse("1 + 2"));

should do the job.

@dylemma
Copy link
Author

dylemma commented Feb 13, 2017

Thanks, that did the trick!
It would be helpful if that extra require call was mentioned in the readme/examples.

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

No branches or pull requests

2 participants