Class: Dentaku::AST::Node
- Inherits:
-
Object
- Object
- Dentaku::AST::Node
show all
- Defined in:
- lib/dentaku/ast/node.rb
Direct Known Subclasses
Access, Array, Case, CaseConditional, CaseElse, CaseSwitchVariable, CaseThen, Function, Grouping, Identifier, Literal, Nil, Operation
Constant Summary
collapse
- STATIC_MODE_KEY =
reserved context key (double-underscore prefix, like
__evaluation_mode) that switches dependencies() into static mode:
guards are never evaluated and every branch is reported
"__static_dependencies".freeze
- STATIC_CONTEXT =
{ STATIC_MODE_KEY => true }.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.arity ⇒ Object
14
15
16
|
# File 'lib/dentaku/ast/node.rb', line 14
def self.arity
nil
end
|
.precedence ⇒ Object
10
11
12
|
# File 'lib/dentaku/ast/node.rb', line 10
def self.precedence
0
end
|
.resolve_class ⇒ Object
18
19
20
|
# File 'lib/dentaku/ast/node.rb', line 18
def self.resolve_class(*)
self
end
|
Instance Method Details
#dependencies(context = {}) ⇒ Object
22
23
24
|
# File 'lib/dentaku/ast/node.rb', line 22
def dependencies(context = {})
[]
end
|
#name ⇒ Object
39
40
41
|
# File 'lib/dentaku/ast/node.rb', line 39
def name
self.class.name.to_s.split("::").last.upcase
end
|
#pure? ⇒ Boolean
whether this subtree may be evaluated during dependency resolution
without running volatile user code; a property of the parsed AST,
computed once and memoized
29
30
31
32
33
|
# File 'lib/dentaku/ast/node.rb', line 29
def pure?
return @pure if defined?(@pure)
@pure = compute_pure?
end
|
#type ⇒ Object
35
36
37
|
# File 'lib/dentaku/ast/node.rb', line 35
def type
nil
end
|