mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-09 18:30:59 +00:00
Merge pull request #2399 from mrcarlberg/default_include_method_types
Default include type signatures for all kind of builds
This commit is contained in:
commit
3cf0d60f5d
16 files changed
+188
-56
No files matched your search
@@ -90,11 +90,14 @@ exports.run = function(args)
|
||||
if (argv[0] === "--help" || argv[0] === "-h")
|
||||
{
|
||||
print("Usage (objj): " + args[0] + " [options] [--] files...");
|
||||
print(" -v, --version print the current version of objj");
|
||||
print(" -I, --objj-include-paths include a specific framework paths")
|
||||
print(" -h, --help print this help");
|
||||
print(" -m, --multifiles launch objj on several files")
|
||||
print(" -x, --xml specify the output format in xml.")
|
||||
print(" -v, --version print the current version of objj");
|
||||
print(" -I, --objj-include-paths include a specific framework paths")
|
||||
print(" -h, --help print this help");
|
||||
print(" -m, --multifiles launch objj on several files")
|
||||
print(" -x, --xml specify the output format in xml.")
|
||||
print(" -g, --include-debug-symbols Include debug symbols when compiling.")
|
||||
print(" -T, --dont-include-type-signatures Do not include type signatures when compiling.")
|
||||
print(" -O2, --inline-msg-send Inline objj_msgSend function when compiling.")
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,6 +122,24 @@ exports.run = function(args)
|
||||
argv.shift();
|
||||
exports.outputFormatInXML = true;
|
||||
break;
|
||||
|
||||
case "-g":
|
||||
case "--include-debug-symbols":
|
||||
argv.shift();
|
||||
(OBJJ_COMPILER_FLAGS || (OBJJ_COMPILER_FLAGS = [])).push("IncludeDebugSymbols");
|
||||
break;
|
||||
|
||||
case "-T":
|
||||
case "--dont-include-type-signatures":
|
||||
argv.shift();
|
||||
(OBJJ_COMPILER_FLAGS || (OBJJ_COMPILER_FLAGS = [])).push("IncludeTypeSignatures");
|
||||
break;
|
||||
|
||||
case "-O2":
|
||||
case "--inline-msg-send":
|
||||
argv.shift();
|
||||
(OBJJ_COMPILER_FLAGS || (OBJJ_COMPILER_FLAGS = [])).push("InlineMsgSend");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ function resolveFlags(args)
|
||||
objjcFlags &= ~ObjectiveJ.ObjJAcornCompiler.Flags.CheckSyntax;
|
||||
|
||||
else if (argument.indexOf("-T") === 0)
|
||||
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures;
|
||||
objjcFlags &= ~ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures;
|
||||
|
||||
else if (argument.indexOf("-g") === 0)
|
||||
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols;
|
||||
@@ -259,12 +259,16 @@ exports.main = function(args)
|
||||
if (argv[0] === "--help" || argv[0].substr(0, 1) == '-')
|
||||
{
|
||||
print("Usage (objjc 2.0): " + args[0] + " [options] [--] file...");
|
||||
print(" -p, --print print the output directly to stdout");
|
||||
print(" --unmarked don't tag the output with @STATIC header");
|
||||
print(" -p, --print print the output directly to stdout");
|
||||
print(" --unmarked don't tag the output with @STATIC header");
|
||||
print("");
|
||||
print(" -T, --includeTypeSignatures include type signatures in the compiled output");
|
||||
print(" -T, --dont-include-type-signatures include type signatures in the compiled output");
|
||||
print(" -g, --include-debug-symbols include debug symbols in the compiled output");
|
||||
print(" -T, --include-type-signatures include type signatures in the compiled output");
|
||||
print(" -O, --compress compress the compiled output");
|
||||
print(" -O2, --inline-msg-send inline objj_msgSend function in the compiled output");
|
||||
print("");
|
||||
print(" --help print this help");
|
||||
print(" --help print this help");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -365,9 +365,6 @@ var MethodDef = function(name, types)
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
var currentCompilerFlags = 0;
|
||||
var currentGccCompilerFlags = "";
|
||||
|
||||
var reservedIdentifiers = exports.acorn.makePredicate("self _cmd undefined localStorage arguments");
|
||||
|
||||
var wordPrefixOperators = exports.acorn.makePredicate("delete in instanceof new typeof void");
|
||||
@@ -425,6 +422,16 @@ var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*
|
||||
compile(this.tokens, new Scope(null ,{ compiler: this }), pass === 2 ? pass2 : pass1);
|
||||
}
|
||||
|
||||
ObjJAcornCompiler.Flags = { };
|
||||
|
||||
ObjJAcornCompiler.Flags.IncludeDebugSymbols = 1 << 0;
|
||||
ObjJAcornCompiler.Flags.IncludeTypeSignatures = 1 << 1;
|
||||
ObjJAcornCompiler.Flags.Generate = 1 << 2;
|
||||
ObjJAcornCompiler.Flags.InlineMsgSend = 1 << 3;
|
||||
|
||||
var currentCompilerFlags = ObjJAcornCompiler.Flags.IncludeTypeSignatures;
|
||||
var currentGccCompilerFlags = "";
|
||||
|
||||
exports.ObjJAcornCompiler = ObjJAcornCompiler;
|
||||
|
||||
exports.ObjJAcornCompiler.compileToExecutable = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags)
|
||||
@@ -494,25 +501,25 @@ exports.setCurrentGccCompilerFlags = function(/*String*/ compilerFlags)
|
||||
|
||||
var args = compilerFlags.split(" "),
|
||||
count = args.length,
|
||||
objjcFlags = 0;
|
||||
objjcFlags = ObjJAcornCompiler.Flags.IncludeTypeSignatures;
|
||||
|
||||
for (var index = 0; index < count; ++index)
|
||||
{
|
||||
var argument = args[index];
|
||||
|
||||
if (argument.indexOf("-g") === 0)
|
||||
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols;
|
||||
|
||||
objjcFlags |= ObjJAcornCompiler.Flags.IncludeDebugSymbols;
|
||||
else if (argument.indexOf("-O") === 0) {
|
||||
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.Compress;
|
||||
// FIXME: currently we are sending in '-O2' when we want InlineMsgSend. Here we only check if we it is '-O...'.
|
||||
objjcFlags |= ObjJAcornCompiler.Flags.Compress;
|
||||
// FIXME: currently we are sending in '-O2' when we want InlineMsgSend. Here we only check if it is '-O...'.
|
||||
// Maybe we should have some other option for this
|
||||
if (argument.length > 2)
|
||||
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.InlineMsgSend;
|
||||
objjcFlags |= ObjJAcornCompiler.Flags.InlineMsgSend;
|
||||
}
|
||||
|
||||
else if (argument.indexOf("-G") === 0)
|
||||
objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.Generate;
|
||||
objjcFlags |= ObjJAcornCompiler.Flags.Generate;
|
||||
else if (argument.indexOf("-T") === 0)
|
||||
objjcFlags &= ~ObjJAcornCompiler.Flags.IncludeTypeSignatures;
|
||||
}
|
||||
|
||||
currentCompilerFlags = objjcFlags;
|
||||
@@ -533,13 +540,6 @@ exports.currentCompilerFlags = function(/*String*/ compilerFlags)
|
||||
return currentCompilerFlags;
|
||||
}
|
||||
|
||||
ObjJAcornCompiler.Flags = { };
|
||||
|
||||
ObjJAcornCompiler.Flags.IncludeDebugSymbols = 1 << 0;
|
||||
ObjJAcornCompiler.Flags.IncludeTypeSignatures = 1 << 1;
|
||||
ObjJAcornCompiler.Flags.Generate = 1 << 2;
|
||||
ObjJAcornCompiler.Flags.InlineMsgSend = 1 << 3;
|
||||
|
||||
ObjJAcornCompiler.prototype.addWarning = function(/* Warning */ aWarning)
|
||||
{
|
||||
this.warnings.push(aWarning);
|
||||
@@ -2325,7 +2325,7 @@ MethodDeclarationStatement: function(node, st, c) {
|
||||
compiler.jsBuffer.concat("Nil\n");
|
||||
}
|
||||
|
||||
if (compiler.flags & ObjJAcornCompiler.Flags.IncludeDebugSymbols)
|
||||
if (compiler.flags & ObjJAcornCompiler.Flags.IncludeTypeSignatures)
|
||||
compiler.jsBuffer.concat(","+JSON.stringify(types));
|
||||
|
||||
compiler.jsBuffer.concat(")");
|
||||
|
||||
Reference in new issue
Block a user