Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 930f2fae15a6
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dc134af7d903
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Sep 17, 2014

  1. Rename boot_module to boot_module_object

    As it’s booting the object as in Module.new.
    elia committed Sep 17, 2014
    Copy the full SHA
    6da00a0 View commit details
  2. Rename $$mod to $$is_mod

    For parity with $$is_class
    elia committed Sep 17, 2014
    Copy the full SHA
    efbc9ed View commit details
  3. Align assignments

    elia committed Sep 17, 2014
    Copy the full SHA
    dc134af View commit details
Showing with 19 additions and 19 deletions.
  1. +1 −1 opal/corelib/class.rb
  2. +6 −6 opal/corelib/module.rb
  3. +12 −12 opal/corelib/runtime.js
2 changes: 1 addition & 1 deletion opal/corelib/class.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
class Class
def self.new(sup = Object, &block)
%x{
if (!sup.$$is_class || sup.$$mod) {
if (!sup.$$is_class || sup.$$is_mod) {
#{raise TypeError, "superclass must be a Class"};
}
12 changes: 6 additions & 6 deletions opal/corelib/module.rb
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@ class Module
def self.new(&block)
%x{
function AnonModule(){}
var klass = Opal.boot(Opal.Module, AnonModule);
klass.$$name = nil;
klass.$$class = Opal.Module;
klass.$$dep = []
klass.$$mod = true;
klass.$$proto = {};
var klass = Opal.boot(Opal.Module, AnonModule);
klass.$$name = nil;
klass.$$class = Opal.Module;
klass.$$dep = []
klass.$$is_mod = true;
klass.$$proto = {};
// inherit scope from parent
$opal.create_scope(Opal.Module.$$scope, klass);
24 changes: 12 additions & 12 deletions opal/corelib/runtime.js
Original file line number Diff line number Diff line change
@@ -55,13 +55,13 @@
* scope will be the outer scope of the new klass.
*/
function create_scope(base, klass, id) {
var const_alloc = function() {};
var const_scope = const_alloc.prototype = new base.constructor();
klass.$$scope = const_scope;
const_scope.base = klass;
klass.$$base_module = base.base;
var const_alloc = function() {};
var const_scope = const_alloc.prototype = new base.constructor();
klass.$$scope = const_scope;
const_scope.base = klass;
klass.$$base_module = base.base;
const_scope.constructor = const_alloc;
const_scope.constants = [];
const_scope.constants = [];

if (id) {
klass.$$orig_scope = base;
@@ -243,12 +243,12 @@
if ($hasOwn.call(base.$$scope, id)) {
module = base.$$scope[id];

if (!module.$$mod && module !== RubyObject) {
if (!module.$$is_mod && module !== RubyObject) {
throw Opal.TypeError.$new(id + " is not a module");
}
}
else {
module = boot_module();
module = boot_module_object();
module.$$name = id;

create_scope(base.$$scope, module, id);
@@ -264,7 +264,7 @@
* Internal function to create a new module instance. This simply sets up
* the prototype hierarchy and method tables.
*/
function boot_module() {
function boot_module_object() {
var mtor = function() {};
mtor.prototype = RubyModule.constructor.prototype;

@@ -281,7 +281,7 @@
module.$$inc = [];
module.$$parent = RubyModule;
module.$$proto = {};
module.$$mod = true;
module.$$is_mod = true;
module.$$dep = [];

return module;
@@ -776,7 +776,7 @@
};

Opal.defn = function(obj, jsid, body) {
if (obj.$$mod) {
if (obj.$$is_mod) {
obj.$$proto[jsid] = body;
Opal.donate(obj, [jsid]);
}
@@ -801,7 +801,7 @@
* Define a singleton method on the given object.
*/
Opal.defs = function(obj, jsid, body) {
if (obj.$$is_class || obj.$$mod) {
if (obj.$$is_class || obj.$$is_mod) {
obj.constructor.prototype[jsid] = body;
}
else {