|
@@ -129,6 +129,7 @@ type
|
|
coUseStrict,
|
|
coUseStrict,
|
|
coWriteDebugLog,
|
|
coWriteDebugLog,
|
|
coWriteMsgToStdErr,
|
|
coWriteMsgToStdErr,
|
|
|
|
+ coPrecompile, // create precompile file
|
|
// optimizations
|
|
// optimizations
|
|
coEnumValuesAsNumbers,
|
|
coEnumValuesAsNumbers,
|
|
coKeepNotUsedPrivates,
|
|
coKeepNotUsedPrivates,
|
|
@@ -180,6 +181,7 @@ const
|
|
'Use strict',
|
|
'Use strict',
|
|
'Write pas2jsdebug.log',
|
|
'Write pas2jsdebug.log',
|
|
'Write messages to StdErr',
|
|
'Write messages to StdErr',
|
|
|
|
+ 'Create precompiled units',
|
|
'Enum values as numbers',
|
|
'Enum values as numbers',
|
|
'Keep not used private declarations',
|
|
'Keep not used private declarations',
|
|
'Keep not used declarations (WPO)',
|
|
'Keep not used declarations (WPO)',
|
|
@@ -1309,7 +1311,6 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPas2jsCompilerFile.IsUnitReadFromPCU: Boolean;
|
|
function TPas2jsCompilerFile.IsUnitReadFromPCU: Boolean;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
Result:=Assigned(PCUSupport) and PCUSupport.HasReader;
|
|
Result:=Assigned(PCUSupport) and PCUSupport.HasReader;
|
|
end;
|
|
end;
|
|
@@ -1337,7 +1338,8 @@ begin
|
|
{$IFDEF ReallyVerbose}
|
|
{$IFDEF ReallyVerbose}
|
|
writeln('TPas2jsCompilerFile.ReaderFinished analyzed ',UnitFilename,' ScopeModule=',GetObjName(UseAnalyzer.ScopeModule));
|
|
writeln('TPas2jsCompilerFile.ReaderFinished analyzed ',UnitFilename,' ScopeModule=',GetObjName(UseAnalyzer.ScopeModule));
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
- if Assigned(PCUSupport) and Not PCUSupport.HasReader then
|
|
|
|
|
|
+ if Assigned(PCUSupport) and Not PCUSupport.HasReader
|
|
|
|
+ and (coPrecompile in Compiler.Options) then
|
|
PCUSupport.WritePCU;
|
|
PCUSupport.WritePCU;
|
|
except
|
|
except
|
|
on E: ECompilerTerminate do
|
|
on E: ECompilerTerminate do
|
|
@@ -2771,7 +2773,6 @@ end;
|
|
|
|
|
|
procedure TPas2JSConfigSupport.LoadConfig(Const aFileName: String);
|
|
procedure TPas2JSConfigSupport.LoadConfig(Const aFileName: String);
|
|
type
|
|
type
|
|
-
|
|
|
|
TSkip = (
|
|
TSkip = (
|
|
skipNone,
|
|
skipNone,
|
|
skipIf,
|
|
skipIf,
|
|
@@ -2982,17 +2983,14 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TPas2jsCompiler.HandleOptionPCUFormat(aValue: String);
|
|
procedure TPas2jsCompiler.HandleOptionPCUFormat(aValue: String);
|
|
-
|
|
|
|
begin
|
|
begin
|
|
- ParamFatal('No PCU support in this compiler for '+aValue);
|
|
|
|
|
|
+ ParamFatal('No support in this compiler for precompiled format '+aValue);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPas2jsCompiler.HandleOptionPaths(C: Char; aValue: String;
|
|
function TPas2jsCompiler.HandleOptionPaths(C: Char; aValue: String;
|
|
FromCmdLine: Boolean): Boolean;
|
|
FromCmdLine: Boolean): Boolean;
|
|
-
|
|
|
|
Var
|
|
Var
|
|
ErrorMsg: String;
|
|
ErrorMsg: String;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
case c of
|
|
case c of
|
|
@@ -3007,10 +3005,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPas2jsCompiler.HandleOptionOptimization(C: Char; aValue: String): Boolean;
|
|
function TPas2jsCompiler.HandleOptionOptimization(C: Char; aValue: String): Boolean;
|
|
-
|
|
|
|
Var
|
|
Var
|
|
Enable: Boolean;
|
|
Enable: Boolean;
|
|
-
|
|
|
|
begin
|
|
begin
|
|
Result:=True;
|
|
Result:=True;
|
|
case C of
|
|
case C of
|
|
@@ -4053,7 +4049,6 @@ begin
|
|
RaiseInternalError(20170504161340,'internal error: TPas2jsCompiler.Run FileCount>0');
|
|
RaiseInternalError(20170504161340,'internal error: TPas2jsCompiler.Run FileCount>0');
|
|
|
|
|
|
try
|
|
try
|
|
-
|
|
|
|
// set working directory, need by all relative filenames
|
|
// set working directory, need by all relative filenames
|
|
SetWorkingDir(aWorkingDir);
|
|
SetWorkingDir(aWorkingDir);
|
|
|
|
|