Class: Wool::SexpAnalysis::ScopeAnnotation::Annotator

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/wool/analysis/annotations/scope_annotation.rb

Overview

This is the annotator for the parent annotation.

Instance Method Summary collapse

Methods included from Visitor

#method_missing, #visit

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Wool::SexpAnalysis::Visitor

Instance Method Details

#annotate!(root) ⇒ Object



14
15
16
17
# File 'lib/wool/analysis/annotations/scope_annotation.rb', line 14

def annotate!(root)
  @current_scope = Scope::GlobalScope
  visit(root)
end

#default_visit(node) ⇒ Object

Replaces the general node visit method with one that assigns the current scope to the visited node.



21
22
23
# File 'lib/wool/analysis/annotations/scope_annotation.rb', line 21

def default_visit(node)
  node.scope = @current_scope
end

#visit_class(node) ⇒ Object



29
30
31
32
# File 'lib/wool/analysis/annotations/scope_annotation.rb', line 29

def visit_class(node)
  path_to_new_class, superclass, body = node.children
  superclass = superclass ? superclass.eval_as_constant(@current_scope) : ClassRegistry['Object']
end

#visit_module(node) ⇒ Object



25
26
27
# File 'lib/wool/analysis/annotations/scope_annotation.rb', line 25

def visit_module(node)
  path_node, body = node.children
end