pastojs: fixed compile on nodejs

git-svn-id: trunk@40352 -
This commit is contained in:
Mattias Gaertner 2018-11-18 17:42:39 +00:00
parent d9f915964a
commit ae67021c8c
3 changed files with 26 additions and 4 deletions

View File

@ -324,7 +324,7 @@ end;
procedure TBufferWriter.SetAsString(const AValue: TJSWriterString);
begin
{$ifdef pas2js}
FBuffer:=TJSArray.new;
SetLength(FBuffer,0);
FCapacity:=0;
{$endif}
FBufPos:=0;

View File

@ -22,9 +22,9 @@ uses
{$IFDEF Pas2js}
JS, NodeJSFS,
{$ELSE}
RtlConsts,
RtlConsts, process,
{$ENDIF}
Classes, SysUtils, contnrs, process,
Classes, SysUtils, contnrs,
jstree, jswriter, JSSrcMap,
PScanner, PParser, PasTree, PasResolver, PasUseAnalyzer, PasResolveEval,
FPPas2Js, FPPJsSrcMap, Pas2jsFileUtils, Pas2jsLogger,
@ -3338,10 +3338,10 @@ var
aProc, pr: TPasToJsProcessor;
Enable: Boolean;
aPlatform, pl: TPasToJsPlatform;
PostProc: TStringList;
{$IFDEF HasPas2jsFiler}
Found: Boolean;
PF: TPas2JSPrecompileFormat;
PostProc: TStringList;
{$ENDIF}
begin
//writeln('TPas2jsCompiler.ReadParam ',Param,' ',Quick,' ',FromCmdLine);
@ -4118,6 +4118,17 @@ end;
function TPas2jsCompiler.CallPostProcessor(const JSFilename: String;
Cmd: TStringList; JS: TJSWriterString): TJSWriterString;
{$IFDEF pas2js}
begin
Result:='';
if ShowUsedTools then
Log.LogMsgIgnoreFilter(nPostProcessorRunX,[QuoteStr(JSFilename)+' | '+CmdListAsStr(Cmd)]);
raise EFOpenError.Create('post processing is not yet implemented in platform nodejs');
if JSFilename='' then ;
if Cmd=nil then ;
if JS='' then ;
end;
{$ELSE}
const
BufSize = 65536;
var
@ -4240,6 +4251,7 @@ begin
if ShowUsedTools then
Log.LogMsgIgnoreFilter(nPostProcessorFinished,[]);
end;
{$ENDIF}
constructor TPas2jsCompiler.Create;
begin

View File

@ -152,6 +152,16 @@ begin
Result:=true;
end;
function FileIsExecutable(const AFilename: string): boolean;
begin
try
NJS_FS.accessSync(AFilename,X_OK);
except
exit(false);
end;
Result:=true;
end;
function GetEnvironmentVariableCountPJ: Integer;
begin
Result:=GetEnvironmentVariableCount;