Module: Yoda::Typing::Tree
- Defined in:
- lib/yoda/typing/tree.rb,
lib/yoda/typing/tree/if.rb,
lib/yoda/typing/tree/for.rb,
lib/yoda/typing/tree/base.rb,
lib/yoda/typing/tree/case.rb,
lib/yoda/typing/tree/self.rb,
lib/yoda/typing/tree/send.rb,
lib/yoda/typing/tree/begin.rb,
lib/yoda/typing/tree/block.rb,
lib/yoda/typing/tree/const.rb,
lib/yoda/typing/tree/super.rb,
lib/yoda/typing/tree/while.rb,
lib/yoda/typing/tree/yield.rb,
lib/yoda/typing/tree/escape.rb,
lib/yoda/typing/tree/method.rb,
lib/yoda/typing/tree/defined.rb,
lib/yoda/typing/tree/literal.rb,
lib/yoda/typing/tree/variable.rb,
lib/yoda/typing/tree/hash_body.rb,
lib/yoda/typing/tree/class_tree.rb,
lib/yoda/typing/tree/module_tree.rb,
lib/yoda/typing/tree/rescue_body.rb,
lib/yoda/typing/tree/logical_operator.rb,
lib/yoda/typing/tree/singleton_method.rb,
lib/yoda/typing/tree/logical_assignment.rb,
lib/yoda/typing/tree/constant_assignment.rb,
lib/yoda/typing/tree/multiple_assignment.rb,
lib/yoda/typing/tree/variable_assignment.rb,
lib/yoda/typing/tree/literal_with_interpolation.rb
Defined Under Namespace
Classes: Base, Begin, Block, Case, ClassTree, Const, ConstantAssignment, Escape, For, HashBody, If, Literal, LiteralWithInterpolation, LogicalAssignment, LogicalOperator, Method, ModuleTree, MultipleAssignment, RescueBody, Self, Send, SingletonMethod, Super, Variable, VariableAssignment, While, Yield
Class Method Summary
collapse
Class Method Details
.build(node, **kwargs) ⇒ Base
16
17
18
|
# File 'lib/yoda/typing/tree.rb', line 16
def build(node, **kwargs)
klass_for_node(node).new(node: node, **kwargs)
end
|
.klass_for_node(node) ⇒ class<Base>
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/yoda/typing/tree.rb', line 22
def klass_for_node(node)
case node.type
when :lvasgn, :ivasgn, :cvasgn, :gvasgn
VariableAssignment
when :casgn
ConstantAssignment
when :masgn
MultipleAssignment
when :op_asgn, :or_asgn, :and_asgn
LogicalAssignment
when :and, :or, :not
LogicalOperator
when :if
If
when :while, :until, :while_post, :until_post
While
when :for
For
when :case
Case
when :super, :zsuper
Super
when :yield
Yield
when :return, :break, :next
Escape
when :resbody
RescueBody
when :csend, :send
Send
when :block
Block
when :const
Const
when :lvar, :cvar, :ivar, :gvar
Variable
when :begin, :kwbegin
Begin
when :dstr, :dsym, :xstr
LiteralWithInterpolation
when :def
Method
when :defs
SingletonMethod
when :hash
HashBody
when :self
Self
when :defined
Defined
when :module
ModuleTree
when :class
ClassTree
else
Literal
end
end
|