lib/melbourne/ast/definitions.rb in melbourne-1.0.0 vs lib/melbourne/ast/definitions.rb in melbourne-1.0.1
- old
+ new
@@ -14,20 +14,20 @@
# The alias that is defined for the element
#
attr_accessor :from
- def initialize(line, to, from) #:nodoc:
+ def initialize(line, to, from)
@line = line
@to = to
@from = from
end
end
# TODO: document!
- class VAlias < Alias #:nodoc:
+ class VAlias < Alias
end
# An +undef+ statement as in:
#
@@ -37,11 +37,11 @@
# The name of the +undef+'d element
#
attr_accessor :name
- def initialize(line, sym) #:nodoc:
+ def initialize(line, sym)
@line = line
@name = sym
end
end
@@ -59,17 +59,17 @@
# The statements inside of the block
#
attr_accessor :array
- def initialize(line, array) #:nodoc:
+ def initialize(line, array)
@line = line
@array = array
end
# TODO: document!
- def strip_arguments #:nodoc:
+ def strip_arguments
if @array.first.kind_of? FormalArguments
node = @array.shift
if @array.first.kind_of? BlockArgument
node.block_arg = @array.shift
end
@@ -78,11 +78,11 @@
end
end
# TODO: document!
- class ClosedScope < Node #:nodoc:
+ class ClosedScope < Node
attr_accessor :body
end
@@ -99,11 +99,11 @@
# The arguments of the defined method
#
attr_accessor :arguments
- def initialize(line, name, block) #:nodoc:
+ def initialize(line, name, block)
@line = line
@name = name
@arguments = block.strip_arguments
block.array << Nil.new(line) if block.array.empty?
@body = block
@@ -124,11 +124,11 @@
# The body of the defined method
#
attr_accessor :body
- def initialize(line, receiver, name, block) #:nodoc:
+ def initialize(line, receiver, name, block)
@line = line
@receiver = receiver
@body = DefineSingletonScope.new line, name, block
end
@@ -136,11 +136,11 @@
# The scope a singletion method definition opens. This is the actual body of +Melbourne::AST::DefineSingleton+s
#
class DefineSingletonScope < Define
- def initialize(line, name, block) #:nodoc:
+ def initialize(line, name, block)
super line, name, block
end
end
@@ -165,19 +165,19 @@
# The arguments of the method that have default values
#
attr_accessor :defaults
- # The splat (<tt>*some</tt>) arguments of the method
+ # The splat (+*some+) arguments of the method
#
attr_accessor :splat
# The block argument if there is one
#
attr_accessor :block_arg
- def initialize(line, args, defaults, splat) #:nodoc:
+ def initialize(line, args, defaults, splat)
@line = line
@defaults = nil
@block_arg = nil
if defaults
@@ -201,11 +201,11 @@
end
@names = args
@splat = splat
end
- def block_arg=(node) #:nodoc:
+ def block_arg=(node)
@names << node.name
@block_arg = node
end
# Gets the arity of the method. The arity is the number of required arguments the method defines.
@@ -230,11 +230,11 @@
def total_args
@required.size + @optional.size
end
# TODO: document!
- def splat_index #:nodoc:
+ def splat_index
if @splat
index = @names.size
index -= 1 if @block_arg
index -= 1 if @splat.kind_of? Symbol
index
@@ -253,20 +253,20 @@
# The names of the arguments
#
attr_accessor :names
- def initialize(line, block) #:nodoc:
+ def initialize(line, block)
@line = line
array = block.array
@names = array.map { |a| a.name }
@arguments = array
end
end
- module LocalVariable #:nodoc:
+ module LocalVariable
attr_accessor :variable
end
@@ -281,11 +281,11 @@
# The name of the block argument
#
attr_accessor :name
- def initialize(line, name) #:nodoc:
+ def initialize(line, name)
@line = line
@name = name
end
end
@@ -306,11 +306,11 @@
# The body of the +class+
#
attr_accessor :body
- def initialize(line, name, superclass, body) #:nodoc:
+ def initialize(line, name, superclass, body)
@line = line
@superclass = superclass ? superclass : Nil.new(line)
if name.kind_of? Symbol
@@ -330,11 +330,11 @@
# The scope a class definition opens. This is the actual body of +Melbourne::AST::Class+es
#
class ClassScope < ClosedScope
- def initialize(line, name, body) #:nodoc:
+ def initialize(line, name, body)
@line = line
@name = name.name
@body = body
end
@@ -349,13 +349,13 @@
# The actual name of the class
#
attr_accessor :name
# TODO: document!
- attr_accessor :superclass #:nodoc:
+ attr_accessor :superclass
- def initialize(line, name, superclass) #:nodoc:
+ def initialize(line, name, superclass)
@line = line
@name = name
@superclass = superclass
end
@@ -365,15 +365,15 @@
#
# class X::Y; end
#
class ScopedClassName < ClassName
- # The parent of the scoped class name; for a class <tt>class X::Y; end</tt> the scoped class name is +Y+ and the parent is +X+
+ # The parent of the scoped class name; for a class +class X::Y; end+ the scoped class name is +Y+ and the parent is +X+
#
attr_accessor :parent
- def initialize(line, parent, superclass) #:nodoc:
+ def initialize(line, parent, superclass)
@line = line
@name = parent.name
@parent = parent.parent
@superclass = superclass
end
@@ -392,11 +392,11 @@
# The body of the module
#
attr_accessor :body
- def initialize(line, name, body) #:nodoc:
+ def initialize(line, name, body)
@line = line
if name.kind_of? Symbol
@name = ModuleName.new line, name
else
@@ -426,11 +426,11 @@
# The actual name of the module
#
attr_accessor :name
- def initialize(line, name) #:nodoc:
+ def initialize(line, name)
@line = line
@name = name
end
end
@@ -439,15 +439,15 @@
#
# module X::M; end
#
class ScopedModuleName < ModuleName
- # The parent of the scoped module name; for a module <tt>module X::M; end</tt> the scoped module name is +Y+ and the parent is +X+
+ # The parent of the scoped module name; for a module +module X::M; end+ the scoped module name is +Y+ and the parent is +X+
#
attr_accessor :parent
- def initialize(line, parent) #:nodoc:
+ def initialize(line, parent)
@line = line
@name = parent.name
@parent = parent.parent
end
@@ -455,11 +455,11 @@
# The scope a module definition opens. This is the actual body of +Melbourne::AST::Module+s
#
class ModuleScope < ClosedScope
- def initialize(line, name, body) #:nodoc:
+ def initialize(line, name, body)
@line = line
@name = name.name
@body = body
end
@@ -472,15 +472,15 @@
# end
# end
#
class SClass < Node
- # The receiver (for <tt>class << self</tt>, +self+ is the receiver)
+ # The receiver (for +class << self+, +self+ is the receiver)
#
attr_accessor :receiver
- def initialize(line, receiver, body) #:nodoc:
+ def initialize(line, receiver, body)
@line = line
@receiver = receiver
@body = SClassScope.new line, body
end
@@ -488,69 +488,69 @@
# The scope a singleton class definition opens. This is the actual body of +Melbourne::AST::SClass+s
#
class SClassScope < ClosedScope
- def initialize(line, body) #:nodoc:
+ def initialize(line, body)
@line = line
@body = body
@name = nil
end
end
# TODO: document!
- class Container < ClosedScope #:nodoc:
+ class Container < ClosedScope
attr_accessor :file, :name, :variable_scope
def initialize(body)
@body = body || Nil.new(1)
end
end
# TODO: document!
- class EvalExpression < Container #:nodoc:
+ class EvalExpression < Container
def initialize(body)
super body
@name = :__eval_script__
end
end
# TODO: document!
- class Snippit < Container #:nodoc:
+ class Snippit < Container
def initialize(body)
super body
@name = :__snippit__
end
end
# TODO: document!
- class Script < Container #:nodoc:
+ class Script < Container
def initialize(body)
super body
@name = :__script__
end
end
- # A <tt>defined?</tt> statement as in:
+ # A +defined?+ statement as in:
#
# defined? a
#
class Defined < Node
- # The expression passed to <tt>defined?</tt>
+ # The expression passed to +defined?+
#
attr_accessor :expression
- def initialize(line, expr) #:nodoc:
+ def initialize(line, expr)
@line = line
@expression = expr
end
end