org.jrubyparser.util
Class StaticAnalyzerHelper
java.lang.Object
org.jrubyparser.util.StaticAnalyzerHelper
public class StaticAnalyzerHelper
- extends Object
Separate logic from AST for calculating static relationships in Ruby.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StaticAnalyzerHelper
public StaticAnalyzerHelper()
calculateStaticAssignments
public static List<NodePair> calculateStaticAssignments(MultipleAsgnNode masgn,
Node values)
flattenRHSValues
public static Node[] flattenRHSValues(Node rhs)
- There are four possible conditions:
1. rhs: [b, c] - ListNode
2. rhs: [*b, c] - ArgsPush(b, c)
3. rhs: [c, *b] - ArgsCat(c, b)
4. rhs: [c, *b, d] - ArgsPush(ArgsCat(c, b), d)
For cases 2 and 3 we can additionally return the rhs splat as a single value if
the argscat or argspush will end up completely being assigned into a rest of the lhs.
These four cases can have any number of pre or post nodes (these examples only use one
for simplicity). This method really just flattens the tree into pre, rest, and post.
Now in actuality these three values will not neccesarily fit into the lhs in the same
fashion.
Copyright © 2013. All Rights Reserved.