Class: Idl::PcAssignmentAst
- Inherits:
-
AstNode
- Object
- AstNode
- Idl::PcAssignmentAst
show all
- Includes:
- Executable
- Defined in:
- lib/idlc/ast.rb,
lib/idlc/passes/prune.rb,
lib/idlc/passes/gen_adoc.rb
Constant Summary
Constants inherited
from AstNode
AstNode::Bits1Type, AstNode::Bits32Type, AstNode::Bits64Type, AstNode::BoolType, AstNode::ConstBoolType, AstNode::PossiblyUnknownBits1Type, AstNode::PossiblyUnknownBits32Type, AstNode::PossiblyUnknownBits64Type, AstNode::ReachableFunctionCacheType, AstNode::StringType, AstNode::VoidType
Instance Attribute Summary
Attributes inherited from AstNode
#children, #input, #interval, #parent
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Executable
#executable?
Methods inherited from AstNode
#always_terminates?, #declaration?, #executable?, extract_base_var_name, #find_ancestor, #find_dst_registers, #find_referenced_csrs, #find_src_registers, #freeze_tree, #gen_option_adoc, #input_file, input_from_source_yaml, #inspect, #internal_error, interval_from_source_yaml, #lineno, #lines_around, #nullify_assignments, #pass_find_return_values, #path, #print_ast, #reachable_exceptions, #reachable_functions, #set_input_file, #set_input_file_unless_already_set, #source_line_file_offsets, #source_starting_offset, #source_yaml, #starting_line, #text_value, #truncation_warn, #type_error, #unindent, value_else, #value_else, value_error, #value_error, value_try, #value_try, write_back_nested
Constructor Details
#initialize(input, interval, rval) ⇒ PcAssignmentAst
Returns a new instance of PcAssignmentAst.
2774
2775
2776
|
# File 'lib/idlc/ast.rb', line 2774
def initialize(input, interval, rval)
super(input, interval, [rval])
end
|
Class Method Details
.from_h(yaml, source_mapper) ⇒ Object
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
|
# File 'lib/idlc/ast.rb', line 2800
def self.from_h(yaml, source_mapper)
raise "Bad YAML" unless yaml.key?("kind") && yaml.fetch("kind") == "pc_assignment"
input = input_from_source_yaml(yaml.fetch("source"), source_mapper)
interval = interval_from_source_yaml(yaml.fetch("source"))
PcAssignmentAst.new(
input, interval,
T.cast(AstNode.from_h(yaml.fetch("value"), source_mapper), RvalueAst)
)
end
|
Instance Method Details
#const_eval?(symtab) ⇒ Boolean
2767
|
# File 'lib/idlc/ast.rb', line 2767
def const_eval?(symtab) = false
|
#execute(symtab) ⇒ Object
2780
|
# File 'lib/idlc/ast.rb', line 2780
def execute(symtab) = value_error "$pc is never statically known"
|
#gen_adoc(indent = 0, indent_spaces: 2) ⇒ Object
252
253
254
|
# File 'lib/idlc/passes/gen_adoc.rb', line 252
def gen_adoc(indent = 0, indent_spaces: 2)
"#{' ' * indent}$pc = #{rhs.gen_adoc(0, indent_spaces:)}"
end
|
#prune(symtab, forced_type: nil) ⇒ Object
983
984
985
|
# File 'lib/idlc/passes/prune.rb', line 983
def prune(symtab, forced_type: nil)
PcAssignmentAst.new(input, interval, rhs.prune(symtab))
end
|
#rhs ⇒ Object
2771
|
# File 'lib/idlc/ast.rb', line 2771
def rhs = T.cast(children.fetch(0), RvalueAst)
|
#to_h ⇒ Object
2793
2794
2795
2796
2797
|
# File 'lib/idlc/ast.rb', line 2793
def to_h = {
"kind" => "pc_assignment",
"value" => rhs.to_h,
"source" => source_yaml
}
|
#to_idl ⇒ Object
2790
|
# File 'lib/idlc/ast.rb', line 2790
def to_idl = "$pc = #{rhs.to_idl}"
|
#type_check(symtab, strict:) ⇒ Object
2784
2785
2786
|
# File 'lib/idlc/ast.rb', line 2784
def type_check(symtab, strict:)
rhs.type_check(symtab, strict:)
end
|