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