Class: CodeTools::AST::Container
- Inherits:
-
ClosedScope
- Object
- Node
- ClosedScope
- CodeTools::AST::Container
- Defined in:
- lib/rubinius/ast/definitions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pre_exe ⇒ Object
Returns the value of attribute pre_exe.
-
#variable_scope ⇒ Object
Returns the value of attribute variable_scope.
Attributes inherited from ClosedScope
Attributes inherited from Node
Instance Method Summary collapse
- #container_bytecode(g) ⇒ Object
-
#initialize(body) ⇒ Container
constructor
A new instance of Container.
- #pop_state(g) ⇒ Object
- #push_state(g) ⇒ Object
- #to_sexp ⇒ Object
Methods inherited from ClosedScope
#assign_local_reference, #attach_and_call, #module?, #nest_scope, #new_local, #new_nested_local, #search_local
Methods inherited from Node
#ascii_graph, #attributes, #bytecode, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(body) ⇒ Container
Returns a new instance of Container.
1086 1087 1088 1089 |
# File 'lib/rubinius/ast/definitions.rb', line 1086 def initialize(body) @body = body || NilLiteral.new(1) @pre_exe = [] end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
1084 1085 1086 |
# File 'lib/rubinius/ast/definitions.rb', line 1084 def file @file end |
#name ⇒ Object
Returns the value of attribute name.
1084 1085 1086 |
# File 'lib/rubinius/ast/definitions.rb', line 1084 def name @name end |
#pre_exe ⇒ Object
Returns the value of attribute pre_exe.
1084 1085 1086 |
# File 'lib/rubinius/ast/definitions.rb', line 1084 def pre_exe @pre_exe end |
#variable_scope ⇒ Object
Returns the value of attribute variable_scope.
1084 1085 1086 |
# File 'lib/rubinius/ast/definitions.rb', line 1084 def variable_scope @variable_scope end |
Instance Method Details
#container_bytecode(g) ⇒ Object
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 |
# File 'lib/rubinius/ast/definitions.rb', line 1099 def container_bytecode(g) g.name = @name g.file = @file.to_sym push_state(g) @pre_exe.each { |pe| pe.pre_bytecode(g) } yield if block_given? pop_state(g) g.local_count = local_count g.local_names = local_names end |
#pop_state(g) ⇒ Object
1095 1096 1097 |
# File 'lib/rubinius/ast/definitions.rb', line 1095 def pop_state(g) g.pop_state end |
#push_state(g) ⇒ Object
1091 1092 1093 |
# File 'lib/rubinius/ast/definitions.rb', line 1091 def push_state(g) g.push_state self end |
#to_sexp ⇒ Object
1113 1114 1115 1116 1117 1118 |
# File 'lib/rubinius/ast/definitions.rb', line 1113 def to_sexp sexp = [sexp_name] @pre_exe.each { |pe| sexp << pe.pre_sexp } sexp << @body.to_sexp sexp end |