|
@@ -387,6 +387,7 @@ type
|
|
function ReadContinue: boolean; // true=finished
|
|
function ReadContinue: boolean; // true=finished
|
|
function ReaderState: TPas2jsReaderState;
|
|
function ReaderState: TPas2jsReaderState;
|
|
procedure CreateJS;
|
|
procedure CreateJS;
|
|
|
|
+ procedure EmitModuleHints;
|
|
function GetPasFirstSection: TPasSection;
|
|
function GetPasFirstSection: TPasSection;
|
|
function GetPasImplSection: TPasSection;
|
|
function GetPasImplSection: TPasSection;
|
|
function GetPasMainUsesClause: TPasUsesClause;
|
|
function GetPasMainUsesClause: TPasUsesClause;
|
|
@@ -1479,13 +1480,6 @@ procedure TPas2jsCompilerFile.CreateJS;
|
|
begin
|
|
begin
|
|
//writeln('TPas2jsCompilerFile.CreateJS START ',UnitFilename,' JS=',GetObjName(FJSModule));
|
|
//writeln('TPas2jsCompilerFile.CreateJS START ',UnitFilename,' JS=',GetObjName(FJSModule));
|
|
try
|
|
try
|
|
- // show hints only for units that are actually converted
|
|
|
|
- if (PCUSupport=nil) or not PCUSupport.HasReader then
|
|
|
|
- begin
|
|
|
|
- //writeln('TPas2jsCompilerFile.CreateJS ',UnitFilename);
|
|
|
|
- UseAnalyzer.EmitModuleHints(PasModule);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
// convert
|
|
// convert
|
|
CreateConverter;
|
|
CreateConverter;
|
|
Converter.OnIsElementUsed:=@OnConverterIsElementUsed;
|
|
Converter.OnIsElementUsed:=@OnConverterIsElementUsed;
|
|
@@ -1505,6 +1499,27 @@ begin
|
|
//writeln('TPas2jsCompilerFile.CreateJS END ',UnitFilename,' JS=',GetObjName(FJSModule));
|
|
//writeln('TPas2jsCompilerFile.CreateJS END ',UnitFilename,' JS=',GetObjName(FJSModule));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TPas2jsCompilerFile.EmitModuleHints;
|
|
|
|
+begin
|
|
|
|
+ try
|
|
|
|
+ // show hints only for units with sources
|
|
|
|
+ if (PCUSupport=nil) or not PCUSupport.HasReader then
|
|
|
|
+ begin
|
|
|
|
+ //writeln('TPas2jsCompilerFile.EmitModuleHints ',UnitFilename);
|
|
|
|
+ UseAnalyzer.EmitModuleHints(PasModule);
|
|
|
|
+ end;
|
|
|
|
+ except
|
|
|
|
+ on E: ECompilerTerminate do
|
|
|
|
+ raise;
|
|
|
|
+ on E: Exception do
|
|
|
|
+ HandleException(E);
|
|
|
|
+ {$IFDEF pas2js}
|
|
|
|
+ else
|
|
|
|
+ HandleJSException('[20190226183324] TPas2jsCompilerFile.EmitModuleHints File="'+UnitFilename+'"',
|
|
|
|
+ JSExceptValue);
|
|
|
|
+ {$ENDIF}
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
|
|
function TPas2jsCompilerFile.GetPasFirstSection: TPasSection;
|
|
function TPas2jsCompilerFile.GetPasFirstSection: TPasSection;
|
|
var
|
|
var
|
|
@@ -1971,11 +1986,17 @@ procedure TPas2jsCompiler.CreateJavaScript(aFile: TPas2jsCompilerFile;
|
|
|
|
|
|
begin
|
|
begin
|
|
//writeln('TPas2jsCompiler.CreateJavaScript ',aFile.UnitFilename,' JS=',GetObjName(aFile.JSModule),' Need=',aFile.NeedBuild);
|
|
//writeln('TPas2jsCompiler.CreateJavaScript ',aFile.UnitFilename,' JS=',GetObjName(aFile.JSModule),' Need=',aFile.NeedBuild);
|
|
- if (aFile.JSModule<>nil) or (not aFile.NeedBuild) then exit;
|
|
|
|
|
|
+ if aFile.JSModule<>nil then exit; // already created
|
|
|
|
+
|
|
// check each file only once
|
|
// check each file only once
|
|
if Checked.ContainsItem(aFile) then exit;
|
|
if Checked.ContainsItem(aFile) then exit;
|
|
Checked.Add(aFile);
|
|
Checked.Add(aFile);
|
|
|
|
|
|
|
|
+ // emit module hints
|
|
|
|
+ aFile.EmitModuleHints;
|
|
|
|
+
|
|
|
|
+ if not aFile.NeedBuild then exit;
|
|
|
|
+
|
|
Log.LogMsg(nCompilingFile,[FullFormatPath(aFile.UnitFilename)],'',0,0,
|
|
Log.LogMsg(nCompilingFile,[FullFormatPath(aFile.UnitFilename)],'',0,0,
|
|
not (coShowLineNumbers in Options));
|
|
not (coShowLineNumbers in Options));
|
|
|
|
|