Code Monkey home page Code Monkey logo

Comments (5)

benjamn avatar benjamn commented on May 14, 2024

Are you parsing with require("esprima").parse(source, { loc: true }) or require("recast").parse(source) or something else?

from ast-types.

jlongster avatar jlongster commented on May 14, 2024

I'm actually just hacking regenerator and haven't touched this file: https://github.com/facebook/regenerator/blob/master/main.js#L59

Strangely, I don't see loc anywhere in the recastOptions, and I added it but it doesn't seem to have any effect. I'll look at the options more though.

from ast-types.

benjamn avatar benjamn commented on May 14, 2024

Yeah, recast.parse calls esprima.parse with a hard-coded set of options (including loc:true) that don't depend on the options you pass to recast.parse: https://github.com/benjamn/recast/blob/1ddd828daa/lib/parser.js#L19-L22. Feel free to send pull requests for changes to that file.

from ast-types.

jlongster avatar jlongster commented on May 14, 2024

So it should be passing loc: true? Is this a valid bug then?

from ast-types.

jlongster avatar jlongster commented on May 14, 2024

If I print the whole AST before the transform call in visit.js, it does have the source location so I'm just doing something wrong. I'll into this more soon.

from ast-types.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.