GithubHelp home page GithubHelp logo

Comments (6)

edubkendo avatar edubkendo commented on August 16, 2024

This might be a place where pulling in functionality from rsense will help. In order to do its type inference work, rsense tracks scope, context and , of course, type, in a sort of shadow-grid alongside the AST it gets from jruby-parser. If we bring this into jruby-parser, and make the AST aware of the additional information, it seems like it ought to be easy enough to create an API for passing in a scope... I have only thought about doing this in a pretty abstract way so far, but I was reading this paper , which was an inspiration for rsense, which seems to suggest some possibilities.

from jruby-parser.

chrisseaton avatar chrisseaton commented on August 16, 2024

jruby-parser already has everything it needs to track the local variables, as it does it fine for variables it can see being assigned, so we shouldn't need any new functionality or data structures. All we need is an API to pass in an initial set of local variables.

Everything we need is here: https://github.com/jruby/jruby-parser/blob/master/src/org/jrubyparser/StaticScope.java. we just need to be able to pass one of these in at the start of parsing.

from jruby-parser.

enebo avatar enebo commented on August 16, 2024

For satisying this bug it is true we only need to add staticscope, but Eric is also looking at adding similar functionality to what rsense has to jruby-parser, so he has an eye towards a bigger fish. I suspect adding staticscope will be compatible with the work he is doing so we can add all this stuff piecemeal.

from jruby-parser.

edubkendo avatar edubkendo commented on August 16, 2024

yeah sorry, that probably seemed really random...

from jruby-parser.

enebo avatar enebo commented on August 16, 2024

Fixed in commit 60730a2. @chrisseaton you can look at spec/helpers/parser_helpers.rb to see how I set up local scope. You will need to work back to Java syntax but I don't think that is so difficult. Secondly, I test this from spec/jruby-parser/parse_spec.rb.

@edubkendo I believe rsense must use dynamicscope and not staticscope since that is what mainline jruby uses. This may complicate things a little for rsense if they are using dynamicscope to hold live values (dynamic scope is the value and static scope is the name). If so then we will need to talk about how to address that. I personally think static scope fits better since this is not a live runtime.

from jruby-parser.

edubkendo avatar edubkendo commented on August 16, 2024

@enebo well, it actually tracks both, in a hashmap: https://github.com/edubkendo/rsense/blob/master/src/org/cx4a/rsense/ruby/LocalScope.java and then there is a class extending LocalScope, called DynamicScope which is focused on testing equality. Most usages within rsense are of LocalScope, with the DynamicScope class being used in one method. I would have to look more closely to see how its using the values it stores, but I'm sure we can find a way around it.

from jruby-parser.

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.