Class: CodeTools::AST::Class
- 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.
-
#superclass ⇒ Object
Returns the value of attribute superclass.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, name, superclass, body) ⇒ Class
constructor
A new instance of Class.
- #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, superclass, body) ⇒ Class
Returns a new instance of Class.
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 |
# File 'lib/rubinius/code/ast/definitions.rb', line 786 def initialize(line, name, superclass, body) @line = line @superclass = superclass ? superclass : NilLiteral.new(line) case name when Symbol @name = ClassName.new line, name, @superclass when ToplevelConstant @name = ToplevelClassName.new line, name, @superclass else @name = ScopedClassName.new line, name, @superclass end if body @body = ClassScope.new line, @name, body else @body = EmptyBody.new line end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
784 785 786 |
# File 'lib/rubinius/code/ast/definitions.rb', line 784 def body @body end |
#name ⇒ Object
Returns the value of attribute name.
784 785 786 |
# File 'lib/rubinius/code/ast/definitions.rb', line 784 def name @name end |
#superclass ⇒ Object
Returns the value of attribute superclass.
784 785 786 |
# File 'lib/rubinius/code/ast/definitions.rb', line 784 def superclass @superclass end |
Instance Method Details
#bytecode(g) ⇒ Object
807 808 809 810 |
# File 'lib/rubinius/code/ast/definitions.rb', line 807 def bytecode(g) @name.bytecode(g) @body.bytecode(g) end |
#to_sexp ⇒ Object
812 813 814 815 |
# File 'lib/rubinius/code/ast/definitions.rb', line 812 def to_sexp superclass = @superclass.kind_of?(NilLiteral) ? nil : @superclass.to_sexp [:class, @name.to_sexp, superclass, @body.to_sexp] end |