Skip to content

Commit

Permalink
Remove classReleaseMode
Browse files Browse the repository at this point in the history
  • Loading branch information
pandamicro committed Oct 14, 2015
1 parent c23c981 commit 0bf2032
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
43 changes: 1 addition & 42 deletions cocos2d/core/platform/CCClass.js
Expand Up @@ -35,38 +35,6 @@ var ClassManager = {

instanceId : (0|(Math.random()*998)),

compileSuper : function(func, name, id){
//make the func to a string
var str = func.toString();
//find parameters
var pstart = str.indexOf('('), pend = str.indexOf(')');
var params = str.substring(pstart+1, pend);
params = params.trim();

//find function body
var bstart = str.indexOf('{'), bend = str.lastIndexOf('}');
var str = str.substring(bstart+1, bend);

//now we have the content of the function, replace this._super
//find this._super
while(str.indexOf('this._super') !== -1)
{
var sp = str.indexOf('this._super');
//find the first '(' from this._super)
var bp = str.indexOf('(', sp);

//find if we are passing params to super
var bbp = str.indexOf(')', bp);
var superParams = str.substring(bp+1, bbp);
superParams = superParams.trim();
var coma = superParams? ',':'';

//replace this._super
str = str.substring(0, sp)+ 'ClassManager['+id+'].'+name+'.call(this'+coma+str.substring(bp+1);
}
return Function(params, str);
},

getNewID : function(){
return this.id++;
},
Expand All @@ -75,19 +43,13 @@ var ClassManager = {
return this.instanceId++;
}
};
ClassManager.compileSuper.ClassManager = ClassManager;

/* Managed JavaScript Inheritance
* Based on John Resig's Simple JavaScript Inheritance http://ejohn.org/blog/simple-javascript-inheritance/
* MIT Licensed.
*/
(function () {
var fnTest = /\b_super\b/;
var config = cc.game.config;
var releaseMode = config[cc.game.CONFIG_KEY.classReleaseMode];
if(releaseMode) {
console.log("release Mode");
}

/**
* The base Class implementation (does nothing)
Expand Down Expand Up @@ -152,10 +114,7 @@ ClassManager.compileSuper.ClassManager = ClassManager;
var override = (typeof _super[name] === "function");
var hasSuperCall = fnTest.test(prop[name]);

if (releaseMode && isFunc && override && hasSuperCall) {
desc.value = ClassManager.compileSuper(prop[name], name, classId);
Object.defineProperty(prototype, name, desc);
} else if (isFunc && override && hasSuperCall) {
if (isFunc && override && hasSuperCall) {
desc.value = (function (name, fn) {
return function () {
var tmp = this._super;
Expand Down
3 changes: 1 addition & 2 deletions external/pluginx/Plugin.js
Expand Up @@ -33,8 +33,6 @@
return;
}

var config = cc.game.config.plugin || {};

//Native plugin usage
var PluginManager = function(){};

Expand Down Expand Up @@ -233,6 +231,7 @@

/** @expose */
extend: function(name, extend){
var config = (cc.game.config && cc.game.config.plugin) || {};
PluginList[name] = new (PluginAssembly.extend(name, extend));
typeof PluginList[name].ctor === "function" && PluginList[name].ctor(config[name]);
},
Expand Down

0 comments on commit 0bf2032

Please sign in to comment.