Skip to content

Commit

Permalink
Anon modules should have their own constant scope
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 20, 2013
1 parent 2fcf583 commit c91a71e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion corelib/class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def inherited(cls)
def new(*args, &block)
%x{
var obj = #{allocate};
obj._id = Opal.uid();
obj.$initialize._p = block;
obj.$initialize.apply(obj, args);
Expand Down
4 changes: 3 additions & 1 deletion corelib/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ def self.new(&block)
function AnonModule(){}
var klass = Opal.boot(Module, AnonModule);
klass._name = nil;
klass._scope = Module._scope;
klass._klass = Module;
klass.__dep__ = []
klass.__mod__ = true;
// inherit scope from parent
$opal.create_scope(Module._scope, klass);
if (block !== nil) {
var block_self = block._s;
block._s = null;
Expand Down

0 comments on commit c91a71e

Please sign in to comment.