Sfoglia il codice sorgente

pastojs: fixed diable optimization using fpc syntax prepend No, issue 38045

mattias 4 anni fa
parent
commit
e760b9bd79

+ 6 - 0
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);

+ 4 - 0
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

+ 1 - 0
compiler/utils/pas2js/docs/translation.html

@@ -3254,6 +3254,7 @@ end.
     </li>
     <li>{$DispatchField Msg}: enable checking <i>message number</i> methods for record field name "Msg"</li>
     <li>{$DispatchStrField MsgStr}: enable checking <i>message string</i> methods for record field name "Msg"</li>
+    <li>{$Optimization Name}: same as command line option -OoName</li>
     </ul>
     Defines:
     <ul>