Skip to content

Commit

Permalink
Rename Nodes::Node to Nodes::Base
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 23, 2013
1 parent 5f56be9 commit 9e04360
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 70 deletions.
4 changes: 2 additions & 2 deletions lib/opal/nodes/base.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class Node
class Base
include Helpers

def self.handlers
Expand All @@ -11,7 +11,7 @@ def self.handlers

def self.handle(*types)
types.each do |type|
Node.handlers[type] = self
Base.handlers[type] = self
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/call.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class CallNode < Node
class CallNode < Base
handle :call

children :recvr, :meth, :arglist, :iter
Expand Down
12 changes: 6 additions & 6 deletions lib/opal/nodes/call_special.rb
Expand Up @@ -4,7 +4,7 @@ module Opal
module Nodes
# recv.mid = rhs
# s(:recv, :mid=, s(:arglist, rhs))
class AttrAssignNode < Node
class AttrAssignNode < Base
handle :attrasgn

children :recvr, :mid, :arglist
Expand All @@ -17,7 +17,7 @@ def compile

# lhs =~ rhs
# s(:match3, lhs, rhs)
class Match3Node < Node
class Match3Node < Base
handle :match3

children :lhs, :rhs
Expand All @@ -30,7 +30,7 @@ def compile

# a ||= rhs
# s(:op_asgn_or, s(:lvar, :a), s(:lasgn, :a, rhs))
class OpAsgnOrNode < Node
class OpAsgnOrNode < Base
handle :op_asgn_or

children :recvr, :rhs
Expand All @@ -43,7 +43,7 @@ def compile

# a &&= rhs
# s(:op_asgn_and, s(:lvar, :a), s(:lasgn, a:, rhs))
class OpAsgnAndNode < Node
class OpAsgnAndNode < Base
handle :op_asgn_and

children :recvr, :rhs
Expand All @@ -56,7 +56,7 @@ def compile

# lhs[args] ||= rhs
# s(:op_asgn1, lhs, args, :||, rhs)
class OpAsgn1Node < Node
class OpAsgn1Node < Base
handle :op_asgn1

children :lhs, :args, :op, :rhs
Expand All @@ -81,7 +81,7 @@ def compile

# lhs.b += rhs
# s(:op_asgn2, lhs, :b=, :+, rhs)
class OpAsgn2Node < Node
class OpAsgn2Node < Base
handle :op_asgn2

children :lhs, :mid, :op, :rhs
Expand Down
4 changes: 2 additions & 2 deletions lib/opal/nodes/case.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class CaseNode < Node
class CaseNode < Base
handle :case

children :condition
Expand Down Expand Up @@ -52,7 +52,7 @@ def case_stmt
end
end

class WhenNode < Node
class WhenNode < Base
handle :when

children :whens, :body
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/class.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class BaseScopeNode < Node
class BaseScopeNode < Base
def in_scope(type, &block)
indent { compiler.in_scope(type, &block) }
end
Expand Down
12 changes: 6 additions & 6 deletions lib/opal/nodes/constants.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class ConstNode < Node
class ConstNode < Base
handle :const

children :name
Expand All @@ -18,7 +18,7 @@ def compile
end
end

class ConstDeclarationNode < Node
class ConstDeclarationNode < Base
handle :cdecl

children :name, :base
Expand All @@ -29,7 +29,7 @@ def compile
end
end

class ConstAssignNode < Node
class ConstAssignNode < Base
handle :casgn

children :base, :name, :value
Expand All @@ -43,7 +43,7 @@ def compile
end
end

class ConstGetNode < Node
class ConstGetNode < Base
handle :colon2

children :base, :name
Expand All @@ -63,7 +63,7 @@ def compile
end
end

class TopConstNode < Node
class TopConstNode < Base
handle :colon3

children :name
Expand All @@ -76,7 +76,7 @@ def compile
end
end

class TopConstAssignNode < Node
class TopConstAssignNode < Base
handle :casgn3

children :name, :value
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/def.rb
Expand Up @@ -139,7 +139,7 @@ def arity_check(args, opt, splat, block_name, mid)
end

# FIXME: needs rewrite
class ArglistNode < Node
class ArglistNode < Base
handle :arglist

def compile
Expand Down
18 changes: 9 additions & 9 deletions lib/opal/nodes/definitions.rb
Expand Up @@ -3,7 +3,7 @@
module Opal
module Nodes

class SvalueNode < Node
class SvalueNode < Base
handle :svalue

children :value
Expand All @@ -15,7 +15,7 @@ def compile

# :scope nodes are actually inside scopes (e.g. :module, :class).
# These are not actually the scopes themselves.
class ScopeNode < Node
class ScopeNode < Base
handle :scope

children :body
Expand All @@ -27,7 +27,7 @@ def compile
end
end

class UndefNode < Node
class UndefNode < Base
handle :undef

children :mid
Expand All @@ -38,7 +38,7 @@ def compile
end
end

class AliasNode < Node
class AliasNode < Base
handle :alias

children :new_name, :old_name
Expand All @@ -61,7 +61,7 @@ def compile
end
end

class BeginNode < Node
class BeginNode < Base
handle :begin

children :body
Expand All @@ -76,7 +76,7 @@ def compile
end
end

class ParenNode < Node
class ParenNode < Base
handle :paren

children :body
Expand All @@ -96,7 +96,7 @@ def compile
end
end

class RescueModNode < Node
class RescueModNode < Base
handle :rescue_mod

children :lhs, :rhs
Expand All @@ -116,7 +116,7 @@ def compile
end
end

class BlockNode < Node
class BlockNode < Base
handle :block

def compile
Expand Down Expand Up @@ -199,7 +199,7 @@ def find_inline_yield(stmt)
end
end

class WhileNode < Node
class WhileNode < Base
handle :while

children :test, :body
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/if.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class IfNode < Node
class IfNode < Base
handle :if

children :test, :true_body, :false_body
Expand Down
22 changes: 11 additions & 11 deletions lib/opal/nodes/literal.rb
Expand Up @@ -2,7 +2,7 @@

module Opal
module Nodes
class ValueNode < Node
class ValueNode < Base
handle :true, :false, :self, :nil

def compile
Expand All @@ -11,7 +11,7 @@ def compile
end
end

class LiteralNode < Node
class LiteralNode < Base
children :value
end

Expand Down Expand Up @@ -63,7 +63,7 @@ def compile
end
end

class DynamicStringNode < Node
class DynamicStringNode < Base
handle :dstr

def compile
Expand All @@ -87,7 +87,7 @@ def compile
end
end

class DynamicSymbolNode < Node
class DynamicSymbolNode < Base
handle :dsym

def compile
Expand All @@ -109,7 +109,7 @@ def compile
end
end

class DynamicXStringNode < Node
class DynamicXStringNode < Base
handle :dxstr

def requires_semicolon(code)
Expand Down Expand Up @@ -138,7 +138,7 @@ def compile
end
end

class DynamicRegexpNode < Node
class DynamicRegexpNode < Base
handle :dregx

def compile
Expand All @@ -158,7 +158,7 @@ def compile
end
end

class ExclusiveRangeNode < Node
class ExclusiveRangeNode < Base
handle :dot2

children :start, :finish
Expand All @@ -174,7 +174,7 @@ def compile
end
end

class InclusiveRangeNode < Node
class InclusiveRangeNode < Base
handle :dot3

children :start, :finish
Expand All @@ -190,7 +190,7 @@ def compile
end
end

class HashNode < Node
class HashNode < Base
handle :hash

def keys_and_values
Expand Down Expand Up @@ -252,7 +252,7 @@ def compile_hash2(keys, values)
end
end

class ArrayNode < Node
class ArrayNode < Base
handle :array

def compile
Expand Down Expand Up @@ -302,7 +302,7 @@ def compile
end

# def args list
class ArgsNode < Node
class ArgsNode < Base
handle :args

def compile
Expand Down

0 comments on commit 9e04360

Please sign in to comment.