Added support for new compiler when loading objj files in the browsers

This commit is contained in:
Martin Carlberg
2012-12-15 23:35:36 +01:00
parent a202cfbbe9
commit 59fa5c27b6
5 changed files with 4597 additions and 7 deletions
+27 -3
View File
@@ -26,15 +26,17 @@ var ExecutableUnloadedFileDependencies = 0,
ExecutableLoadedFileDependencies = 2,
AnonymousExecutableCount = 0;
function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*CFURL|String*/ aURL, /*Function*/ aFunction)
function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*CFURL|String*/ aURL, /*Function*/ aFunction, /*ObjJCompiler*/aCompiler)
{
if (arguments.length === 0)
return this;
this._code = aCode;
this._function = aFunction || NULL;
this._function = aFunction || null;
this._URL = makeAbsoluteURL(aURL || new CFURL("(Anonymous" + (AnonymousExecutableCount++) + ")"));
this._compiler = aCompiler || null;
this._fileDependencies = fileDependencies;
if (fileDependencies.length)
@@ -48,7 +50,8 @@ function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*CFURL|String
if (this._function)
return;
this.setCode(aCode);
if (!aCompiler)
this.setCode(aCode);
}
exports.Executable = Executable;
@@ -135,6 +138,27 @@ Executable.prototype.execute = function()
#if EXECUTION_LOGGING
CPLog("EXECUTION: " + this.URL());
#endif
if (this._compiler)
{
var fileDependencies = this.fileDependencies(),
index = 0,
count = fileDependencies.length;
for (; index < count; ++index)
{
var fileDependency = fileDependencies[index],
isQuoted = fileDependency.isLocal(),
URL = fileDependency.URL();
CPLog("Execute FileDependant: " + URL);
objj_executeFile(URL, isQuoted);
}
CPLog("Compile Pass 2: " + this.URL());
this.setCode(this._compiler.compilePass2());
}
var oldContextBundle = CONTEXT_BUNDLE;
// FIXME: Should we have stored this?
+8 -4
View File
@@ -41,13 +41,17 @@ function FileExecutable(/*CFURL|String*/ aURL)
if (fileContents.match(/^@STATIC;/))
executable = decompile(fileContents, aURL);
else if (extension === "j" || !extension)
executable = exports.preprocess(fileContents, aURL, Preprocessor.Flags.IncludeDebugSymbols);
else if (extension === "j" || !extension) {
// console.log("Compile: " + aURL);
// if (!aURL || aURL.toString().indexOf("Boplats/Office/Applications") === -1)
// executable = exports.preprocess(fileContents, aURL, Preprocessor.Flags.IncludeDebugSymbols);
// else
executable = exports.compileFileDependencies(fileContents, aURL, ObjJCompiler.Flags.IncludeDebugSymbols);
}
else
executable = new Executable(fileContents, [], aURL);
Executable.apply(this, [executable.code(), executable.fileDependencies(), aURL, executable._function]);
Executable.apply(this, [executable.code(), executable.fileDependencies(), aURL, executable._function, executable._compiler]);
this._hasExecuted = NO;
}
+2
View File
@@ -43,6 +43,8 @@
#include "CFBundle.js"
#include "StaticResource.js"
#include "Preprocessor.js"
#include "Parser.js"
#include "ObjJCompiler.js"
#include "FileDependency.js"
#include "Executable.js"
#include "FileExecutable.js"
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long