Skip to content

Commit

Permalink
ScopeNode#in_scope no longer takes scope type as arg
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Nov 15, 2013
1 parent a4c12ba commit 10dce0a
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/opal/nodes/class.rb
Expand Up @@ -15,7 +15,7 @@ def compile
line " function $#{name}(){};"
line " var self = $#{name} = $klass($base, $super, '#{name}', $#{name});"

in_scope(:class) do
in_scope do
scope.name = name
add_temp "#{scope.proto} = $#{name}._proto"
add_temp "$scope = $#{name}._scope"
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/def.rb
Expand Up @@ -40,7 +40,7 @@ def compile
arity_code = arity_check(args, opt, uses_splat, block_name, mid)
end

in_scope(:def) do
in_scope do
scope.mid = mid
scope.defs = true if recvr

Expand Down
4 changes: 1 addition & 3 deletions lib/opal/nodes/iter.rb
Expand Up @@ -2,7 +2,6 @@

module Opal
module Nodes
# FIXME: this needs a rewrite very urgently
class IterNode < ScopeNode
handle :iter

Expand Down Expand Up @@ -33,11 +32,10 @@ def compile

to_vars = identity = nil

in_scope(:iter) do
in_scope do
identity = scope.identify!
add_temp "self = #{identity}._s || this"


args[1..-1].each_with_index do |arg, idx|
if arg.type == :lasgn
arg = variable(arg[1])
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/module.rb
Expand Up @@ -14,7 +14,7 @@ def compile
push "(function($base) {"
line " var self = $module($base, '#{name}');"

in_scope(:module) do
in_scope do
scope.name = name
add_temp "#{scope.proto} = self._proto"
add_temp '$scope = self._scope'
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/scope.rb
Expand Up @@ -50,7 +50,7 @@ def initialize(*)
@proto_ivars = []
end

def in_scope(type, &block)
def in_scope(&block)
indent do
@parent = compiler.scope
compiler.scope = self
Expand Down
2 changes: 1 addition & 1 deletion lib/opal/nodes/singleton_class.rb
Expand Up @@ -10,7 +10,7 @@ class SingletonClassNode < ScopeNode
def compile
push "(function(self) {"

in_scope(:sclass) do
in_scope do
add_temp '$scope = self._scope'
add_temp 'def = self._proto'

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

line "(function($opal) {"

in_scope(:top) do
in_scope do
body_code = stmt(stmts)
body_code = [body_code] unless body_code.is_a?(Array)

Expand Down

0 comments on commit 10dce0a

Please sign in to comment.