Class: Yoda::Typing::NodeInfo
- Inherits:
-
Object
- Object
- Yoda::Typing::NodeInfo
- Extended by:
- Forwardable
- Defined in:
- lib/yoda/typing/node_info.rb
Overview
Facade for information of the specified node traced on inference
Instance Attribute Summary collapse
- #node ⇒ AST::Node readonly
- #tracer ⇒ Inferencer::Tracer readonly
Instance Method Summary collapse
- #constants ⇒ Array<Store::Objects::Base>
-
#initialize(node:, tracer:) ⇒ NodeInfo
constructor
A new instance of NodeInfo.
- #kind ⇒ Symbol
- #lexical_scope_types ⇒ Array<Store::Objects::NamespaceObject>
- #method_candidates ⇒ Array<FunctionSignatures::Base>
- #objects ⇒ Array<Store::Objects::Base>
- #receiver_type ⇒ Types::Type
- #require_paths ⇒ Array<String>
- #resolve_constant(path_expr) ⇒ Types::Type?
- #scope_objects ⇒ Array<Store::Objects::Base>
- #type ⇒ Types::Type
Constructor Details
#initialize(node:, tracer:) ⇒ NodeInfo
Returns a new instance of NodeInfo.
19 20 21 22 |
# File 'lib/yoda/typing/node_info.rb', line 19 def initialize(node:, tracer:) @node = node @tracer = tracer end |
Instance Attribute Details
#node ⇒ AST::Node (readonly)
10 11 12 |
# File 'lib/yoda/typing/node_info.rb', line 10 def node @node end |
#tracer ⇒ Inferencer::Tracer (readonly)
13 14 15 |
# File 'lib/yoda/typing/node_info.rb', line 13 def tracer @tracer end |
Instance Method Details
#constants ⇒ Array<Store::Objects::Base>
40 41 42 |
# File 'lib/yoda/typing/node_info.rb', line 40 def constants tracer.constants(node) end |
#kind ⇒ Symbol
25 26 27 |
# File 'lib/yoda/typing/node_info.rb', line 25 def kind tracer.kind(node) || node.type end |
#lexical_scope_types ⇒ Array<Store::Objects::NamespaceObject>
65 66 67 |
# File 'lib/yoda/typing/node_info.rb', line 65 def lexical_scope_types context&.lexical_scope_types || [] end |
#method_candidates ⇒ Array<FunctionSignatures::Base>
35 36 37 |
# File 'lib/yoda/typing/node_info.rb', line 35 def method_candidates tracer.method_candidates(node) end |
#objects ⇒ Array<Store::Objects::Base>
55 56 57 |
# File 'lib/yoda/typing/node_info.rb', line 55 def objects tracer.objects(node) end |
#receiver_type ⇒ Types::Type
30 31 32 |
# File 'lib/yoda/typing/node_info.rb', line 30 def receiver_type tracer.receiver_type(node) end |
#require_paths ⇒ Array<String>
45 46 47 |
# File 'lib/yoda/typing/node_info.rb', line 45 def require_paths tracer.require_paths(node) end |
#resolve_constant(path_expr) ⇒ Types::Type?
71 72 73 |
# File 'lib/yoda/typing/node_info.rb', line 71 def resolve_constant(path_expr) context&.constant_resolver&.resolve_path(path_expr.to_s) end |
#scope_objects ⇒ Array<Store::Objects::Base>
60 61 62 |
# File 'lib/yoda/typing/node_info.rb', line 60 def scope_objects tracer.objects(node) end |
#type ⇒ Types::Type
50 51 52 |
# File 'lib/yoda/typing/node_info.rb', line 50 def type tracer.type(node) end |