On 09 Jan 2014, at 01:57, Nicolas Passerini <npasserini@gmail.com> wrote:
I am looking at the AST of a method like this:
someMethod ^ SomeClass new
It was a surprise to me that the note for 'SomeClass' is an RBVariableNode instead of a RBClassReference. Which is the best way to tell if an RBVariableNode represents a global reference or an instance variable?
Yes, is is a known bug. Camillo added that the Parser already specialises variables, but in the end, the code is quite complex *and* it mixes grammar related things with semantics. So the idea is to move that into the sen check phase. (the complexity shows by the fact that we just could not fix the bug⦠there is a reason why one should not mix pure syntax with semantics concerns)
On the other hand, there are no references to RBClassReference, so this might be a bug?
No, all the specialised variable nodes are right now not used. What Opal does is to do the analysis in a second phase and to *annotate* all vars with âsemanticâ variable descriptors. So the right way to check for globals is to use isGlobal which does "^self binding isGlobalâ⦠You need to make sure to do semantic analysis on the AST before calling, see #doSemanticAnalysis in RBMethodNode. I really should clean it up.. this is more hurting than helping now. Marcus