|
@@ -119,8 +119,8 @@ function Smalltalk(){
|
|
|
|
|
|
function klass(spec) {
|
|
function klass(spec) {
|
|
var spec = spec || {};
|
|
var spec = spec || {};
|
|
- var meta = metaKlass();
|
|
|
|
- var that = setupKlass(meta.instanceClass, spec);
|
|
|
|
|
|
+ var meta = metaclass();
|
|
|
|
+ var that = setupClass(meta.instanceClass, spec);
|
|
that.className = spec.className;
|
|
that.className = spec.className;
|
|
meta.className = spec.className + ' class';
|
|
meta.className = spec.className + ' class';
|
|
if(spec.superclass) {
|
|
if(spec.superclass) {
|
|
@@ -130,19 +130,18 @@ function Smalltalk(){
|
|
return that;
|
|
return that;
|
|
}
|
|
}
|
|
|
|
|
|
- function metaKlass() {
|
|
|
|
- var meta = setupKlass(new SmalltalkMetaclass(), {});
|
|
|
|
|
|
+ function metaclass() {
|
|
|
|
+ var meta = setupClass(new SmalltalkMetaclass(), {});
|
|
meta.instanceClass = new meta.fn;
|
|
meta.instanceClass = new meta.fn;
|
|
return meta;
|
|
return meta;
|
|
}
|
|
}
|
|
|
|
|
|
- function klassToString() { return 'Smalltalk ' + this.className; }
|
|
|
|
-
|
|
|
|
- function setupKlass(that, spec) {
|
|
|
|
|
|
+ function setupClass(that, spec) {
|
|
that.fn = spec.fn || function(){};
|
|
that.fn = spec.fn || function(){};
|
|
that.iVarNames = spec.iVarNames || [];
|
|
that.iVarNames = spec.iVarNames || [];
|
|
Object.defineProperty(that, "toString", {
|
|
Object.defineProperty(that, "toString", {
|
|
- value: klassToString, configurable: true // no writable - in par with ES6 methods
|
|
|
|
|
|
+ value: function() { return 'Smalltalk ' + this.className; },
|
|
|
|
+ configurable: true // no writable - in par with ES6 methods
|
|
});
|
|
});
|
|
that.pkg = spec.pkg;
|
|
that.pkg = spec.pkg;
|
|
Object.defineProperties(that.fn.prototype, {
|
|
Object.defineProperties(that.fn.prototype, {
|