So I need to force a specific order to run the override files? Can't I just re-use the single wrapper function, since it works fine?

From: Bryan Hughes <notifications@github.com<mailto:notifications@github.com>>
Reply-To: appcelerator/titanium-code-processor <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Friday, July 26, 2013 1:19 PM
To: appcelerator/titanium-code-processor <titanium-code-processor@noreply.github.com<mailto:titanium-code-processor@noreply.github.com>>
Cc: Christopher Williams <cwilliams@appcelerator.com<mailto:cwilliams@appcelerator.com>>
Subject: Re: [titanium-code-processor] TIMOB-13183 CodeProcessor: Merge require and common-globals plugins into ti-api-provider (#227)


In plugins/ti-api-provider/lib/overrides/Ti/API.js:

> \ No newline at end of file
> +};
> +
> +/**
> + * console.*() prototype method
> + *
> + * @private
> + */
> +function ConsoleFunc(type, className) {
> +     Base.ObjectType.call(this, className || 'Function');
> +     this.put('length', new Base.NumberType(1), false, true);
> +     this._type = type;
> +}
> +util.inherits(ConsoleFunc, Base.FunctionTypeBase);
> +ConsoleFunc.prototype.callFunction = Base.wrapNativeCall(function callFunction(thisVal, args) {


On second thought, I bet I know why that's happening. It's probably not the Runtime.getGlobalObject().get('console') line that is causing the problem, but the consoleObject.get('debug') line after it. If so, this is probably happening because the Titanium API is being stubbed out before the globals are being stubbed out. I knew there was a dependency ordering issue somewhere :). The fix is to make sure the globals are loaded before the Titanium APIs.

-
Reply to this email directly or view it on GitHub<https://github.com/appcelerator/titanium-code-processor/pull/227/files#r5427661>.