Skip to content

Commit

Permalink
Keep nodes under Opal::Nodes namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 23, 2013
1 parent 4526c65 commit 5f56be9
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/opal/nodes/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/helpers'

module Opal
class Parser
module Nodes
class Node
include Helpers

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/call.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

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

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/call_special.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes
# recv.mid = rhs
# s(:recv, :mid=, s(:arglist, rhs))
class AttrAssignNode < Node
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/case.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

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

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/class.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes
class BaseScopeNode < Node
def in_scope(type, &block)
indent { compiler.in_scope(type, &block) }
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/constants.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

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

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/def.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/class'

module Opal
class Parser
module Nodes
# FIXME: needs rewrite
class DefNode < BaseScopeNode
handle :def
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/definitions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes

class SvalueNode < Node
handle :svalue
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Opal
class Parser
module Nodes
module Helpers

# Reserved javascript keywords - we cannot create variables with the
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/if.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

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

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/iter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/class'

module Opal
class Parser
module Nodes
# FIXME: this needs a rewrite very urgently
class IterNode < BaseScopeNode
handle :iter
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/literal.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

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

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/logic.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes
class NextNode < Node
handle :next

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/rescue.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes
class EnsureNode < Node
handle :ensure

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/super.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes

# This base class is used just to child the find_super_dispatcher method
# body. This is then used by actual super calls, or a defined?(super) style
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/top.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/class'

module Opal
class Parser
module Nodes
# Generates code for an entire file, i.e. the base sexp
class TopNode < BaseScopeNode
def compile
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/variables.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes
class LocalVariableNode < Node
handle :lvar

Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/yield.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'opal/nodes/base'

module Opal
class Parser
module Nodes
class BaseYieldNode < Node
def compile_call(children, level)
scope.uses_block!
Expand Down
6 changes: 3 additions & 3 deletions lib/opal/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def parse(source, options = {})

@sexp = Grammar.new.parse(@source, @file)

top_node = TopNode.new(@sexp, :expr, self)
top_node = Nodes::TopNode.new(@sexp, :expr, self)
@fragments = top_node.compile_to_fragments.flatten

@result = @fragments.map(&:code).join('')
Expand Down Expand Up @@ -114,7 +114,7 @@ def s(*parts)
end

def fragment(str, sexp = nil)
Fragment.new(code, sexp)
Fragment.new(str, sexp)
end

# Used to generate a unique id name per file. These are used
Expand Down Expand Up @@ -210,7 +210,7 @@ def process(sexp, level = :expr)
end

def handlers
@handlers ||= Parser::Node.handlers
@handlers ||= Opal::Nodes::Node.handlers
end

# Handle "special" method calls, e.g. require(). Subclasses can override
Expand Down

0 comments on commit 5f56be9

Please sign in to comment.