Created
February 17, 2015 23:16
-
-
Save greenboxal/ba7cd98c82ebb6b69a78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(global, 'defmod', { | |
configurable: false, | |
enumerable: false, | |
set: function(value) { | |
global[value.name] = new Module(value.name, value); | |
} | |
}); | |
Object.defineProperty(global, 'defclass', { | |
configurable: false, | |
enumerable: false, | |
set: function(value) { | |
var superclass = null; | |
var fn = value; | |
if (value instanceof Array) { | |
superclass = value[0]; | |
fn = value[1]; | |
} | |
global[value.name] = new Class(fn.name, superclass, fn); | |
} | |
}); | |
Object.defineProperty(global, 'def', { | |
configurable: false, | |
enumerable: false, | |
set: function(value) { | |
var receiver = SaphireVM.getTopOpenModule(); | |
receiver.defineMethod(value.name, value); | |
} | |
}); | |
Object.defineProperty(global, 'defget', { | |
configurable: false, | |
enumerable: false, | |
set: function(value) { | |
var receiver = SaphireVM.getTopOpenModule(); | |
receiver.defineGetter(value.name, value); | |
} | |
}); | |
Object.defineProperty(global, 'defset', { | |
configurable: false, | |
enumerable: false, | |
set: function(value) { | |
var receiver = SaphireVM.getTopOpenModule(); | |
receiver.defineSetter(value.name, value); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment