From e760b9bd797b425a1d026b9b4822712f33f3bbbd Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 7 Nov 2020 10:56:57 +0000 Subject: [PATCH] pastojs: fixed diable optimization using fpc syntax prepend No, issue 38045 --- compiler/packages/fcl-passrc/src/pscanner.pp | 6 ++++++ compiler/packages/pastojs/src/fppas2js.pp | 4 ++++ compiler/utils/pas2js/docs/translation.html | 1 + 3 files changed, 11 insertions(+) diff --git a/compiler/packages/fcl-passrc/src/pscanner.pp b/compiler/packages/fcl-passrc/src/pscanner.pp index 069c83d..97188fe 100644 --- a/compiler/packages/fcl-passrc/src/pscanner.pp +++ b/compiler/packages/fcl-passrc/src/pscanner.pp @@ -3424,6 +3424,12 @@ begin if p=StartP then Error(nWarnIllegalCompilerDirectiveX,sWarnIllegalCompilerDirectiveX,['optimization']); OptName:=copy(Param,StartP,p-StartP); + if lowercase(LeftStr(OptName,2))='no' then + begin + Delete(OptName,1,2); + DoHandleOptimization(OptName,'-'); + exit; + end; // skip whitespace while (p<=l) and (Param[p] in [' ',#9,#10,#13]) do inc(p); diff --git a/compiler/packages/pastojs/src/fppas2js.pp b/compiler/packages/pastojs/src/fppas2js.pp index 39a6a2c..22f2d2c 100644 --- a/compiler/packages/pastojs/src/fppas2js.pp +++ b/compiler/packages/pastojs/src/fppas2js.pp @@ -2943,6 +2943,10 @@ procedure TPas2jsPasScanner.DoHandleOptimization(OptName, OptValue: string); begin case lowercase(OptName) of + 'enumnumbers': + HandleBoolean(coEnumNumbers,true); + 'usestrict': + HandleBoolean(coUseStrict,true); 'jsshortrefglobals': HandleBoolean(coShortRefGlobals,true); else diff --git a/compiler/utils/pas2js/docs/translation.html b/compiler/utils/pas2js/docs/translation.html index b1fef9f..86cd339 100644 --- a/compiler/utils/pas2js/docs/translation.html +++ b/compiler/utils/pas2js/docs/translation.html @@ -3254,6 +3254,7 @@ end.
  • {$DispatchField Msg}: enable checking message number methods for record field name "Msg"
  • {$DispatchStrField MsgStr}: enable checking message string methods for record field name "Msg"
  • +
  • {$Optimization Name}: same as command line option -OoName
  • Defines: