Class: Idl::TrueExpressionAst

Inherits:
AstNode
  • Object
show all
Includes:
Rvalue
Defined in:
lib/idlc/ast.rb,
lib/idlc/passes/gen_adoc.rb,
lib/idlc/passes/gen_option_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 Rvalue

#max_value, #min_value, #truncate, #values

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, #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, #prune, #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) ⇒ TrueExpressionAst

Returns a new instance of TrueExpressionAst.



985
986
987
# File 'lib/idlc/ast.rb', line 985

def initialize(input, interval)
  super(input, interval, [])
end

Class Method Details

.from_h(yaml, source_mapper) ⇒ Object



1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
# File 'lib/idlc/ast.rb', line 1011

def self.from_h(yaml, source_mapper)
  raise "bad yaml" unless yaml.key?("kind") && yaml.fetch("kind") == "true"

  input = input_from_source_yaml(yaml.fetch("source"), source_mapper)
  interval = interval_from_source_yaml(yaml.fetch("source"))
  if input.nil?
    TrueExpressionAst.new("true", 0..3)
  else
    TrueExpressionAst.new(input, T.must(interval))
  end
end

Instance Method Details

#const_eval?(symtab) ⇒ Boolean

Returns:

  • (Boolean)


990
# File 'lib/idlc/ast.rb', line 990

def const_eval?(symtab) = true

#gen_adoc(indent = 0, indent_spaces: 2) ⇒ Object



153
154
155
# File 'lib/idlc/passes/gen_adoc.rb', line 153

def gen_adoc(indent = 0, indent_spaces: 2)
  "#{' ' * indent}true"
end

#gen_option_adocObject



89
# File 'lib/idlc/passes/gen_option_adoc.rb', line 89

def gen_option_adoc = "true"

#to_hObject



1005
1006
1007
1008
# File 'lib/idlc/ast.rb', line 1005

def to_h = {
  "kind" => "true",
  "source" => source_yaml
}

#to_idlObject



1002
# File 'lib/idlc/ast.rb', line 1002

def to_idl = "true"

#type(symtab) ⇒ Object



996
# File 'lib/idlc/ast.rb', line 996

def type(symtab) = BoolType

#type_check(symtab, strict:) ⇒ Object



993
# File 'lib/idlc/ast.rb', line 993

def type_check(symtab, strict:); end

#value(symtab) ⇒ Object



999
# File 'lib/idlc/ast.rb', line 999

def value(symtab) = true