Code Monkey home page Code Monkey logo

Comments (3)

benjamn avatar benjamn commented on May 14, 2024

Ah, the problem is that .comments is a "hidden" field of the Node type, due to the true argument here:

def("Node")
    .bases("Printable")
    .field("type", isString)
    .field("comments", or(
        [def("Comment")],
        null
    ), defaults["null"], true);

I'm tempted to un-hide it, because I doubt anything would break. In order for code that previously used types.visit to be broken by this change, the visitor would have to have a visitPrintable method and also not be prepared to handle comments, which seems unlikely.

from ast-types.

benjamn avatar benjamn commented on May 14, 2024

On the other hand, maybe a safer approach would be to modify the visitor code so that it visits .comments if present, in addition to the fields given by types.getFieldNames.

from ast-types.

jamestalmage avatar jamestalmage commented on May 14, 2024

Wow, thank you!
Blown away by this api man. Seriously great.

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.