| | | |
Offset 33859, 204 lines modified | Offset 33859, 197 lines modified |
| |
33859 | var·errors·=·{}; | 33859 | var·errors·=·{}; |
| |
33860 | var·codegen·=·{}; | 33860 | var·codegen·=·{}; |
| |
33861 | var·code$1·=·{}; | 33861 | var·code$1·=·{}; |
| |
33862 | var·hasRequiredCode$1; | |
| |
33863 | function·requireCode$1()·{ | |
33864 | ····if·(hasRequiredCode$1)·return·code$1; | |
33865 | ····hasRequiredCode$1·=·1; | |
33866 | ····(function(exports)·{ | 33862 | (function(exports)·{ |
33867 | ········Object.defineProperty(exports,·"__esModule",·{ | 33863 | ····Object.defineProperty(exports,·"__esModule",·{ |
33868 | ············value:·true | 33864 | ········value:·true |
33869 | ········}); | 33865 | ····}); |
33870 | ········exports.regexpCode·=·exports.getEsmExportName·=·exports.getProperty·=·exports.safeStringify·=·exports.stringify·=·exports.strConcat·=·exports.addCodeArg·=·exports.str·=·exports._·=·exports.nil·=·exports._Code·=·exports.Name·=·exports.IDENTIFIER·=·exports._CodeOrName·=·void·0; | 33866 | ····exports.regexpCode·=·exports.getEsmExportName·=·exports.getProperty·=·exports.safeStringify·=·exports.stringify·=·exports.strConcat·=·exports.addCodeArg·=·exports.str·=·exports._·=·exports.nil·=·exports._Code·=·exports.Name·=·exports.IDENTIFIER·=·exports._CodeOrName·=·void·0; |
33871 | ········class·_CodeOrName·{} | 33867 | ····class·_CodeOrName·{} |
33872 | ········exports._CodeOrName·=·_CodeOrName; | 33868 | ····exports._CodeOrName·=·_CodeOrName; |
33873 | ········exports.IDENTIFIER·=·/^[a-z$_][a-z$_0-9]*$/i; | 33869 | ····exports.IDENTIFIER·=·/^[a-z$_][a-z$_0-9]*$/i; |
33874 | ········class·Name·extends·_CodeOrName·{ | 33870 | ····class·Name·extends·_CodeOrName·{ |
33875 | ············constructor(s)·{ | 33871 | ········constructor(s)·{ |
33876 | ················super(); | 33872 | ············super(); |
33877 | ················if·(!exports.IDENTIFIER.test(s)) | 33873 | ············if·(!exports.IDENTIFIER.test(s)) |
33878 | ····················throw·new·Error("CodeGen:·name·must·be·a·valid·identifier"); | 33874 | ················throw·new·Error("CodeGen:·name·must·be·a·valid·identifier"); |
33879 | ················this.str·=·s; | 33875 | ············this.str·=·s; |
| 33876 | ········} |
| 33877 | ········toString()·{ |
| 33878 | ············return·this.str; |
| 33879 | ········} |
| 33880 | ········emptyStr()·{ |
| 33881 | ············return·false; |
| 33882 | ········} |
| 33883 | ········get·names()·{ |
| 33884 | ············return·{ |
| 33885 | ················[this.str]:·1 |
33880 | ············} | 33886 | ············}; |
| 33887 | ········} |
| 33888 | ····} |
| 33889 | ····exports.Name·=·Name; |
| 33890 | ····class·_Code·extends·_CodeOrName·{ |
| 33891 | ········constructor(code)·{ |
| 33892 | ············super(); |
| 33893 | ············this._items·=·typeof·code·===·"string"·?·[code]·:·code; |
| 33894 | ········} |
33881 | ············toString()·{ | 33895 | ········toString()·{ |
33882 | ················return·this.str; | 33896 | ············return·this.str; |
33883 | ············} | 33897 | ········} |
33884 | ············emptyStr()·{ | 33898 | ········emptyStr()·{ |
| 33899 | ············if·(this._items.length·>·1) |
33885 | ················return·false; | 33900 | ················return·false; |
| 33901 | ············const·item·=·this._items[0]; |
| 33902 | ············return·item·===·""·||·item·===·'""'; |
33886 | ············} | |
33887 | ············get·names()·{ | |
33888 | ················return·{ | |
33889 | ····················[this.str]:·1 | |
33890 | ················}; | |
33891 | ············} | |
33892 | ········} | 33903 | ········} |
33893 | ········exports.Name·=·Name; | |
33894 | ········class·_Code·extends·_CodeOrName·{ | |
33895 | ············constructor(code)·{ | |
33896 | ················super(); | |
33897 | ················this._items·=·typeof·code·===·"string"·?·[code]·:·code; | |
33898 | ············} | |
33899 | ············toString()·{ | |
33900 | ················return·this.str; | |
33901 | ············} | |
33902 | ············emptyStr()·{ | |
33903 | ················if·(this._items.length·>·1) | |
33904 | ····················return·false; | |
33905 | ················const·item·=·this._items[0]; | |
33906 | ················return·item·===·""·||·item·===·'""'; | |
33907 | ············} | |
33908 | ············get·str()·{ | 33904 | ········get·str()·{ |
33909 | ················var·_a; | 33905 | ············var·_a; |
33910 | ················return·((_a·=·this._str)·!==·null·&&·_a·!==·void·0·?·_a·:·(this._str·=·this._items.reduce((s,·c)·=>·`${s}${c}`,·""))); | 33906 | ············return·((_a·=·this._str)·!==·null·&&·_a·!==·void·0·?·_a·:·(this._str·=·this._items.reduce((s,·c)·=>·`${s}${c}`,·""))); |
33911 | ············} | |
33912 | ············get·names()·{ | |
33913 | ················var·_a; | |
33914 | ················return·((_a·=·this._names)·!==·null·&&·_a·!==·void·0·?·_a·:·(this._names·=·this._items.reduce((names,·c)·=>·{ | |
33915 | ····················if·(c·instanceof·Name) | |
33916 | ························names[c.str]·=·(names[c.str]·||·0)·+·1; | |
33917 | ····················return·names; | |
33918 | ················},·{}))); | |
33919 | ············} | |
33920 | ········} | 33907 | ········} |
| 33908 | ········get·names()·{ |
| 33909 | ············var·_a; |
| 33910 | ············return·((_a·=·this._names)·!==·null·&&·_a·!==·void·0·?·_a·:·(this._names·=·this._items.reduce((names,·c)·=>·{ |
| 33911 | ················if·(c·instanceof·Name) |
| 33912 | ····················names[c.str]·=·(names[c.str]·||·0)·+·1; |
| 33913 | ················return·names; |
| 33914 | ············},·{}))); |
| 33915 | ········} |
| 33916 | ····} |
33921 | ········exports._Code·=·_Code; | 33917 | ····exports._Code·=·_Code; |
33922 | ········exports.nil·=·new·_Code(""); | 33918 | ····exports.nil·=·new·_Code(""); |
| |
33923 | ········function·_(strs,·...args)·{ | 33919 | ····function·_(strs,·...args)·{ |
33924 | ············const·code·=·[strs[0]]; | 33920 | ········const·code·=·[strs[0]]; |
33925 | ············let·i·=·0; | 33921 | ········let·i·=·0; |
33926 | ············while·(i·<·args.length)·{ | 33922 | ········while·(i·<·args.length)·{ |
33927 | ················addCodeArg(code,·args[i]); | 33923 | ············addCodeArg(code,·args[i]); |
33928 | ················code.push(strs[++i]); | 33924 | ············code.push(strs[++i]); |
33929 | ············} | |
33930 | ············return·new·_Code(code); | |
33931 | ········} | 33925 | ········} |
| 33926 | ········return·new·_Code(code); |
| 33927 | ····} |
33932 | ········exports._·=·_; | 33928 | ····exports._·=·_; |
33933 | ········const·plus·=·new·_Code("+"); | 33929 | ····const·plus·=·new·_Code("+"); |
| |
33934 | ········function·str(strs,·...args)·{ | 33930 | ····function·str(strs,·...args)·{ |
33935 | ············const·expr·=·[safeStringify(strs[0])]; | 33931 | ········const·expr·=·[safeStringify(strs[0])]; |
33936 | ············let·i·=·0; | 33932 | ········let·i·=·0; |
33937 | ············while·(i·<·args.length)·{ | 33933 | ········while·(i·<·args.length)·{ |
33938 | ················expr.push(plus); | 33934 | ············expr.push(plus); |
33939 | ················addCodeArg(expr,·args[i]); | 33935 | ············addCodeArg(expr,·args[i]); |
33940 | ················expr.push(plus,·safeStringify(strs[++i])); | 33936 | ············expr.push(plus,·safeStringify(strs[++i])); |
33941 | ············} | |
33942 | ············optimize(expr); | |
33943 | ············return·new·_Code(expr); | |
33944 | ········} | 33937 | ········} |
| 33938 | ········optimize(expr); |
| 33939 | ········return·new·_Code(expr); |
Max diff block lines reached; 6814/14058 bytes (48.47%) of diff not shown.
|