Changeset 19

Show
Ignore:
Timestamp:
11/15/05 18:35:24 (3 years ago)
Author:
Jan-Klaas Kollhof
Message:

broke mozilla due to proto property and fixed a problem with copying static methods during class generation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • jsolait/trunk/jsolait/jsolait.js

    r18 r19  
    8989            //remember the base prototypes 
    9090            baseProtos.push(baseClass.prototype); 
    91             if(baseClass.__proto__ !== undefined){ 
    92                 baseProto = baseClass.__proto__(bases); 
     91            if(baseClass.__createProto__ !== undefined){ 
     92                baseProto = baseClass.__createProto__(bases); 
    9393            }else{ 
    9494                baseProto = new baseClass(Class); 
     
    105105                } 
    106106            } 
    107             //extend the new class' static interface 
     107            //extend the new class' static interface  
     108            //todo: any props that should not be copied 
    108109            for(var key in baseClass){ 
    109                 if(__class__[key] === undefined){ 
     110                if((key != 'prototype') && (__class__[key] === undefined)){ 
    110111                    __class__[key] = baseClass[key]; 
    111112                } 
     
    198199        var NewClass = function(calledBy){ 
    199200            if(calledBy !== Class){ 
     201                var privId='__priv__' + arguments.callee.__id__; 
     202                this[privId] = {}; 
    200203                if(this.__init__){ 
    201                     var privId='__priv__' + arguments.callee.__id__; 
    202                     this[privId] = {}; 
    203204                    this.__init__.apply(this, arguments); 
    204205                }     
     
    227228}; 
    228229 
    229 Class.__proto__=function(){  
     230Class.__createProto__=function(){  
    230231    throw "Can't use Class as a base class."; 
    231232}; 
     
    233234Array.__isArray__=true; 
    234235Array.__str__=Array.toString=function(){return "[class Array]";}; 
    235 Array.__proto__=function(){ var r =[]; r.__str__ = Array.prototype.toString;  return r; }; 
     236Array.__createProto__=function(){ var r =[]; r.__str__ = Array.prototype.toString;  return r; }; 
    236237Object.__str__=Object.toString=function(){return "[class Object]";}; 
    237 Function.__proto__ = function(){ throw "Cannot inherit from Function. implement the callabel interface instead using YourClass::__call__.";}; 
     238Function.__createProto__ = function(){ throw "Cannot inherit from Function. implement the callabel interface instead using YourClass::__call__.";}; 
    238239 
    239240 
     
    284285}; 
    285286 
    286 Module.__proto__=function(){  
     287Module.__createProto__=function(){  
    287288    throw "Can't use Module as a base class."; 
    288289};