mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 08:30:54 +02:00
pas2js: added option -JoUseStrict
git-svn-id: trunk@38793 -
This commit is contained in:
parent
2945f4a3c9
commit
0601b437a4
@ -312,9 +312,9 @@ Works:
|
||||
- COM: property in class, property in interface
|
||||
- COM: with interface do
|
||||
- COM: for interface in ... do
|
||||
- COM: pass IntfVar to untyped parameter
|
||||
|
||||
ToDos:
|
||||
- replace let in rtl.js
|
||||
- option to disable use strict
|
||||
- for i in jsvalue do
|
||||
- for i in tjsobject do
|
||||
|
@ -101,11 +101,12 @@ type
|
||||
coKeepNotUsedDeclarationsWPO,
|
||||
coSourceMapCreate,
|
||||
coSourceMapInclude,
|
||||
coSourceMapXSSIHeader
|
||||
coSourceMapXSSIHeader,
|
||||
coUseStrict
|
||||
);
|
||||
TP2jsCompilerOptions = set of TP2jsCompilerOption;
|
||||
const
|
||||
DefaultP2jsCompilerOptions = [coShowErrors,coSourceMapXSSIHeader];
|
||||
DefaultP2jsCompilerOptions = [coShowErrors,coSourceMapXSSIHeader,coUseStrict];
|
||||
coShowAll = [coShowErrors..coShowUsedTools];
|
||||
coO1Enable = [coEnumValuesAsNumbers];
|
||||
coO1Disable = [coKeepNotUsedPrivates,coKeepNotUsedDeclarationsWPO];
|
||||
@ -136,7 +137,8 @@ const
|
||||
'Keep not used declarations (WPO)',
|
||||
'Create source map',
|
||||
'Include Pascal sources in source map',
|
||||
'Prepend XSSI protection )]} to source map'
|
||||
'Prepend XSSI protection )]} to source map',
|
||||
'Use strict'
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -786,9 +788,16 @@ end;
|
||||
function TPas2jsCompilerFile.
|
||||
GetInitialConverterOptions: TPasToJsConverterOptions;
|
||||
begin
|
||||
Result:=DefaultPasToJSOptions+[coUseStrict];
|
||||
Result:=DefaultPasToJSOptions;
|
||||
|
||||
if coUseStrict in Compiler.Options then
|
||||
Include(Result,fppas2js.coUseStrict)
|
||||
else
|
||||
Exclude(Result,fppas2js.coUseStrict);
|
||||
|
||||
if coEnumValuesAsNumbers in Compiler.Options then
|
||||
Include(Result,fppas2js.coEnumNumbers);
|
||||
|
||||
if coLowerCase in Compiler.Options then
|
||||
Include(Result,fppas2js.coLowerCase)
|
||||
else
|
||||
@ -3154,8 +3163,10 @@ begin
|
||||
Enable:=c='+';
|
||||
Delete(Identifier,length(Identifier),1);
|
||||
end;
|
||||
if CompareText(Identifier,'SearchLikeFPC')=0 then
|
||||
if SameText(Identifier,'SearchLikeFPC') then
|
||||
FileCache.SearchLikeFPC:=Enable
|
||||
else if SameText(Identifier,'UseStrict') then
|
||||
SetOption(coUseStrict,Enable)
|
||||
else
|
||||
UnknownParam;
|
||||
end;
|
||||
@ -3874,6 +3885,7 @@ begin
|
||||
l(' -Jm- : disable generating source maps');
|
||||
l(' -Jo<x> : Enable or disable extra option. The x is case insensitive:');
|
||||
l(' -JoSearchLikeFPC : search source files like FPC, default: search case insensitive.');
|
||||
l(' -JoUseStrict : add "use strict" to modules, default.');
|
||||
l(' -Ju<x> : Add <x> to foreign unit paths. Foreign units are not compiled.');
|
||||
if PrecompileFormats.Count>0 then
|
||||
begin
|
||||
|
1
utils/pas2js/dist/rtl.js
vendored
1
utils/pas2js/dist/rtl.js
vendored
@ -470,7 +470,6 @@ var rtl = {
|
||||
},
|
||||
|
||||
addIntf: function (aclass, intf, map){
|
||||
'use strict';
|
||||
function jmp(fn){
|
||||
if (typeof(fn)==="function"){
|
||||
return function(){ return fn.apply(this.$o,arguments); };
|
||||
|
@ -155,6 +155,7 @@ Put + after a boolean switch option to enable it, - to disable it
|
||||
-Jm- : disable generating source maps
|
||||
-Jo<x> : Enable or disable extra option. The x is case insensitive:
|
||||
-JoSearchLikeFPC : search source files like FPC, default: search case insensitive.
|
||||
-JoUseStrict : add "use strict" to modules, default.
|
||||
-Ju<x> : Add <x> to foreign unit paths. Foreign units are not compiled.
|
||||
-l : Write logo
|
||||
-MDelphi: Delphi 7 compatibility mode
|
||||
|
Loading…
Reference in New Issue
Block a user