Class: CodeTools::AST::Module
- Defined in:
- lib/rubinius/code/ast/definitions.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, name, body) ⇒ Module
constructor
A new instance of Module.
- #to_sexp ⇒ Object
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, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, name, body) ⇒ Module
Returns a new instance of Module.
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
# File 'lib/rubinius/code/ast/definitions.rb', line 949 def initialize(line, name, body) @line = line case name when Symbol @name = ModuleName.new line, name when ToplevelConstant @name = ToplevelModuleName.new line, name else @name = ScopedModuleName.new line, name end if body @body = ModuleScope.new line, @name, body else @body = EmptyBody.new line end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
947 948 949 |
# File 'lib/rubinius/code/ast/definitions.rb', line 947 def body @body end |
#name ⇒ Object
Returns the value of attribute name.
947 948 949 |
# File 'lib/rubinius/code/ast/definitions.rb', line 947 def name @name end |
Instance Method Details
#bytecode(g) ⇒ Object
968 969 970 971 |
# File 'lib/rubinius/code/ast/definitions.rb', line 968 def bytecode(g) @name.bytecode(g) @body.bytecode(g) end |
#to_sexp ⇒ Object
973 974 975 |
# File 'lib/rubinius/code/ast/definitions.rb', line 973 def to_sexp [:module, @name.to_sexp, @body.to_sexp] end |