Class: CodeTools::AST::SClassScope
- Inherits:
-
ClosedScope
- Object
- Node
- ClosedScope
- CodeTools::AST::SClassScope
- Defined in:
- lib/rubinius/code/ast/definitions.rb
Instance Attribute Summary
Attributes inherited from ClosedScope
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, body) ⇒ SClassScope
constructor
A new instance of SClassScope.
Methods inherited from ClosedScope
#assign_local_reference, #attach_and_call, #module?, #nest_scope, #new_local, #new_nested_local, #search_local, #to_sexp
Methods inherited from Node
#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #to_sexp, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, body) ⇒ SClassScope
Returns a new instance of SClassScope.
1107 1108 1109 1110 1111 |
# File 'lib/rubinius/code/ast/definitions.rb', line 1107 def initialize(line, body) @line = line @body = body @name = nil end |
Instance Method Details
#bytecode(g) ⇒ Object
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 |
# File 'lib/rubinius/code/ast/definitions.rb', line 1113 def bytecode(g) pos(g) g.push_type g.swap g.send :object_singleton_class, 1 if @body # if @body just returns self, don't bother with it. if @body.kind_of? Block ary = @body.array return if ary.size == 1 and ary[0].kind_of? Self end # Ok, emit it. attach_and_call g, :__metaclass_init__, true, true else g.pop g.push_tagged_nil 0 end end |