Browse Source

pastojs: added experimental target os electron

git-svn-id: trunk@47445 -
Mattias Gaertner 4 years ago
parent
commit
bd3093e176

+ 4 - 2
packages/pastojs/src/fppas2js.pp

@@ -1053,13 +1053,15 @@ type
 type
   TPasToJsPlatform = (
     PlatformBrowser,
-    PlatformNodeJS
+    PlatformNodeJS,
+    PlatformElectron
     );
   TPasToJsPlatforms = set of TPasToJsPlatform;
 const
   PasToJsPlatformNames: array[TPasToJsPlatform] of string = (
    'Browser',
-   'NodeJS'
+   'NodeJS',
+   'Electron'
     );
 type
   TPasToJsProcessor = (

+ 2 - 0
packages/pastojs/src/pas2jscompiler.pp

@@ -4762,6 +4762,7 @@ begin
   w('  -T<x>  : Set target platform');
   w('    -Tbrowser: default');
   w('    -Tnodejs : add pas.run(), includes -Jc');
+  w('    -Telectron: experimental');
   w('  -u<x>  : Undefines the symbol <x>');
   w('  -v<x>  : Be verbose. <x> is a combination of the following letters:');
   w('    e    : Show errors (default)');
@@ -4941,6 +4942,7 @@ begin
   Log.LogPlain('Supported targets (targets marked with ''{*}'' are under development):');
   Log.LogPlain(['  ',PasToJsPlatformNames[PlatformBrowser],': webbrowser']);
   Log.LogPlain(['  ',PasToJsPlatformNames[PlatformNodeJS],': Node.js']);
+  Log.LogPlain(['  ',PasToJsPlatformNames[PlatformElectron],': Electron app']);
   Log.LogLn;
   Log.LogPlain('Supported CPU instruction sets:');
   Log.LogPlain('  ECMAScript5, ECMAScript6');

+ 3 - 1
packages/pastojs/src/pas2jsfiler.pp

@@ -262,7 +262,8 @@ const
   PCUDefaultTargetPlatform = PlatformBrowser;
   PCUTargetPlatformNames: array[TPasToJsPlatform] of string = (
     'Browser',
-    'NodeJS'
+    'NodeJS',
+    'Electron'
     );
 
   PCUDefaultTargetProcessor = ProcessorECMAScript5;
@@ -3970,6 +3971,7 @@ var
   Templ: TPasGenericTemplateType;
   TemplObj: TJSONObject;
 begin
+  if Parent=nil then ;
   if (GenericTemplateTypes=nil) or (GenericTemplateTypes.Count=0) then exit;
   Arr:=TJSONArray.Create;
   Obj.Add('GenericTemplateTypes',Arr);