Added clean-functions option
This commit is contained in:
parent
a51c5d9e8b
commit
5de905e9e5
3 changed files with 17 additions and 1 deletions
|
@ -5,6 +5,11 @@ newoption {
|
|||
value = "PATH"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "clean-functions",
|
||||
description = "Compiles only used functions"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "clean-symbols",
|
||||
description = "Cleans up the symbol table from unused symbols"
|
||||
|
@ -40,6 +45,9 @@ workspace "ssc"
|
|||
links { "System", "arookas", "grammatica-1.6" }
|
||||
|
||||
-- apply options
|
||||
if _OPTIONS["clean-functions"] then
|
||||
defines { "SSC_CLEAN_FUNCTIONS" }
|
||||
end
|
||||
if _OPTIONS["clean-symbols"] then
|
||||
defines { "SSC_CLEAN_SYMBOLS" }
|
||||
end
|
||||
|
|
|
@ -68,6 +68,7 @@ There are also options which are able to be configured via the premake5 command
|
|||
|Option|Description|
|
||||
|------|-----------|
|
||||
|lib-dir|Sets the path to the dependencies. Defaults to the _lib/_ folder.|
|
||||
|clean-functions|Compiles only used functions.|
|
||||
|clean-symbols|Cleans symbol table of unused symbols.|
|
||||
|
||||
## Language
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace arookas {
|
||||
public class sunCompiler {
|
||||
|
@ -85,6 +84,7 @@ namespace arookas {
|
|||
}
|
||||
mBinary.WriteEND();
|
||||
}
|
||||
#if SSC_CLEAN_FUNCTIONS
|
||||
void CompileFunctions() {
|
||||
while (DoCompileFunctions() > 0) ;
|
||||
}
|
||||
|
@ -96,6 +96,13 @@ namespace arookas {
|
|||
}
|
||||
return count;
|
||||
}
|
||||
#else
|
||||
void CompileFunctions() {
|
||||
foreach (var callable in mContext.SymbolTable.Get<sunCallableSymbol>()) {
|
||||
callable.Compile(this);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if SSC_CLEAN_SYMBOLS
|
||||
void CleanSymbols() {
|
||||
var i = 0;
|
||||
|
|
Loading…
Reference in a new issue