From 6b2fb0f806d518d3915a9a4e8d2b630a1f8f3f0c Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 10 Nov 2020 21:33:10 +0000 Subject: [PATCH] * Merge -Jrnone skips resources --- compiler/packages/fcl-passrc/src/pscanner.pp | 6 ++++-- compiler/packages/pastojs/src/pas2jscompiler.pp | 8 +++++--- compiler/packages/pastojs/src/pas2jsfiler.pp | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/compiler/packages/fcl-passrc/src/pscanner.pp b/compiler/packages/fcl-passrc/src/pscanner.pp index 97188fe..e501501 100644 --- a/compiler/packages/fcl-passrc/src/pscanner.pp +++ b/compiler/packages/fcl-passrc/src/pscanner.pp @@ -656,7 +656,8 @@ type po_ExtConstWithoutExpr, // allow typed const without expression in external class and with external modifier po_StopOnUnitInterface, // parse only a unit name and stop at interface keyword po_IgnoreUnknownResource,// Ignore resources for which no handler is registered. - po_AsyncProcs // allow async procedure modifier + po_AsyncProcs, // allow async procedure modifier + po_DisableResources // Disable resources altogether ); TPOptions = set of TPOption; @@ -4087,7 +4088,8 @@ begin 'POINTERMATH': DoBoolDirective(bsPointerMath); 'R' : - HandleResource(Param); + if not (po_DisableResources in Options) then + HandleResource(Param); 'RANGECHECKS': DoBoolDirective(bsRangeChecks); 'SCOPEDENUMS': diff --git a/compiler/packages/pastojs/src/pas2jscompiler.pp b/compiler/packages/pastojs/src/pas2jscompiler.pp index 71d0e83..0d1b352 100644 --- a/compiler/packages/pastojs/src/pas2jscompiler.pp +++ b/compiler/packages/pastojs/src/pas2jscompiler.pp @@ -154,7 +154,7 @@ type rvcUnit ); TP2JSResourceStringFile = (rsfNone,rsfUnit,rsfProgram); - TResourceMode = (rmNone,rmHTML,rmJS); + TResourceMode = (Skip,rmNone,rmHTML,rmJS); const DefaultP2jsCompilerOptions = [coShowErrors,coWriteableConst,coUseStrict,coSourceMapXSSIHeader]; @@ -1101,6 +1101,8 @@ begin Scanner.CurrentValueSwitch[vsInterfaces]:=InterfaceTypeNames[Compiler.InterfaceType]; if coAllowCAssignments in Compiler.Options then Scanner.Options:=Scanner.Options+[po_cassignments]; + if Compiler.ResourceMode=rmNone then + Scanner.Options:= Scanner.Options+[po_DisableResources]; // Note: some Scanner.Options are set by TPasResolver for i:=0 to Compiler.Defines.Count-1 do begin @@ -4717,8 +4719,8 @@ begin w(' -Jrnone: Do not write resource string file'); w(' -Jrunit: Write resource string file per unit with all resource strings'); w(' -Jrprogram: Write resource string file per program with all used resource strings in program'); - w(' -Jr Control writing of linked resources'); - w(' -JRnone: Do not write resources'); + w(' -JR Control writing of linked resources'); + w(' -JRnone: Skip resource directives'); w(' -JRjs: Write resources in Javascript structure'); w(' -JRhtml[=filename] : Write resources as preload links in HTML file (default is projectfile-res.html)'); w(' -Jpcmd: Run postprocessor. For each generated js execute command passing the js as stdin and read the new js from stdout. This option can be added multiple times to call several postprocessors in succession.'); diff --git a/compiler/packages/pastojs/src/pas2jsfiler.pp b/compiler/packages/pastojs/src/pas2jsfiler.pp index 03fd001..a0253e8 100644 --- a/compiler/packages/pastojs/src/pas2jsfiler.pp +++ b/compiler/packages/pastojs/src/pas2jsfiler.pp @@ -134,7 +134,8 @@ const 'ExtClassConstWithoutExpr', 'StopOnUnitInterface', 'IgnoreUnknownResource', - 'AsyncProcs'); + 'AsyncProcs', + 'DisableResources'); PCUDefaultModeSwitches: TModeSwitches = [ msObjfpc,