diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..1b5cc9d0e7 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +dist/ +docs/ +lib/parse/index.js +out/ +raw/ +tests/parser/ diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..8dc670e2d4 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,252 @@ +module.exports = { + root: true, + parser: "@typescript-eslint/parser", + plugins: [ + "@typescript-eslint", + ], + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + ], + parserOptions: { + ecmaVersion: 2020, + sourceType: "module", + ecmaFeatures: {} + }, + globals: { + "BigInt64Array": "readonly", + "BigUint64Array": "readonly" + }, + + // === General rules ========================================================= + + rules: { + // Omitted semicolons are hugely popular, yet within the compiler it makes + // sense to be better safe than sorry. + "semi": "error", + + // Our code bases uses 2 spaces for indentation, and we enforce it here so + // files don't mix spaces, tabs or different indentation levels. + "indent": ["error", 2, { + "SwitchCase": 1, + "VariableDeclarator": "first", + "offsetTernaryExpressions": true, + "ignoredNodes": [ // FIXME: something's odd here + "ConditionalExpression > *", + "ConditionalExpression > * > *", + "ConditionalExpression > * > * > *" + ] + }], + + // This is mostly visual style, making comments look uniform. + "spaced-comment": ["error", "always", { + "markers": ["/"], // triple-slash + "exceptions": ["/"] // all slashes + }], + + // This tends to be annoying as it encourages developers to make everything + // that is never reassigned a 'const', sometimes semantically incorrect so, + // typically leading to huge diffs in follow-up PRs modifying affected code. + "prefer-const": "off", + + // It is perfectly fine to declare top-level variables with `var`, yet this + // rule doesn't provide configuration options that would help. + "no-var": "off", + + // Quite often, dealing with multiple related cases at once or otherwise + // falling through is exactly the point of using a switch. + "no-fallthrough": "off", + + // Typical false-positives here are `do { ... } while (true)` statements or + // similar, but the only option provided here is not checking any loops. + "no-constant-condition": ["error", { checkLoops: false }], + + // Functions are nested in blocks occasionally, and there haven't been any + // problems with this so far, so turning the check off. + "no-inner-declarations": "off", + + // Quite common in scenarios where an iteration starts at `current = this`. + "@typescript-eslint/no-this-alias": "off", + + // Disabled here, but enabled again for JavaScript files + "no-unused-vars": "off", + + // Disabled here, but enabled again for TypeScript files + "@typescript-eslint/no-unused-vars": "off" + }, + overrides: [ + + // === JavaScript rules ==================================================== + + { + env: { + "browser": true, + "amd": true, + "node": true, + "es6": true + }, + files: [ + "**/*.js" + ], + rules: { + // Node's support for ESM is still not great, but this rule is likely + // to become activated once compatibility doesn't suck anymore. + "@typescript-eslint/no-var-requires": "off", + + // Enforcing to remove function parameters on stubs makes code less + // maintainable, so we instead allow unused function parameters. + "no-unused-vars": [ + "warn", { + "vars": "local", + "args": "none", + "ignoreRestSiblings": false + } + ] + } + }, + + // === TypeScript rules ==================================================== + + { + files: [ + "**/*.ts" + ], + rules: { + // Enforcing to remove function parameters on stubs makes code less + // maintainable, so we instead allow unused function parameters. + "@typescript-eslint/no-unused-vars": [ + "warn", { + "vars": "local", + "args": "none", + "ignoreRestSiblings": false + } + ] + } + }, + + // === AssemblyScript rules (extends TypeScript rules) ===================== + + { + files: [ + "**/assembly/**/*.ts", + "src/**/*.ts", + "lib/parse/src/**/*.ts" + ], + rules: { + // Namespaces are quite useful in AssemblyScript + "@typescript-eslint/no-namespace": "off", + + // There is actually codegen difference here + "@typescript-eslint/no-array-constructor": "off", + + // Sometimes it can't be avoided to add a @ts-ignore + "@typescript-eslint/ban-ts-comment": "off", + + // Utilized to achieve portability in some cases + "@typescript-eslint/no-non-null-assertion": "off", + } + }, + + // === Compiler rules (extends AssemblyScript rules) ======================= + + { + files: [ + "src/**/*.ts", + "std/assembly/**/*.ts" + ], + rules: { + // There is an actual codegen difference here - TODO: revisit + "no-cond-assign": "off", + + // Not all types can be omitted in AS yet - TODO: revisit + "@typescript-eslint/no-inferrable-types": "off", + + // Used rarely to reference internals that are not user-visible + "@typescript-eslint/triple-slash-reference": "off", + + // The compiler has its own `Function` class for example + "no-shadow-restricted-names": "off", + "@typescript-eslint/ban-types": "off" + } + }, + + // === Standard Library rules (extends AssemblyScript rules) =============== + + { + files: [ + "std/assembly/**/*.ts" + ], + rules: { + // We are implementing with --noLib, so we shadow all the time + "no-shadow-restricted-names": "off", + + // Similarly, sometimes we need the return type to be String, not string + "@typescript-eslint/ban-types": "off" + } + }, + + // === Standard Definition rules (extends TypeScript rules) ================ + + { + files: [ + "std/**/*.d.ts" + ], + rules: { + // Often required to achieve compatibility with TypeScript + "@typescript-eslint/no-explicit-any": "off", + + // Interfaces can be stubs here, i.e. not yet fully implemented + "@typescript-eslint/no-empty-interface": "off", + + // Definitions make use of `object` to model rather unusual constraints + "@typescript-eslint/ban-types": "off" + } + }, + + // === Compiler Definition rules (extends TypeScript rules) ================ + + { + files: [ + "./index.d.ts", + "./index.release.d.ts", + ], + rules: { + // Our definitions are complicated, and all attempts to describe them + // as modules have failed so far. As such, we re-export namespaces. + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/triple-slash-reference": "off" + } + }, + + // === Test rules (extends TypeScript rules) =============================== + + { + files: [ + "./tests/compiler/**/*.ts", + "./lib/loader/tests/assembly/**/*.ts" + ], + rules: { + // Tests typically include unusual code patterns on purpose. This is + // very likely not an extensive list, but covers what's there so far. + "no-empty": "off", + "no-cond-assign": "off", + "no-compare-neg-zero": "off", + "no-inner-declarations": "off", + "no-constant-condition": "off", + "use-isnan": "off", + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-extra-semi": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/triple-slash-reference": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-extra-non-null-assertion": "off", + "@typescript-eslint/no-empty-interface": "off" + } + }, + ] +}; diff --git a/cli/asc.d.ts b/cli/asc.d.ts index 75be4c0178..3244b4e80b 100644 --- a/cli/asc.d.ts +++ b/cli/asc.d.ts @@ -176,7 +176,7 @@ export function main(argv: string[], options: APIOptions, callback?: (err: Error export function main(argv: string[], callback?: (err: Error | null) => number): number; /** Checks diagnostics emitted so far for errors. */ -export function checkDiagnostics(emitter: any, stderr?: OutputStream): boolean; +export function checkDiagnostics(emitter: Record, stderr?: OutputStream): boolean; /** An object of stats for the current task. */ export interface Stats { @@ -200,7 +200,7 @@ export interface Stats { export function createStats(): Stats; /** Measures the execution time of the specified function. */ -export function measure(fn: Function): number; +export function measure(fn: () => void): number; /** Formats a high resolution time to a human readable string. */ export function formatTime(time: number): string; @@ -212,4 +212,4 @@ export function printStats(stats: Stats, output: OutputStream): void; export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): MemoryStream; /** Compatible TypeScript compiler options for syntax highlighting etc. */ -export const tscOptions: { [key: string]: any }; +export const tscOptions: Record; diff --git a/cli/asc.js b/cli/asc.js index 8825061460..5a6a22dd7d 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -28,6 +28,8 @@ * in the build step. See dist/asc.js for the bundle and webpack.config.js for building details. */ +/* global BUNDLE_VERSION, BUNDLE_LIBRARY, BUNDLE_DEFINITIONS */ + // Use "." instead of "/" as cwd in browsers if (process.browser) process.cwd = function() { return "."; }; @@ -77,7 +79,7 @@ var isDev = false; return eval("require")(...args); } try { // `asc` on the command line - assemblyscript = dynRequire("../dist/assemblyscript.js"); + assemblyscript = dynRequire("../dist/assemblyscript.js"); } catch (e) { try { // `asc` on the command line without dist files dynRequire("ts-node").register({ @@ -124,8 +126,9 @@ exports.defaultShrinkLevel = 1; exports.libraryFiles = exports.isBundle ? BUNDLE_LIBRARY : (() => { // set up if not a bundle const libDir = path.join(__dirname, "..", "std", "assembly"); const bundled = {}; - find.files(libDir, defaultExtension.re_except_d) - .forEach(file => bundled[file.replace(defaultExtension.re, "")] = fs.readFileSync(path.join(libDir, file), "utf8" )); + find + .files(libDir, defaultExtension.re_except_d) + .forEach(file => bundled[file.replace(defaultExtension.re, "")] = fs.readFileSync(path.join(libDir, file), "utf8" )); return bundled; })(); @@ -162,12 +165,12 @@ exports.compileString = (sources, options) => { exports.main(argv.concat(Object.keys(sources)), { stdout: output.stdout, stderr: output.stderr, - readFile: name => sources.hasOwnProperty(name) ? sources[name] : null, + readFile: name => Object.prototype.hasOwnProperty.call(sources, name) ? sources[name] : null, writeFile: (name, contents) => output[name] = contents, listFiles: () => [] }); return output; -} +}; /** Runs the command line utility using the specified arguments array. */ exports.main = function main(argv, options, callback) { @@ -307,7 +310,7 @@ exports.main = function main(argv, options, callback) { if (typeof features === "string") features = features.split(","); for (let i = 0, k = features.length; i < k; ++i) { let name = features[i].trim(); - let flag = assemblyscript["FEATURE_" + name.replace(/\-/g, "_").toUpperCase()]; + let flag = assemblyscript["FEATURE_" + name.replace(/-/g, "_").toUpperCase()]; if (!flag) return callback(Error("Feature '" + name + "' is unknown.")); assemblyscript.disableFeature(compilerOptions, flag); } @@ -318,7 +321,7 @@ exports.main = function main(argv, options, callback) { if (typeof features === "string") features = features.split(","); for (let i = 0, k = features.length; i < k; ++i) { let name = features[i].trim(); - let flag = assemblyscript["FEATURE_" + name.replace(/\-/g, "_").toUpperCase()]; + let flag = assemblyscript["FEATURE_" + name.replace(/-/g, "_").toUpperCase()]; if (!flag) return callback(Error("Feature '" + name + "' is unknown.")); assemblyscript.enableFeature(compilerOptions, flag); } @@ -451,10 +454,10 @@ exports.main = function main(argv, options, callback) { } else { const plainName = internalPath.substring(libraryPrefix.length); const indexName = plainName + "/index"; - if (libraryFiles.hasOwnProperty(plainName)) { + if (Object.prototype.hasOwnProperty.call(libraryFiles, plainName)) { sourceText = libraryFiles[plainName]; sourcePath = libraryPrefix + plainName + extension.ext; - } else if (libraryFiles.hasOwnProperty(indexName)) { + } else if (Object.prototype.hasOwnProperty.call(libraryFiles, indexName)) { sourceText = libraryFiles[indexName]; sourcePath = libraryPrefix + indexName + extension.ext; } else { // custom lib dirs @@ -470,7 +473,7 @@ exports.main = function main(argv, options, callback) { } } if (sourceText == null) { // paths - const match = internalPath.match(/^~lib\/((?:@[^\/]+\/)?[^\/]+)(?:\/(.+))?/); // ~lib/(pkg)/(path), ~lib/(@org/pkg)/(path) + const match = internalPath.match(/^~lib\/((?:@[^/]+\/)?[^/]+)(?:\/(.+))?/); // ~lib/(pkg)/(path), ~lib/(@org/pkg)/(path) if (match) { const packageName = match[1]; const isPackageRoot = match[2] === undefined; @@ -497,7 +500,7 @@ exports.main = function main(argv, options, callback) { mainPath = json.ascMain.replace(extension.re_index, ""); packageMains.set(packageName, mainPath); } - } catch (e) { } + } catch (e) { /* nop */ } } } const mainDir = path.join(currentPath, packageName, mainPath); @@ -531,7 +534,7 @@ exports.main = function main(argv, options, callback) { var internalPath; while ((internalPath = assemblyscript.nextFile(program)) != null) { let file = getFile(internalPath, assemblyscript.getDependee(program, internalPath)); - if (!file) return callback(Error("Import '" + internalPath + "' not found.")) + if (!file) return callback(Error("Import '" + internalPath + "' not found.")); stats.parseCount++; stats.parseTime += measure(() => { assemblyscript.parse(program, file.sourceText, file.sourcePath, false); @@ -565,7 +568,7 @@ exports.main = function main(argv, options, callback) { for (let i = 0, k = argv.length; i < k; ++i) { const filename = argv[i]; - let sourcePath = String(filename).replace(/\\/g, "/").replace(extension.re, "").replace(/[\\\/]$/, ""); + let sourcePath = String(filename).replace(/\\/g, "/").replace(extension.re, "").replace(/[\\/]$/, ""); // Setting the path to relative path sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath) : sourcePath; @@ -838,7 +841,7 @@ exports.main = function main(argv, options, callback) { } else if (!hasStdout) { stats.emitCount++; stats.emitTime += measure(() => { - wat = module.toText() + wat = module.toText(); }); writeStdout(wat); } @@ -891,7 +894,7 @@ exports.main = function main(argv, options, callback) { try { stats.readCount++; stats.readTime += measure(() => { - files = fs.readdirSync(path.join(baseDir, dirname)).filter(file => extension.re_except_d.test(file)) + files = fs.readdirSync(path.join(baseDir, dirname)).filter(file => extension.re_except_d.test(file)); }); return files; } catch (e) { @@ -912,7 +915,7 @@ exports.main = function main(argv, options, callback) { } }); } -} +}; /** Checks diagnostics emitted so far for errors. */ function checkDiagnostics(program, stderr) { @@ -1004,7 +1007,7 @@ exports.printStats = printStats; var allocBuffer = typeof global !== "undefined" && global.Buffer ? global.Buffer.allocUnsafe || function(len) { return new global.Buffer(len); } - : function(len) { return new Uint8Array(len) }; + : function(len) { return new Uint8Array(len); }; /** Creates a memory stream that can be used in place of stdout/stderr. */ function createMemoryStream(fn) { diff --git a/cli/transform.js b/cli/transform.js index 5b1e1596c7..8f68d7a2e5 100644 --- a/cli/transform.js +++ b/cli/transform.js @@ -4,4 +4,4 @@ */ // becomes replaced with the actual base by asc -exports.Transform = function Transform() {}; +exports.Transform = function Transform() { /* nop */ }; diff --git a/cli/util/colors.d.ts b/cli/util/colors.d.ts index f2a6463740..75d689a50f 100644 --- a/cli/util/colors.d.ts +++ b/cli/util/colors.d.ts @@ -30,7 +30,7 @@ interface Exports extends Colors { /** Standard error wrapper. */ stderr: Colors; /** Creates an instance for the specified stream. */ - from(stream: any, base?: {}): Colors; + from(stream: Record, base?: Record): Colors; /** Gray color escape sequence. */ GRAY: string; /** Red color escape sequence. */ diff --git a/cli/util/options.js b/cli/util/options.js index c0c1232ddf..ac20ba68e7 100644 --- a/cli/util/options.js +++ b/cli/util/options.js @@ -19,7 +19,7 @@ const colorsUtil = require("./colors"); function parse(argv, config) { var options = {}; var unknown = []; - var arguments = []; + var args = []; var trailing = []; var provided = new Set(); @@ -39,7 +39,7 @@ function parse(argv, config) { for (var i = 0, k = (argv = argv.slice()).length; i < k; ++i) { let arg = argv[i]; if (arg == "--") { ++i; break; } - let match = /^(?:(\-\w)(?:=(.*))?|(\-\-\w{2,})(?:=(.*))?)$/.exec(arg), option, key; + let match = /^(?:(-\w)(?:=(.*))?|(--\w{2,})(?:=(.*))?)$/.exec(arg), option, key; if (match) { if (config[arg]) option = config[key = arg]; // exact else if (match[1] != null) { // alias @@ -51,7 +51,7 @@ function parse(argv, config) { } } else { if (arg.charCodeAt(0) == 45) option = config[key = arg]; // exact - else { arguments.push(arg); continue; } // argument + else { args.push(arg); continue; } // argument } if (option) { if (option.type == null || option.type === "b") { @@ -87,7 +87,7 @@ function parse(argv, config) { } while (i < k) trailing.push(argv[i++]); // trailing - return { options, unknown, arguments, trailing, provided }; + return { options, unknown, arguments: args, trailing, provided }; } exports.parse = parse; diff --git a/cli/util/utf8.js b/cli/util/utf8.js index 076038b10b..22f16671e9 100644 --- a/cli/util/utf8.js +++ b/cli/util/utf8.js @@ -18,21 +18,21 @@ var utf8 = exports; * @returns {number} Byte length */ utf8.length = function utf8_length(string) { - var len = 0, - c = 0; - for (var i = 0, l = string.length; i < l; ++i) { - c = string.charCodeAt(i); - if (c < 128) - len += 1; - else if (c < 2048) - len += 2; - else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { - ++i; - len += 4; - } else - len += 3; - } - return len; + var len = 0, + c = 0; + for (var i = 0, l = string.length; i < l; ++i) { + c = string.charCodeAt(i); + if (c < 128) + len += 1; + else if (c < 2048) + len += 2; + else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { + ++i; + len += 4; + } else + len += 3; + } + return len; }; /** @@ -43,36 +43,36 @@ utf8.length = function utf8_length(string) { * @returns {string} String read */ utf8.read = function utf8_read(buffer, start, end) { - var len = end - start; - if (len < 1) - return ""; - var parts = null, - chunk = [], - i = 0, // char offset - t; // temporary - while (start < end) { - t = buffer[start++]; - if (t < 128) - chunk[i++] = t; - else if (t > 191 && t < 224) - chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; - else if (t > 239 && t < 365) { - t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; - chunk[i++] = 0xD800 + (t >> 10); - chunk[i++] = 0xDC00 + (t & 1023); - } else - chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; - if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); - i = 0; - } - } - if (parts) { - if (i) - parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); - return parts.join(""); + var len = end - start; + if (len < 1) + return ""; + var parts = null, + chunk = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) + chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; + else if (t > 239 && t < 365) { + t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; + chunk[i++] = 0xD800 + (t >> 10); + chunk[i++] = 0xDC00 + (t & 1023); + } else + chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; } - return String.fromCharCode.apply(String, chunk.slice(0, i)); + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); }; /** @@ -83,28 +83,28 @@ utf8.read = function utf8_read(buffer, start, end) { * @returns {number} Bytes written */ utf8.write = function utf8_write(string, buffer, offset) { - var start = offset, - c1, // character 1 - c2; // character 2 - for (var i = 0; i < string.length; ++i) { - c1 = string.charCodeAt(i); - if (c1 < 128) { - buffer[offset++] = c1; - } else if (c1 < 2048) { - buffer[offset++] = c1 >> 6 | 192; - buffer[offset++] = c1 & 63 | 128; - } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - ++i; - buffer[offset++] = c1 >> 18 | 240; - buffer[offset++] = c1 >> 12 & 63 | 128; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } else { - buffer[offset++] = c1 >> 12 | 224; - buffer[offset++] = c1 >> 6 & 63 | 128; - buffer[offset++] = c1 & 63 | 128; - } + var start = offset, + c1, // character 1 + c2; // character 2 + for (var i = 0; i < string.length; ++i) { + c1 = string.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = c1 >> 6 | 192; + buffer[offset++] = c1 & 63 | 128; + } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { + c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); + ++i; + buffer[offset++] = c1 >> 18 | 240; + buffer[offset++] = c1 >> 12 & 63 | 128; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } else { + buffer[offset++] = c1 >> 12 | 224; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; } - return offset - start; + } + return offset - start; }; diff --git a/index.d.ts b/index.d.ts index 5342e445dd..c039a8000c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,2 +1,2 @@ -import "./src/glue/js" +import "./src/glue/js"; export * from "./src"; diff --git a/index.js b/index.js index ab9c1a7662..e8e52df9a7 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -try { require("source-map-support").install(); } catch (e) {} +try { require("source-map-support").install(); } catch (e) { /* nop */ } require("ts-node").register({ project: require("path").join(__dirname, "src", "tsconfig.json"), skipIgnore: true diff --git a/lib/lint/README.md b/lib/lint/README.md deleted file mode 100644 index 972ec3495f..0000000000 --- a/lib/lint/README.md +++ /dev/null @@ -1,41 +0,0 @@ -![AS](https://avatars1.githubusercontent.com/u/28916798?s=48) lint -====================== - -Recommended [TSLint](https://github.com/palantir/tslint) rules for use with AssemblyScript. Meant to spot the most common issues as you type. - -Not a sophisticated checker in its current state. - -Usage ------ - -Add the following `tslint.json` to your project: - -```json -{ - "extends": "@assemblyscript/lint" -} -``` - -Add additional rules if necessary. - -Add a script to your `package.json`: - -```json -"scripts": { - "lint": "tslint -c tslint.json --project ./path/to[/tsconfig.json] --format as" -} -``` - -Now, to check your sources, run: - -``` -$> npm run check -``` - -If you are using [Visual Studio Code](https://code.visualstudio.com/), there's also a [TSLint extension](https://marketplace.visualstudio.com/items?itemName=eg2.tslint) that highlights issues as you type. - -Custom rules ------------- - -* **as-types** checks that all types are annotated or have an initializer. -* **as-variables** checks the use of `var` and `let` to match their semantic meaning. For reference, `var` becomes a distinct local or mutable global, while `let` becomes a shared local. diff --git a/lib/lint/base.json b/lib/lint/base.json deleted file mode 100644 index 7c9f781f0c..0000000000 --- a/lib/lint/base.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "rules": { - "adjacent-overload-signatures": {}, - "ban-types": { - "severity": "error", - "options": [ - ["object", "Not supported."], - ["any", "Not supported."], - ["undefined", "Not supported."], - ["never", "Not supported."], - ["number", "Use one of the WebAssembly types instead."], - ["boolean", "Use `bool` instead."] - ] - }, - "restrict-plus-operands": { - "severity": "error" - }, - "curly": { - "options": ["ignore-same-line"] - }, - "deprecation": {}, - "encoding": { - "severity": "error" - }, - "eofline": {}, - "label-position": { - "severity": "error" - }, - "new-parens": { - "severity": "error" - }, - "no-any": { - "severity": "error" - }, - "no-arg": { - "severity": "error" - }, - "no-consecutive-blank-lines": {}, - "no-debugger": { - "severity": "error" - }, - "no-duplicate-super": { - "severity": "error" - }, - "no-duplicate-switch-case": { - "severity": "error" - }, - "no-duplicate-variable": { - "severity": "error" - }, - "no-eval": { - "severity": "error" - }, - "no-inferred-empty-object-type": { - "severity": "error" - }, - "no-internal-module": { - "severity": "error" - }, - "no-invalid-template-strings": { - "severity": "error" - }, - "no-invalid-this": { - "severity": "error" - }, - "no-irregular-whitespace": {}, - "no-misused-new": { - "severity": "error" - }, - "no-require-imports": { - "severity": "error" - }, - "no-sparse-arrays": {}, - "no-string-literal": { - "severity": "error" - }, - "no-string-throw": { - "severity": "error" - }, - "no-trailing-whitespace": {}, - "no-unbound-method": { - "severity": "error" - }, - "no-unsafe-any": { - "severity": "error" - }, - "no-void-expression": { - "severity": "error" - }, - "prefer-method-signature": {}, - "radix": {}, - "semicolon": { - "options": ["always"] - } - } -} diff --git a/lib/lint/formatters/asFormatter.js b/lib/lint/formatters/asFormatter.js deleted file mode 100644 index e6de8ffb19..0000000000 --- a/lib/lint/formatters/asFormatter.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const abstractFormatter_1 = require("tslint/lib/language/formatter/abstractFormatter"); -const colorBlue = "\u001b[93m"; -const colorYellow = "\u001b[93m"; -const colorRed = "\u001b[91m"; -const colorReset = "\u001b[0m"; -class Formatter extends abstractFormatter_1.AbstractFormatter { - format(failures) { - return `${this.mapToMessages(failures).join("\n")}\n`; - } - mapToMessages(failures) { - return failures.map((failure) => { - var fileName = failure.getFileName(); - var failureString = failure.getFailure(); - var ruleName = failure.getRuleName(); - var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); - var positionTuple = `:${lineAndCharacter.line + 1}:${lineAndCharacter.character + 1}`; - if (this.lastSeverity == failure.getRuleSeverity() && this.lastFailure == failureString) { - return " in " + fileName + positionTuple; - } - else { - let message = this.lastSeverity ? "\n" : ""; - switch (this.lastSeverity = failure.getRuleSeverity()) { - case "warning": { - message += colorYellow + "WARNING:" + colorReset; - break; - } - case "error": { - message += colorRed + "ERROR:" + colorReset; - break; - } - default: { - message += failure.getRuleSeverity(); - break; - } - } - this.lastFailure = failureString; - return message + " " + failureString + " [" + ruleName + "]\n in " + fileName + positionTuple; - } - }); - } -} -exports.Formatter = Formatter; -Formatter.metadata = { - formatterName: "as", - description: "AssemblyScript's TSLint formatter.", - sample: "Similar to ASC's output.", - consumer: "human", -}; diff --git a/lib/lint/index.json b/lib/lint/index.json deleted file mode 100644 index 5f487f79e1..0000000000 --- a/lib/lint/index.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./base.json", - "rulesDirectory": ["./rules", "./rules/internal"], - "formattersDirectory": ["./formatters"], - "rules": { - "as-types": { - "severity": "error" - }, - "as-variables": {} - } -} diff --git a/lib/lint/package.json b/lib/lint/package.json deleted file mode 100644 index 35c13ff677..0000000000 --- a/lib/lint/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@assemblyscript/lint", - "version": "1.0.0", - "main": "index.json", - "scripts": { - "build": "tsc --project ./src --outDir . --diagnostics" - }, - "peerDependencies": { - "tslint": "^5.11.0" - }, - "devDependencies": { - "typescript": "^3.1.2" - }, - "files": [ - "base.json", - "index.json", - "package.json", - "README.md", - "rules/", - "formatters/" - ] -} diff --git a/lib/lint/rules/asTypesRule.js b/lib/lint/rules/asTypesRule.js deleted file mode 100644 index 084b18f63b..0000000000 --- a/lib/lint/rules/asTypesRule.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -Rule.MISSING_TYPE_OR_INITIALIZER = "Missing type or initializer."; -Rule.MISSING_RETURN_TYPE = "Missing return type."; -Rule.UNNECESSARY_RETURN_TYPE = "Unnecessary return type."; -class DiagnosticsWalker extends Lint.RuleWalker { - visitVariableDeclaration(node) { - var list = node.parent; - if (list) { - let stmt = list.parent; - if (stmt && stmt.kind != ts.SyntaxKind.ForOfStatement) { - this.checkTypeOrInitializer(node); - } - } - super.visitVariableDeclaration(node); - } - visitPropertyDeclaration(node) { - this.checkTypeOrInitializer(node); - super.visitPropertyDeclaration(node); - } - visitParameterDeclaration(node) { - this.checkTypeOrInitializer(node); - super.visitParameterDeclaration(node); - } - checkTypeOrInitializer(node) { - if (!node.type && !node.initializer) { - this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER); - } - } - visitFunctionDeclaration(node) { - this.checkFunctionReturnType(node); - super.visitFunctionDeclaration(node); - } - visitArrowFunction(node) { - if (requiresReturnType(node)) { - this.checkFunctionReturnType(node); - } - else if (node.type) { - this.addFailureAtNode(node.type, Rule.UNNECESSARY_RETURN_TYPE); - } - super.visitArrowFunction(node); - } - visitMethodDeclaration(node) { - this.checkFunctionReturnType(node); - super.visitMethodDeclaration(node); - } - visitGetAccessor(node) { - this.checkFunctionReturnType(node); - super.visitGetAccessor(node); - } - checkFunctionReturnType(node) { - if (!node.type) { - this.addFailureAtNode(node, Rule.MISSING_RETURN_TYPE); - } - } -} -function requiresReturnType(node) { - if (ts.isCallExpression(node.parent) && ts.isIdentifier(node.parent.expression) - && ["lengthof", "nameof"].includes(node.parent.expression.text)) { - return true; - } - return !ts.isCallLikeExpression(node.parent); -} diff --git a/lib/lint/rules/asVariablesRule.js b/lib/lint/rules/asVariablesRule.js deleted file mode 100644 index c2d678e97d..0000000000 --- a/lib/lint/rules/asVariablesRule.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const Lint = require("tslint"); -const tsutils_1 = require("tsutils"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new VariablesWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -Rule.TOP_LEVEL_VAR = "Top-level variable should be 'var' (distinct local or global)."; -Rule.BLOCK_LEVEL_LET = "Block-level variable should be 'let' (shared local)."; -class VariablesWalker extends Lint.RuleWalker { - visitVariableDeclarationList(node) { - if (tsutils_1.isVariableStatement(node.parent)) { - if (tsutils_1.isBlock(node.parent.parent)) { - if (tsutils_1.isFunctionScopeBoundary(node.parent.parent.parent) || - tsutils_1.isNamespaceDeclaration(node.parent.parent.parent)) { - if (tsutils_1.getVariableDeclarationKind(node) == 1 /* Let */) { - this.addFailureAtNode(node, Rule.TOP_LEVEL_VAR); - } - } - else if (tsutils_1.getVariableDeclarationKind(node) == 0 /* Var */) { - this.addFailureAtNode(node, Rule.BLOCK_LEVEL_LET); - } - } - else if (tsutils_1.isSourceFile(node.parent.parent) || - tsutils_1.isModuleBlock(node.parent.parent)) { - if (tsutils_1.getVariableDeclarationKind(node) == 1 /* Let */) { - this.addFailureAtNode(node, Rule.TOP_LEVEL_VAR); - } - } - else if (tsutils_1.getVariableDeclarationKind(node) == 0 /* Var */) { - this.addFailureAtNode(node, Rule.BLOCK_LEVEL_LET); - } - } - else if (tsutils_1.getVariableDeclarationKind(node) == 0 /* Var */) { - this.addFailureAtNode(node, Rule.BLOCK_LEVEL_LET); - } - super.visitVariableDeclarationList(node); - } -} diff --git a/lib/lint/rules/internal/asInternalCaseRule.js b/lib/lint/rules/internal/asInternalCaseRule.js deleted file mode 100644 index 4ff5f91259..0000000000 --- a/lib/lint/rules/internal/asInternalCaseRule.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const tsutils_1 = require("tsutils"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new CaseWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -Rule.NOT_BRACED = "Multi-line case clauses should be braced."; -class CaseWalker extends Lint.RuleWalker { - visitDefaultClause(node) { - this.checkDefaultOrCaseClause(node); - super.visitDefaultClause(node); - } - visitCaseClause(node) { - this.checkDefaultOrCaseClause(node); - super.visitCaseClause(node); - } - checkDefaultOrCaseClause(node) { - var count = node.statements.length; - if (count > 1) { - this.addFailureAtNode(node, Rule.NOT_BRACED); - } - else if (count == 1) { - let stmt = node.statements[0]; - if (stmt.kind != ts.SyntaxKind.Block) { - if (!tsutils_1.isSameLine(node.getSourceFile(), node.getStart(), stmt.getStart())) { - this.addFailureAtNode(node, Rule.NOT_BRACED); - } - } - } - } -} diff --git a/lib/lint/rules/internal/asInternalDiagnosticsRule.js b/lib/lint/rules/internal/asInternalDiagnosticsRule.js deleted file mode 100644 index 77c4e7fd5e..0000000000 --- a/lib/lint/rules/internal/asInternalDiagnosticsRule.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const tsutils_1 = require("tsutils"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -Rule.NOT_ON_SEPARATE_LINE = "Diagnostic message not on a separate line."; -class DiagnosticsWalker extends Lint.RuleWalker { - visitPropertyAccessExpression(node) { - if (node.expression.kind === ts.SyntaxKind.Identifier) { - if (node.expression.text == "DiagnosticCode" && - tsutils_1.isSameLine(node.getSourceFile(), node.parent.getStart(), node.getStart())) { - this.addFailureAtNode(node, Rule.NOT_ON_SEPARATE_LINE); - } - } - super.visitPropertyAccessExpression(node); - } -} diff --git a/lib/lint/src/formatters/asFormatter.ts b/lib/lint/src/formatters/asFormatter.ts deleted file mode 100644 index 739d61a3ba..0000000000 --- a/lib/lint/src/formatters/asFormatter.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { AbstractFormatter } from "tslint/lib/language/formatter/abstractFormatter"; -import { IFormatterMetadata } from "tslint/lib/language/formatter/formatter"; -import { RuleFailure } from "tslint/lib/language/rule/rule"; - -const colorBlue: string = "\u001b[93m"; -const colorYellow: string = "\u001b[93m"; -const colorRed: string = "\u001b[91m"; -const colorReset: string = "\u001b[0m"; - -export class Formatter extends AbstractFormatter { - - static metadata: IFormatterMetadata = { - formatterName: "as", - description: "AssemblyScript's TSLint formatter.", - sample: "Similar to ASC's output.", - consumer: "human", - }; - - lastSeverity: string; - lastFailure: string; - - format(failures: RuleFailure[]): string { - return `${this.mapToMessages(failures).join("\n")}\n`; - } - - mapToMessages(failures: RuleFailure[]): string[] { - return failures.map((failure: RuleFailure) => { - var fileName = failure.getFileName(); - var failureString = failure.getFailure(); - var ruleName = failure.getRuleName(); - var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); - var positionTuple = `:${lineAndCharacter.line + 1}:${lineAndCharacter.character + 1}`; - if (this.lastSeverity == failure.getRuleSeverity() && this.lastFailure == failureString) { - return " in " + fileName + positionTuple; - } else { - let message = this.lastSeverity ? "\n" : ""; - switch (this.lastSeverity = failure.getRuleSeverity()) { - case "warning": { - message += colorYellow + "WARNING:" + colorReset; - break; - } - case "error": { - message += colorRed + "ERROR:" + colorReset; - break; - } - default: { - message += failure.getRuleSeverity(); - break; - } - } - this.lastFailure = failureString; - return message + " " + failureString + " [" + ruleName + "]\n in " + fileName + positionTuple; - } - }); - } -} diff --git a/lib/lint/src/rules/asTypesRule.ts b/lib/lint/src/rules/asTypesRule.ts deleted file mode 100644 index aed855b214..0000000000 --- a/lib/lint/src/rules/asTypesRule.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as ts from "typescript"; -import * as Lint from "tslint"; - -export class Rule extends Lint.Rules.AbstractRule { - - static MISSING_TYPE_OR_INITIALIZER = "Missing type or initializer."; - static MISSING_RETURN_TYPE = "Missing return type."; - static UNNECESSARY_RETURN_TYPE = "Unnecessary return type."; - - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions())); - } -} - -class DiagnosticsWalker extends Lint.RuleWalker { - - visitVariableDeclaration(node: ts.VariableDeclaration) { - var list = node.parent; - if (list) { - let stmt = list.parent; - if (stmt && stmt.kind != ts.SyntaxKind.ForOfStatement) { - this.checkTypeOrInitializer(node); - } - } - super.visitVariableDeclaration(node); - } - - visitPropertyDeclaration(node: ts.PropertyDeclaration) { - this.checkTypeOrInitializer(node); - super.visitPropertyDeclaration(node); - } - - visitParameterDeclaration(node: ts.ParameterDeclaration) { - this.checkTypeOrInitializer(node); - super.visitParameterDeclaration(node); - } - - private checkTypeOrInitializer(node: ts.NamedDeclaration & { type?: ts.TypeNode, initializer?: ts.Expression }) { - if (!node.type && !node.initializer) { - this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER); - } - } - - visitFunctionDeclaration(node: ts.FunctionDeclaration) { - this.checkFunctionReturnType(node); - super.visitFunctionDeclaration(node); - } - - visitArrowFunction(node: ts.ArrowFunction) { - if (requiresReturnType(node)) { - this.checkFunctionReturnType(node); - } else if (node.type) { - this.addFailureAtNode(node.type, Rule.UNNECESSARY_RETURN_TYPE); - } - super.visitArrowFunction(node); - } - - visitMethodDeclaration(node: ts.MethodDeclaration) { - this.checkFunctionReturnType(node); - super.visitMethodDeclaration(node); - } - - visitGetAccessor(node: ts.GetAccessorDeclaration) { - this.checkFunctionReturnType(node); - super.visitGetAccessor(node); - } - - private checkFunctionReturnType(node: ts.FunctionLikeDeclaration) { - if (!node.type) { - this.addFailureAtNode(node, Rule.MISSING_RETURN_TYPE); - } - } -} - -function requiresReturnType(node: ts.ArrowFunction): boolean { - if (ts.isCallExpression(node.parent) && ts.isIdentifier(node.parent.expression) - && ["lengthof", "nameof"].includes(node.parent.expression.text)) { - return true; - } - return !ts.isCallLikeExpression(node.parent); -} diff --git a/lib/lint/src/rules/asVariablesRule.ts b/lib/lint/src/rules/asVariablesRule.ts deleted file mode 100644 index 932d36e41d..0000000000 --- a/lib/lint/src/rules/asVariablesRule.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as ts from "typescript"; -import * as Lint from "tslint"; -import { - getVariableDeclarationKind, - VariableDeclarationKind, - isVariableStatement, - isBlock, - isFunctionScopeBoundary, - isSourceFile, - isNamespaceDeclaration, - isExportSpecifier, - isModuleBlock -} from "tsutils"; - -export class Rule extends Lint.Rules.AbstractRule { - - static TOP_LEVEL_VAR = "Top-level variable should be 'var' (distinct local or global)."; - static BLOCK_LEVEL_LET = "Block-level variable should be 'let' (shared local)."; - - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new VariablesWalker(sourceFile, this.getOptions())); - } -} - -class VariablesWalker extends Lint.RuleWalker { - - visitVariableDeclarationList(node: ts.VariableDeclarationList): void { - if (isVariableStatement(node.parent)) { - if (isBlock(node.parent.parent)) { - if ( - isFunctionScopeBoundary(node.parent.parent.parent) || - isNamespaceDeclaration(node.parent.parent.parent) - ) { - if (getVariableDeclarationKind(node) == VariableDeclarationKind.Let) { - this.addFailureAtNode(node, Rule.TOP_LEVEL_VAR); - } - } else if (getVariableDeclarationKind(node) == VariableDeclarationKind.Var) { - this.addFailureAtNode(node, Rule.BLOCK_LEVEL_LET); - } - } else if ( - isSourceFile(node.parent.parent) || - isModuleBlock(node.parent.parent) - ) { - if (getVariableDeclarationKind(node) == VariableDeclarationKind.Let) { - this.addFailureAtNode(node, Rule.TOP_LEVEL_VAR); - } - } else if (getVariableDeclarationKind(node) == VariableDeclarationKind.Var) { - this.addFailureAtNode(node, Rule.BLOCK_LEVEL_LET); - } - } else if (getVariableDeclarationKind(node) == VariableDeclarationKind.Var) { - this.addFailureAtNode(node, Rule.BLOCK_LEVEL_LET); - } - super.visitVariableDeclarationList(node); - } -} diff --git a/lib/lint/src/rules/internal/asInternalCaseRule.ts b/lib/lint/src/rules/internal/asInternalCaseRule.ts deleted file mode 100644 index 998413892f..0000000000 --- a/lib/lint/src/rules/internal/asInternalCaseRule.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as ts from "typescript"; -import * as Lint from "tslint"; -import { isSameLine } from "tsutils"; - -export class Rule extends Lint.Rules.AbstractRule { - - static NOT_BRACED = "Multi-line case clauses should be braced."; - - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new CaseWalker(sourceFile, this.getOptions())); - } -} - -class CaseWalker extends Lint.RuleWalker { - - visitDefaultClause(node: ts.DefaultClause) { - this.checkDefaultOrCaseClause(node); - super.visitDefaultClause(node); - } - - visitCaseClause(node: ts.CaseClause) { - this.checkDefaultOrCaseClause(node); - super.visitCaseClause(node); - } - - private checkDefaultOrCaseClause(node: ts.DefaultClause | ts.CaseClause) { - var count = node.statements.length; - if (count > 1) { - this.addFailureAtNode(node, Rule.NOT_BRACED); - } else if (count == 1) { - let stmt = node.statements[0]; - if (stmt.kind != ts.SyntaxKind.Block) { - if (!isSameLine(node.getSourceFile(), node.getStart(), stmt.getStart())) { - this.addFailureAtNode(node, Rule.NOT_BRACED); - } - } - } - } -} diff --git a/lib/lint/src/rules/internal/asInternalDiagnosticsRule.ts b/lib/lint/src/rules/internal/asInternalDiagnosticsRule.ts deleted file mode 100644 index 6b96562541..0000000000 --- a/lib/lint/src/rules/internal/asInternalDiagnosticsRule.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as ts from "typescript"; -import * as Lint from "tslint"; -import { isSameLine } from "tsutils"; - -export class Rule extends Lint.Rules.AbstractRule { - - static NOT_ON_SEPARATE_LINE = "Diagnostic message not on a separate line."; - - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions())); - } -} - -class DiagnosticsWalker extends Lint.RuleWalker { - - visitPropertyAccessExpression(node: ts.PropertyAccessExpression) { - if (node.expression.kind === ts.SyntaxKind.Identifier) { - if ( - (node.expression as ts.Identifier).text == "DiagnosticCode" && - isSameLine(node.getSourceFile(), node.parent.getStart(), node.getStart()) - ) { - this.addFailureAtNode(node, Rule.NOT_ON_SEPARATE_LINE); - } - } - super.visitPropertyAccessExpression(node); - } -} diff --git a/lib/lint/src/tsconfig.json b/lib/lint/src/tsconfig.json deleted file mode 100644 index 6e7288053a..0000000000 --- a/lib/lint/src/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "lib": ["es6", "es2015.collection"] - }, - "include": [ - "./**/**.ts" - ] -} \ No newline at end of file diff --git a/lib/loader/index.d.ts b/lib/loader/index.d.ts index b881c37925..bc6854277a 100644 --- a/lib/loader/index.d.ts +++ b/lib/loader/index.d.ts @@ -8,7 +8,7 @@ export interface ResultObject { /** WebAssembly imports with an optional env object and two levels of nesting. */ export type Imports = { - [key: string]: any; + [key: string]: Record; env?: { memory?: WebAssembly.Memory; table?: WebAssembly.Table; @@ -100,22 +100,25 @@ export interface ASUtil { } /** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */ -export declare function instantiate( +export declare function instantiate>( source: WebAssembly.Module | BufferSource | Response | PromiseLike, imports?: Imports ): Promise; /** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */ -export declare function instantiateSync( +export declare function instantiateSync>( source: WebAssembly.Module | BufferSource, imports?: Imports ): ResultObject & { exports: ASUtil & T }; /** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */ -export declare function instantiateStreaming( +export declare function instantiateStreaming>( source: Response | PromiseLike, imports?: Imports ): Promise; /** Demangles an AssemblyScript module's exports to a friendly object structure. */ -export declare function demangle(exports: {}, extendedExports?: {}): T; +export declare function demangle>( + exports: Record, + extendedExports?: Record +): T; diff --git a/lib/loader/index.js b/lib/loader/index.js index 0fd7770b91..f29d445fab 100644 --- a/lib/loader/index.js +++ b/lib/loader/index.js @@ -7,26 +7,26 @@ const SIZE_OFFSET = -4; // Runtime ids const ARRAYBUFFER_ID = 0; const STRING_ID = 1; -const ARRAYBUFFERVIEW_ID = 2; +// const ARRAYBUFFERVIEW_ID = 2; // Runtime type information const ARRAYBUFFERVIEW = 1 << 0; const ARRAY = 1 << 1; const STATICARRAY = 1 << 2; -const SET = 1 << 3; -const MAP = 1 << 4; +// const SET = 1 << 3; +// const MAP = 1 << 4; const VAL_ALIGN_OFFSET = 6; -const VAL_ALIGN = 1 << VAL_ALIGN_OFFSET; +// const VAL_ALIGN = 1 << VAL_ALIGN_OFFSET; const VAL_SIGNED = 1 << 11; const VAL_FLOAT = 1 << 12; -const VAL_NULLABLE = 1 << 13; +// const VAL_NULLABLE = 1 << 13; const VAL_MANAGED = 1 << 14; -const KEY_ALIGN_OFFSET = 15; -const KEY_ALIGN = 1 << KEY_ALIGN_OFFSET; -const KEY_SIGNED = 1 << 20; -const KEY_FLOAT = 1 << 21; -const KEY_NULLABLE = 1 << 22; -const KEY_MANAGED = 1 << 23; +// const KEY_ALIGN_OFFSET = 15; +// const KEY_ALIGN = 1 << KEY_ALIGN_OFFSET; +// const KEY_SIGNED = 1 << 20; +// const KEY_FLOAT = 1 << 21; +// const KEY_NULLABLE = 1 << 22; +// const KEY_MANAGED = 1 << 23; // Array(BufferView) layout const ARRAYBUFFERVIEW_BUFFER_OFFSET = 0; @@ -116,9 +116,9 @@ function postInstantiate(extendedExports, instance) { } /** Gets the runtime alignment of a collection's keys. */ - function getKeyAlign(info) { - return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none - } + // function getKeyAlign(info) { + // return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none + // } /** Allocates a new string in the module's memory and returns its retained pointer. */ function __allocString(str) { @@ -203,8 +203,7 @@ function postInstantiate(extendedExports, instance) { const length = info & ARRAY ? U32[arr + ARRAY_LENGTH_OFFSET >>> 2] : U32[buf + SIZE_OFFSET >>> 2] >>> align; - return getView(align, info & VAL_SIGNED, info & VAL_FLOAT) - .subarray(buf >>>= align, buf + length); + return getView(align, info & VAL_SIGNED, info & VAL_FLOAT).subarray(buf >>>= align, buf + length); } extendedExports.__getArrayView = __getArrayView; @@ -273,8 +272,10 @@ function postInstantiate(extendedExports, instance) { const U32 = new Uint32Array(memory.buffer); let id = U32[(ptr + ID_OFFSET) >>> 2]; if (id <= U32[rttiBase >>> 2]) { - do if (id == baseId) return true; - while (id = getBase(id)); + do { + if (id == baseId) return true; + id = getBase(id); + } while (id); } return false; } @@ -343,7 +344,7 @@ function demangle(exports, extendedExports = {}) { extendedExports = Object.create(extendedExports); const setArgumentsLength = exports["__argumentsLength"] ? length => { exports["__argumentsLength"].value = length; } - : exports["__setArgumentsLength"] || exports["__setargc"] || (() => {}); + : exports["__setArgumentsLength"] || exports["__setargc"] || (() => { /* nop */ }); for (let internalName in exports) { if (!Object.prototype.hasOwnProperty.call(exports, internalName)) continue; const elem = exports[internalName]; diff --git a/lib/loader/tests/index.js b/lib/loader/tests/index.js index 22d005bacc..72dc1996c6 100644 --- a/lib/loader/tests/index.js +++ b/lib/loader/tests/index.js @@ -35,7 +35,7 @@ function test(file) { // should be able to allocate a typed array { - var arr = [1, 2, 3, 4, 5, 0x80000000 | 0]; + let arr = [1, 2, 3, 4, 5, 0x80000000 | 0]; let ref = exports.__retain(exports.__allocArray(exports.INT32ARRAY_ID, arr)); assert(exports.__instanceof(ref, exports.INT32ARRAY_ID)); @@ -50,12 +50,12 @@ function test(file) { // should be able to release no longer needed references exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to allocate a typed array { - var arr = [1, 2, 3, 4, 5, 0x80000000 | 0]; + let arr = [1, 2, 3, 4, 5, 0x80000000 | 0]; let ref = exports.__retain(exports.__allocArray(exports.STATICARRAYI32_ID, arr)); assert(exports.__instanceof(ref, exports.STATICARRAYI32_ID)); @@ -70,7 +70,7 @@ function test(file) { // should be able to release no longer needed references exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } /* @@ -108,7 +108,7 @@ function test(file) { assert.deepEqual(exports.__getUint8ArrayView(ref), arr); assert.deepEqual(exports.__getArray(ref), values); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between signed and unsigned for static array layout @@ -118,7 +118,7 @@ function test(file) { assert(exports.__instanceof(ref, exports.STATICARRAYU8_ID)); assert.deepEqual(exports.__getArray(ref), arr); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between signed and unsigned @@ -131,7 +131,7 @@ function test(file) { assert.deepEqual(exports.__getInt16ArrayView(ref), arr); assert.deepEqual(exports.__getArray(ref), [0, -1, -255]); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between signed and unsigned for static array layout @@ -141,7 +141,7 @@ function test(file) { assert(exports.__instanceof(ref, exports.STATICARRAYI16_ID)); assert.deepEqual(exports.__getArray(ref), [0, -1, -255]); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between signed and unsigned @@ -154,7 +154,7 @@ function test(file) { assert.deepEqual(exports.__getUint32ArrayView(ref), arr); assert.deepEqual(exports.__getArray(ref), values); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between signed and unsigned with static array layout @@ -164,20 +164,20 @@ function test(file) { assert(exports.__instanceof(ref, exports.STATICARRAYU32_ID)); assert.deepEqual(exports.__getArray(ref), arr); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between integer and float { let values = [0.0, 1.5, 2.5]; - let arr = new Float32Array(values) + let arr = new Float32Array(values); let ref = exports.__retain(exports.__allocArray(exports.FLOAT32ARRAY_ID, arr)); assert(exports.__instanceof(ref, exports.FLOAT32ARRAY_ID)); assert.deepEqual(exports.__getFloat32Array(ref), arr); assert.deepEqual(exports.__getFloat32ArrayView(ref), arr); assert.deepEqual(exports.__getArray(ref), values); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to distinguish between integer and float static arrays @@ -187,7 +187,7 @@ function test(file) { assert(exports.__instanceof(ref, exports.STATICARRAYF32_ID)); assert.deepEqual(exports.__getArray(ref), arr); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to work with normal arrays @@ -198,7 +198,7 @@ function test(file) { exports.changeLength(ref, 3); assert.deepEqual(exports.__getArray(ref), [1, 2, 3]); exports.__release(ref); - try { exports.__release(ref); assert(false); } catch (e) {}; + try { exports.__release(ref); assert(false); } catch (e) { /* nop */ } } // should be able to correctly call a function with variable arguments diff --git a/lib/parse/assembly/index.ts b/lib/parse/assembly/index.ts index ed11da9a3f..3defa2ec19 100644 --- a/lib/parse/assembly/index.ts +++ b/lib/parse/assembly/index.ts @@ -2,7 +2,6 @@ // Common constants shared between AssemblyScript and TypeScript import { - Type, SectionId, ExternalKind, NameType, @@ -118,7 +117,7 @@ export function parse(begin: usize, end: usize): void { var mem_space_index: u32 = 0; var tbl_space_index: u32 = 0; while (off < end) { - let section_off = off; + // let section_off = off; let id = readVaruint(7); let payload_len = readVaruint(32); let name_off = 0; diff --git a/lib/parse/src/index.ts b/lib/parse/src/index.ts index 69d5a2c8a6..cd7291f197 100644 --- a/lib/parse/src/index.ts +++ b/lib/parse/src/index.ts @@ -92,7 +92,7 @@ export function parse(binary: Uint8Array, options?: ParseOptions): void { "onModuleName", "onFunctionName", "onLocalName" - ].forEach((name: string): void => imports.options[name] = options[name] || function() {}); + ].forEach((name: string) => imports.options[name] = options[name] || function() { /* nop */ }); var instance = new WebAssembly.Instance(compiled, imports); instance.exports.parse(0, nBytes); } @@ -106,10 +106,8 @@ export declare namespace parse { function utf8_read(buffer: Uint8Array, start: number, end: number): string { var len = end - start; if (len < 1) return ""; - var parts: string[] | null = null, - chunk: number[] = [], - i = 0, // char offset - t = 0; // temporary + var parts: string[] | null = null, chunk: number[] = []; + var i = 0, t = 0; // char offset and temporary while (start < end) { t = buffer[start++]; if (t < 128) { @@ -124,23 +122,22 @@ function utf8_read(buffer: Uint8Array, start: number, end: number): string { chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; } if (i > 8191) { - (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + (parts || (parts = [])).push(String.fromCharCode(...chunk)); i = 0; } } if (parts) { - if (i) parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + if (i) parts.push(String.fromCharCode(...chunk.slice(0, i))); return parts.join(""); } - return String.fromCharCode.apply(String, chunk.slice(0, i)); + return String.fromCharCode(...chunk.slice(0, i)); } // see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64 function base64_decode(string: string): Uint8Array { var length = string.length; if (length) { - let n = 0, - p = length; + let n = 0, p = length; while (--p % 4 > 1 && string.charCodeAt(p) === 61) ++n; length = Math.ceil(length * 3) / 4 - n; } diff --git a/lib/parse/webpack.config.js b/lib/parse/webpack.config.js index b624225c4a..61fee7db6f 100644 --- a/lib/parse/webpack.config.js +++ b/lib/parse/webpack.config.js @@ -1,5 +1,4 @@ const fs = require("fs"); -const path = require("path"); const webpack = require("webpack"); const wasmData = fs.readFileSync(__dirname + "/build/index.wasm"); diff --git a/lib/rtrace/index.js b/lib/rtrace/index.js index bb3fdef888..0cd2c05a13 100644 --- a/lib/rtrace/index.js +++ b/lib/rtrace/index.js @@ -1,6 +1,6 @@ function rtrace(onerror, oninfo) { - if (!onerror) onerror = function() {}; - if (!oninfo) oninfo = function() {}; + if (!onerror) onerror = function() { /* nop */ }; + if (!oninfo) oninfo = function() { /* nop */ }; var blocks = new Map(); var rtrace = { diff --git a/lib/webpack/index.js b/lib/webpack/index.js index 16c7a34389..d622ce5164 100644 --- a/lib/webpack/index.js +++ b/lib/webpack/index.js @@ -8,7 +8,7 @@ const MAGIC = Buffer.from([ 0x00, 0x61, 0x73, 0x6D ]); module.exports = loader; function loader(buffer) { - if (MAGIC.compare(target, 0, 4) !== 0) + if (MAGIC.compare(buffer, 0, 4) !== 0) return compile.call(this); else return bundle.call(this, buffer); diff --git a/package-lock.json b/package-lock.json index fca9cf4d2d..b8faf2b883 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,12 +30,143 @@ "js-tokens": "^4.0.0" } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, "@types/node": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz", - "integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==", + "version": "14.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", + "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==", "dev": true }, + "@typescript-eslint/eslint-plugin": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.1.tgz", + "integrity": "sha512-RxGldRQD3hgOK2xtBfNfA5MMV3rn5gVChe+MIf14hKm51jO2urqF64xOyVrGtzThkrd4rS1Kihqx2nkSxkXHvA==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "3.0.1", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.1.tgz", + "integrity": "sha512-GdwOVz80MOWxbc/br1DC30eeqlxfpVzexHgHtf3L0hcbOu1xAs1wSCNcaBTLMOMZbh1gj/cKZt0eB207FxWfFA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "3.0.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + } + } + }, + "@typescript-eslint/parser": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.1.tgz", + "integrity": "sha512-Pn2tDmOc4Ri93VQnT70W0pqQr6i/pEZqIPXfWXm4RuiIprL0t6SG13ViVXHgfScknL2Fm2G4IqXhUzxSRCWXCw==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "3.0.1", + "@typescript-eslint/typescript-estree": "3.0.1", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.1.tgz", + "integrity": "sha512-FrbMdgVCeIGHKaP9OYTttFTlF8Ds7AkjMca2GzYCE7pVch10PAJc1mmAFt+DfQPgu/2TrLAprg2vI0PK/WTdcg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, "@webassemblyjs/ast": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", @@ -229,6 +360,12 @@ "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true }, + "acorn-jsx": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "dev": true + }, "ajv": { "version": "6.12.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", @@ -253,6 +390,23 @@ "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", "dev": true }, + "ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "requires": { + "type-fest": "^0.11.0" + }, + "dependencies": { + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + } + } + }, "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", @@ -480,6 +634,12 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, "async-each": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", @@ -722,12 +882,6 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -774,6 +928,12 @@ "unset-value": "^1.0.0" } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -791,6 +951,12 @@ "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, "chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -928,6 +1094,21 @@ } } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-width": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "dev": true + }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -1134,6 +1315,12 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -1208,6 +1395,15 @@ "randombytes": "^2.0.0" } }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", @@ -1288,6 +1484,198 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.1.0.tgz", + "integrity": "sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0", + "eslint-visitor-keys": "^1.1.0", + "espree": "^7.0.0", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", + "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "eslint-scope": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", @@ -1298,12 +1686,63 @@ "estraverse": "^4.1.1" } }, + "eslint-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, + "espree": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz", + "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==", + "dev": true, + "requires": { + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.0", + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "acorn": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", + "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "dev": true + } + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", + "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==", + "dev": true + } + } + }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -1319,6 +1758,12 @@ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, "events": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", @@ -1415,6 +1860,17 @@ } } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -1492,12 +1948,36 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, "figgy-pudding": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", "dev": true }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -1651,6 +2131,34 @@ } } }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, "flush-write-stream": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", @@ -2255,6 +2763,12 @@ } } }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -2346,6 +2860,15 @@ "which": "^1.2.14" } }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", @@ -2456,6 +2979,15 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", @@ -2468,6 +3000,30 @@ "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", "dev": true }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, "import-local": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", @@ -2512,6 +3068,117 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "inquirer": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "interpret": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", @@ -2704,6 +3371,12 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json5": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", @@ -2728,6 +3401,16 @@ "invert-kv": "^2.0.0" } }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, "loader-runner": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", @@ -2755,6 +3438,12 @@ "path-exists": "^3.0.0" } }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, "long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", @@ -2959,6 +3648,12 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, "nan": { "version": "2.14.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", @@ -2985,6 +3680,12 @@ "to-regex": "^3.0.1" } }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "neo-async": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", @@ -3115,6 +3816,29 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -3132,6 +3856,12 @@ "mem": "^4.0.0" } }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -3191,6 +3921,15 @@ "readable-stream": "^2.1.5" } }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-asn1": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", @@ -3247,12 +3986,6 @@ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -3299,6 +4032,12 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -3311,6 +4050,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -3548,6 +4293,12 @@ "safe-regex": "^1.1.0" } }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -3578,15 +4329,6 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, "resolve-cwd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", @@ -3631,6 +4373,16 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -3656,6 +4408,12 @@ "inherits": "^2.0.1" } }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -3665,6 +4423,15 @@ "aproba": "^1.1.1" } }, + "rxjs": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3680,6 +4447,12 @@ "ret": "~0.1.10" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", @@ -3769,6 +4542,17 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -4040,6 +4824,12 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "strip-json-comments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", + "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -4049,6 +4839,18 @@ "has-flag": "^3.0.0" } }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + } + }, "tapable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", @@ -4083,6 +4885,18 @@ "worker-farm": "^1.7.0" } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -4102,6 +4916,15 @@ "setimmediate": "^1.0.4" } }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -4150,9 +4973,9 @@ } }, "ts-loader": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-7.0.4.tgz", - "integrity": "sha512-5du6OQHl+4ZjO4crEyoYUyWSrmmo7bAO+inkaILZ68mvahqrfoa4nn0DRmpQ4ruT4l+cuJCgF0xD7SBIyLeeow==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-7.0.5.tgz", + "integrity": "sha512-zXypEIT6k3oTc+OZNx/cqElrsbBtYqDknf48OZos0NQ3RTt045fBIU8RRSu+suObBzYB355aIPGOe/3kj9h7Ig==", "dev": true, "requires": { "chalk": "^2.3.0", @@ -4198,40 +5021,25 @@ "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", "dev": true }, - "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.29.0" - } + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "requires": { - "tslib": "^1.8.1" + "prelude-ls": "^1.2.1" } }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "typedarray": { @@ -4241,9 +5049,9 @@ "dev": true }, "typescript": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", - "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", "dev": true }, "union-value": { @@ -4655,6 +5463,12 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "worker-farm": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", @@ -4681,6 +5495,15 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 55f1807d04..f3e802907c 100644 --- a/package.json +++ b/package.json @@ -27,16 +27,18 @@ "ts-node": "^6.2.0" }, "devDependencies": { - "@types/node": "^14.0.1", + "@types/node": "^14.0.5", + "@typescript-eslint/eslint-plugin": "^3.0.1", + "@typescript-eslint/parser": "^3.0.1", "browser-process-hrtime": "^1.0.0", "diff": "^4.0.2", + "eslint": "^7.1.0", "glob": "^7.1.6", "physical-cpu-count": "^2.0.0", "source-map-support": "^0.5.19", - "ts-loader": "^7.0.4", + "ts-loader": "^7.0.5", "ts-node": "^6.2.0", - "tslint": "^5.20.1", - "typescript": "^3.9.2", + "typescript": "^3.9.3", "webpack": "^4.43.0", "webpack-cli": "^3.3.11" }, @@ -52,9 +54,10 @@ "build:dts": "node scripts/build-dts && tsc --noEmit --target ESNEXT --module commonjs --experimentalDecorators tests/require/index-release", "build:sdk": "node scripts/build-sdk", "clean": "node scripts/clean", - "check": "npm run check:config && npm run check:compiler && tsc --noEmit --target ESNEXT --module commonjs --experimentalDecorators tests/require/index", + "check": "npm run check:config && npm run check:require && npm run check:lint", "check:config": "tsc --noEmit -p src --diagnostics --listFiles", - "check:compiler": "tslint -c tslint.json --project src --formatters-dir lib/lint/formatters --format as", + "check:require": "tsc --noEmit --target ESNEXT --module commonjs --experimentalDecorators tests/require/index", + "check:lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .", "test": "npm run test:parser && npm run test:compiler && npm run test:packages && npm run test:extension", "test:parser": "node tests/parser", "test:compiler": "node tests/compiler", diff --git a/scripts/build-dts.js b/scripts/build-dts.js index 35f52230f9..e44ce1f968 100644 --- a/scripts/build-dts.js +++ b/scripts/build-dts.js @@ -1,412 +1,409 @@ // © 2015-2019 SitePen, Inc. New BSD License. // see: https://github.com/SitePen/dts-generator -(function (factory) { - var v = factory(require, exports); - if (v !== undefined) module.exports = v; -})(function (require, exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - const fs = require("fs"); - const glob = require("glob"); - const mkdirp = require("mkdirp"); - const os = require("os"); - const pathUtil = require("path"); - const ts = require("typescript"); - // declare some constants so we don't have magic integers without explanation - const DTSLEN = '.d.ts'.length; - const filenameToMid = (function () { - if (pathUtil.sep === '/') { - return function (filename) { - return filename; - }; +(function() { + const fs = require("fs"); + const glob = require("glob"); + const mkdirp = require("mkdirp"); + const os = require("os"); + const pathUtil = require("path"); + const ts = require("typescript"); + + // declare some constants so we don't have magic integers without explanation + const DTSLEN = '.d.ts'.length; + const filenameToMid = (function () { + if (pathUtil.sep === '/') { + return function (filename) { + return filename; + }; + } + else { + const separatorExpression = new RegExp(pathUtil.sep.replace('\\', '\\\\'), 'g'); + return function (filename) { + return filename.replace(separatorExpression, '/'); + }; + } + })(); + + /** + * A helper function that takes TypeScript diagnostic errors and returns an error + * object. + * @param diagnostics The array of TypeScript Diagnostic objects + */ + function getError(diagnostics) { + let message = 'Declaration generation failed'; + diagnostics.forEach(function (diagnostic) { + // not all errors have an associated file: in particular, problems with a + // the tsconfig.json don't; the messageText is enough to diagnose in those + // cases. + if (diagnostic.file) { + const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + message += + `\n${diagnostic.file.fileName}(${position.line + 1},${position.character + 1}): ` + + `error TS${diagnostic.code}: ${diagnostic.messageText}`; + } + else { + message += `\nerror TS${diagnostic.code}: ${diagnostic.messageText}`; + } + }); + const error = new Error(message); + error.name = 'EmitterError'; + return error; + } + function getFilenames(baseDir, files) { + return files.map(function (filename) { + const resolvedFilename = pathUtil.resolve(filename); + if (resolvedFilename.indexOf(baseDir) === 0) { + return resolvedFilename; + } + return pathUtil.resolve(baseDir, filename); + }); + } + function processTree(sourceFile, replacer) { + let code = ''; + let cursorPosition = 0; + function skip(node) { + cursorPosition = node.end; + } + function readThrough(node) { + code += sourceFile.text.slice(cursorPosition, node.pos); + cursorPosition = node.pos; + } + function visit(node) { + readThrough(node); + const replacement = replacer(node); + if (replacement != null) { + code += replacement; + skip(node); + } + else { + ts.forEachChild(node, visit); + } + } + visit(sourceFile); + code += sourceFile.text.slice(cursorPosition); + return code; + } + /** + * Load and parse a TSConfig File + * @param options The dts-generator options to load config into + * @param fileName The path to the file + */ + function getTSConfig(fileName) { + // TODO this needs a better design than merging stuff into options. + // the trouble is what to do when no tsconfig is specified... + const configText = fs.readFileSync(fileName, { encoding: 'utf8' }); + const result = ts.parseConfigFileTextToJson(fileName, configText); + if (result.error) { + throw getError([result.error]); + } + const configObject = result.config; + const configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, pathUtil.dirname(fileName)); + if (configParseResult.errors && configParseResult.errors.length) { + throw getError(configParseResult.errors); + } + return [ + configParseResult.fileNames, + configParseResult.options + ]; + } + function isNodeKindImportDeclaration(value) { + return value && value.kind === ts.SyntaxKind.ImportDeclaration; + } + function isNodeKindExternalModuleReference(value) { + return value && value.kind === ts.SyntaxKind.ExternalModuleReference; + } + function isNodeKindStringLiteral(value) { + return value && value.kind === ts.SyntaxKind.StringLiteral; + } + function isNodeKindExportDeclaration(value) { + return value && value.kind === ts.SyntaxKind.ExportDeclaration; + } + function isNodeKindExportAssignment(value) { + return value && value.kind === ts.SyntaxKind.ExportAssignment; + } + function isNodeKindModuleDeclaration(value) { + return value && value.kind === ts.SyntaxKind.ModuleDeclaration; + } + function generate(options) { + if (Boolean(options.main) !== Boolean(options.name)) { + if (options.name) { + // since options.name used to do double duty as the prefix, let's be + // considerate and point out that name should be replaced with prefix. + // TODO update this error message when we finalize which version this change + // will be released in. + throw new Error(`name and main must be used together. Perhaps you want prefix instead of + name? In dts-generator version 2.1, name did double duty as the option to + use to prefix module names with, but in >=2.2 the name option was split + into two; prefix is what is now used to prefix imports and module names + in the output.`); + } + else { + throw new Error('name and main must be used together.'); + } + } + const noop = function () { /* nop */ }; + const sendMessage = options.sendMessage || noop; + const verboseMessage = options.verbose ? sendMessage : noop; + let compilerOptions = {}; + let files = options.files; + /* following tsc behaviour, if a project is specified, or if no files are specified then + * attempt to load tsconfig.json */ + if (options.project || !options.files || options.files.length === 0) { + verboseMessage(`project = "${options.project || options.baseDir}"`); + // if project isn't specified, use baseDir. If it is and it's a directory, + // assume we want tsconfig.json in that directory. If it is a file, though + // use that as our tsconfig.json. This allows for projects that have more + // than one tsconfig.json file. + let tsconfigFilename; + if (options.project) { + if (fs.lstatSync(options.project).isDirectory()) { + tsconfigFilename = pathUtil.join(options.project, 'tsconfig.json'); } else { - const separatorExpression = new RegExp(pathUtil.sep.replace('\\', '\\\\'), 'g'); - return function (filename) { - return filename.replace(separatorExpression, '/'); - }; + // project isn't a diretory, it's a file + tsconfigFilename = options.project; } - })(); - /** - * A helper function that takes TypeScript diagnostic errors and returns an error - * object. - * @param diagnostics The array of TypeScript Diagnostic objects - */ - function getError(diagnostics) { - let message = 'Declaration generation failed'; - diagnostics.forEach(function (diagnostic) { - // not all errors have an associated file: in particular, problems with a - // the tsconfig.json don't; the messageText is enough to diagnose in those - // cases. - if (diagnostic.file) { - const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); - message += - `\n${diagnostic.file.fileName}(${position.line + 1},${position.character + 1}): ` + - `error TS${diagnostic.code}: ${diagnostic.messageText}`; - } - else { - message += `\nerror TS${diagnostic.code}: ${diagnostic.messageText}`; - } + } + else { + tsconfigFilename = pathUtil.join(options.baseDir, 'tsconfig.json'); + } + if (fs.existsSync(tsconfigFilename)) { + verboseMessage(` parsing "${tsconfigFilename}"`); + [files, compilerOptions] = getTSConfig(tsconfigFilename); + } + else { + sendMessage(`No "tsconfig.json" found at "${tsconfigFilename}"!`); + return new Promise(function (resolve, reject) { + reject(new SyntaxError('Unable to resolve configuration.')); }); - const error = new Error(message); - error.name = 'EmitterError'; - return error; + } } - function getFilenames(baseDir, files) { - return files.map(function (filename) { - const resolvedFilename = pathUtil.resolve(filename); - if (resolvedFilename.indexOf(baseDir) === 0) { - return resolvedFilename; + const eol = options.eol || os.EOL; + const nonEmptyLineStart = new RegExp(eol + '(?!' + eol + '|$)', 'g'); + const indent = options.indent === undefined ? '\t' : options.indent; + // use input values if tsconfig leaves any of these undefined. + // this is for backwards compatibility + compilerOptions.declaration = true; + compilerOptions.target = compilerOptions.target || ts.ScriptTarget.Latest; // is this necessary? + compilerOptions.moduleResolution = compilerOptions.moduleResolution || options.moduleResolution; + compilerOptions.outDir = compilerOptions.outDir || options.outDir; + // TODO should compilerOptions.baseDir come into play? + const baseDir = pathUtil.resolve(compilerOptions.rootDir || options.project || options.baseDir); + const outDir = compilerOptions.outDir; + verboseMessage(`baseDir = "${baseDir}"`); + verboseMessage(`target = ${compilerOptions.target}`); + verboseMessage(`outDir = ${compilerOptions.outDir}`); + verboseMessage(`rootDir = ${compilerOptions.rootDir}`); + verboseMessage(`moduleResolution = ${compilerOptions.moduleResolution}`); + const filenames = getFilenames(baseDir, files); + verboseMessage('filenames:'); + filenames.forEach(name => { verboseMessage(' ' + name); }); + const excludesMap = {}; + options.exclude = options.exclude || ['node_modules/**/*.d.ts']; + options.exclude && options.exclude.forEach(function (filename) { + glob.sync(filename, { cwd: baseDir }).forEach(function (globFileName) { + excludesMap[filenameToMid(pathUtil.resolve(baseDir, globFileName))] = true; + }); + }); + if (options.exclude) { + verboseMessage('exclude:'); + options.exclude.forEach(name => { verboseMessage(' ' + name); }); + } + if (!options.stdout) mkdirp.sync(pathUtil.dirname(options.out)); + /* node.js typings are missing the optional mode in createWriteStream options and therefore + * in TS 1.6 the strict object literal checking is throwing, therefore a hammer to the nut */ + const output = options.stdout || fs.createWriteStream(options.out, { mode: parseInt('644', 8) }); + const host = ts.createCompilerHost(compilerOptions); + const program = ts.createProgram(filenames, compilerOptions, host); + function writeFile(filename, data) { + // Compiler is emitting the non-declaration file, which we do not care about + if (filename.slice(-DTSLEN) !== '.d.ts') { + return; + } + writeDeclaration(ts.createSourceFile(filename, data, compilerOptions.target, true), true); + } + let declaredExternalModules = []; + return new Promise(function (resolve, reject) { + output.on('close', () => { resolve(undefined); }); + output.on('error', reject); + if (options.externs) { + options.externs.forEach(function (path) { + sendMessage(`Writing external dependency ${path}`); + output.write(`/// ` + eol); + }); + } + if (options.types) { + options.types.forEach(function (type) { + sendMessage(`Writing external @types package dependency ${type}`); + output.write(`/// ` + eol); + }); + } + sendMessage('processing:'); + let mainExportDeclaration = false; + let mainExportAssignment = false; + let foundMain = false; + program.getSourceFiles().forEach(function (sourceFile) { + processTree(sourceFile, function (node) { + if (isNodeKindModuleDeclaration(node)) { + const name = node.name; + if (isNodeKindStringLiteral(name)) { + declaredExternalModules.push(name.text); } - return pathUtil.resolve(baseDir, filename); + } + return null; }); - } - function processTree(sourceFile, replacer) { - let code = ''; - let cursorPosition = 0; - function skip(node) { - cursorPosition = node.end; + }); + program.getSourceFiles().some(function (sourceFile) { + // Source file is a default library, or other dependency from another project, that should not be included in + // our bundled output + if (pathUtil.normalize(sourceFile.fileName).indexOf(baseDir + pathUtil.sep) !== 0) { + return; } - function readThrough(node) { - code += sourceFile.text.slice(cursorPosition, node.pos); - cursorPosition = node.pos; + if (excludesMap[filenameToMid(pathUtil.normalize(sourceFile.fileName))]) { + return; } - function visit(node) { - readThrough(node); - const replacement = replacer(node); - if (replacement != null) { - code += replacement; - skip(node); - } - else { - ts.forEachChild(node, visit); - } + sendMessage(` ${sourceFile.fileName}`); + // Source file is already a declaration file so should does not need to be pre-processed by the emitter + if (sourceFile.fileName.slice(-DTSLEN) === '.d.ts') { + writeDeclaration(sourceFile, false); + return; } - visit(sourceFile); - code += sourceFile.text.slice(cursorPosition); - return code; - } - /** - * Load and parse a TSConfig File - * @param options The dts-generator options to load config into - * @param fileName The path to the file - */ - function getTSConfig(fileName) { - // TODO this needs a better design than merging stuff into options. - // the trouble is what to do when no tsconfig is specified... - const configText = fs.readFileSync(fileName, { encoding: 'utf8' }); - const result = ts.parseConfigFileTextToJson(fileName, configText); - if (result.error) { - throw getError([result.error]); + // We can optionally output the main module if there's something to export. + if (options.main && options.main === (options.prefix + filenameToMid(sourceFile.fileName.slice(baseDir.length, -3)))) { + foundMain = true; + ts.forEachChild(sourceFile, function (node) { + mainExportDeclaration = mainExportDeclaration || isNodeKindExportDeclaration(node); + mainExportAssignment = mainExportAssignment || isNodeKindExportAssignment(node); + }); } - const configObject = result.config; - const configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, pathUtil.dirname(fileName)); - if (configParseResult.errors && configParseResult.errors.length) { - throw getError(configParseResult.errors); + const emitOutput = program.emit(sourceFile, writeFile); + if (emitOutput.emitSkipped || emitOutput.diagnostics.length > 0) { + reject(getError(emitOutput.diagnostics + .concat(program.getSemanticDiagnostics(sourceFile)) + .concat(program.getSyntacticDiagnostics(sourceFile)) + .concat(program.getDeclarationDiagnostics(sourceFile)))); + return true; } - return [ - configParseResult.fileNames, - configParseResult.options - ]; - } - function isNodeKindImportDeclaration(value) { - return value && value.kind === ts.SyntaxKind.ImportDeclaration; - } - function isNodeKindExternalModuleReference(value) { - return value && value.kind === ts.SyntaxKind.ExternalModuleReference; - } - function isNodeKindStringLiteral(value) { - return value && value.kind === ts.SyntaxKind.StringLiteral; - } - function isNodeKindExportDeclaration(value) { - return value && value.kind === ts.SyntaxKind.ExportDeclaration; - } - function isNodeKindExportAssignment(value) { - return value && value.kind === ts.SyntaxKind.ExportAssignment; - } - function isNodeKindModuleDeclaration(value) { - return value && value.kind === ts.SyntaxKind.ModuleDeclaration; - } - function generate(options) { - if (Boolean(options.main) !== Boolean(options.name)) { - if (Boolean(options.name)) { - // since options.name used to do double duty as the prefix, let's be - // considerate and point out that name should be replaced with prefix. - // TODO update this error message when we finalize which version this change - // will be released in. - throw new Error(`name and main must be used together. Perhaps you want prefix instead of - name? In dts-generator version 2.1, name did double duty as the option to - use to prefix module names with, but in >=2.2 the name option was split - into two; prefix is what is now used to prefix imports and module names - in the output.`); - } - else { - throw new Error('name and main must be used together.'); - } + }); + if (options.main && !foundMain) { + throw new Error(`main module ${options.main} was not found`); + } + if (options.main) { + output.write(`declare module '${options.name}' {` + eol + indent); + if (compilerOptions.target >= ts.ScriptTarget.ES2015) { + if (mainExportAssignment) { + output.write(`export {default} from '${options.main}';` + eol + indent); + } + if (mainExportDeclaration) { + output.write(`export * from '${options.main}';` + eol); + } } - const noop = function () { }; - const sendMessage = options.sendMessage || noop; - const verboseMessage = options.verbose ? sendMessage : noop; - let compilerOptions = {}; - let files = options.files; - /* following tsc behaviour, if a project is specified, or if no files are specified then - * attempt to load tsconfig.json */ - if (options.project || !options.files || options.files.length === 0) { - verboseMessage(`project = "${options.project || options.baseDir}"`); - // if project isn't specified, use baseDir. If it is and it's a directory, - // assume we want tsconfig.json in that directory. If it is a file, though - // use that as our tsconfig.json. This allows for projects that have more - // than one tsconfig.json file. - let tsconfigFilename; - if (Boolean(options.project)) { - if (fs.lstatSync(options.project).isDirectory()) { - tsconfigFilename = pathUtil.join(options.project, 'tsconfig.json'); - } - else { - // project isn't a diretory, it's a file - tsconfigFilename = options.project; - } - } - else { - tsconfigFilename = pathUtil.join(options.baseDir, 'tsconfig.json'); - } - if (fs.existsSync(tsconfigFilename)) { - verboseMessage(` parsing "${tsconfigFilename}"`); - [files, compilerOptions] = getTSConfig(tsconfigFilename); - } - else { - sendMessage(`No "tsconfig.json" found at "${tsconfigFilename}"!`); - return new Promise(function ({}, reject) { - reject(new SyntaxError('Unable to resolve configuration.')); - }); - } + else { + output.write(`import main = require('${options.main}');` + eol + indent); + output.write('export = main;' + eol); } - const eol = options.eol || os.EOL; - const nonEmptyLineStart = new RegExp(eol + '(?!' + eol + '|$)', 'g'); - const indent = options.indent === undefined ? '\t' : options.indent; - // use input values if tsconfig leaves any of these undefined. - // this is for backwards compatibility - compilerOptions.declaration = true; - compilerOptions.target = compilerOptions.target || ts.ScriptTarget.Latest; // is this necessary? - compilerOptions.moduleResolution = compilerOptions.moduleResolution || options.moduleResolution; - compilerOptions.outDir = compilerOptions.outDir || options.outDir; - // TODO should compilerOptions.baseDir come into play? - const baseDir = pathUtil.resolve(compilerOptions.rootDir || options.project || options.baseDir); - const outDir = compilerOptions.outDir; - verboseMessage(`baseDir = "${baseDir}"`); - verboseMessage(`target = ${compilerOptions.target}`); - verboseMessage(`outDir = ${compilerOptions.outDir}`); - verboseMessage(`rootDir = ${compilerOptions.rootDir}`); - verboseMessage(`moduleResolution = ${compilerOptions.moduleResolution}`); - const filenames = getFilenames(baseDir, files); - verboseMessage('filenames:'); - filenames.forEach(name => { verboseMessage(' ' + name); }); - const excludesMap = {}; - options.exclude = options.exclude || ['node_modules/**/*.d.ts']; - options.exclude && options.exclude.forEach(function (filename) { - glob.sync(filename, { cwd: baseDir }).forEach(function (globFileName) { - excludesMap[filenameToMid(pathUtil.resolve(baseDir, globFileName))] = true; - }); - }); - if (options.exclude) { - verboseMessage('exclude:'); - options.exclude.forEach(name => { verboseMessage(' ' + name); }); + output.write('}' + eol); + sendMessage(`Aliased main module ${options.name} to ${options.main}`); + } + if (!options.stdout) { + sendMessage(`output to "${options.out}"`); + output.end(); + } + }); + function writeDeclaration(declarationFile, isOutput) { + // resolving is important for dealting with relative outDirs + const filename = pathUtil.resolve(declarationFile.fileName); + // use the outDir here, not the baseDir, because the declarationFiles are + // outputs of the build process; baseDir points instead to the inputs. + // However we have to account for .d.ts files in our inputs that this code + // is also used for. Also if no outDir is used, the compiled code ends up + // alongside the source, so use baseDir in that case too. + const outputDir = (isOutput && Boolean(outDir)) ? pathUtil.resolve(outDir) : baseDir; + const sourceModuleId = filenameToMid(filename.slice(outputDir.length + 1, -DTSLEN)); + const currentModuleId = filenameToMid(filename.slice(outputDir.length + 1, -DTSLEN)); + function resolveModuleImport(moduleId) { + const isDeclaredExternalModule = declaredExternalModules.indexOf(moduleId) !== -1; + let resolved; + if (options.resolveModuleImport) { + resolved = options.resolveModuleImport({ + importedModuleId: moduleId, + currentModuleId: currentModuleId, + isDeclaredExternalModule: isDeclaredExternalModule + }); } - if (!options.stdout) mkdirp.sync(pathUtil.dirname(options.out)); - /* node.js typings are missing the optional mode in createWriteStream options and therefore - * in TS 1.6 the strict object literal checking is throwing, therefore a hammer to the nut */ - const output = options.stdout || fs.createWriteStream(options.out, { mode: parseInt('644', 8) }); - const host = ts.createCompilerHost(compilerOptions); - const program = ts.createProgram(filenames, compilerOptions, host); - function writeFile(filename, data) { - // Compiler is emitting the non-declaration file, which we do not care about - if (filename.slice(-DTSLEN) !== '.d.ts') { - return; - } - writeDeclaration(ts.createSourceFile(filename, data, compilerOptions.target, true), true); + if (!resolved) { + // resolve relative imports relative to the current module id. + if (moduleId.charAt(0) === '.') { + resolved = filenameToMid(pathUtil.join(pathUtil.dirname(sourceModuleId), moduleId)); + } + else { + resolved = moduleId; + } + // prefix the import with options.prefix, so that both non-relative imports + // and relative imports end up prefixed with options.prefix. We only + // do this when no resolveModuleImport function is given so that that + // function has complete control of the imports that get outputed. + // NOTE: we may want to revisit the isDeclaredExternalModule behavior. + // discussion is on https://github.com/SitePen/dts-generator/pull/94 + // but currently there's no strong argument against this behavior. + if (Boolean(options.prefix) && !isDeclaredExternalModule) { + resolved = `${options.prefix}/${resolved}`; + } } - let declaredExternalModules = []; - return new Promise(function (resolve, reject) { - output.on('close', () => { resolve(undefined); }); - output.on('error', reject); - if (options.externs) { - options.externs.forEach(function (path) { - sendMessage(`Writing external dependency ${path}`); - output.write(`/// ` + eol); - }); - } - if (options.types) { - options.types.forEach(function (type) { - sendMessage(`Writing external @types package dependency ${type}`); - output.write(`/// ` + eol); - }); - } - sendMessage('processing:'); - let mainExportDeclaration = false; - let mainExportAssignment = false; - let foundMain = false; - program.getSourceFiles().forEach(function (sourceFile) { - processTree(sourceFile, function (node) { - if (isNodeKindModuleDeclaration(node)) { - const name = node.name; - if (isNodeKindStringLiteral(name)) { - declaredExternalModules.push(name.text); - } - } - return null; - }); - }); - program.getSourceFiles().some(function (sourceFile) { - // Source file is a default library, or other dependency from another project, that should not be included in - // our bundled output - if (pathUtil.normalize(sourceFile.fileName).indexOf(baseDir + pathUtil.sep) !== 0) { - return; - } - if (excludesMap[filenameToMid(pathUtil.normalize(sourceFile.fileName))]) { - return; - } - sendMessage(` ${sourceFile.fileName}`); - // Source file is already a declaration file so should does not need to be pre-processed by the emitter - if (sourceFile.fileName.slice(-DTSLEN) === '.d.ts') { - writeDeclaration(sourceFile, false); - return; - } - // We can optionally output the main module if there's something to export. - if (options.main && options.main === (options.prefix + filenameToMid(sourceFile.fileName.slice(baseDir.length, -3)))) { - foundMain = true; - ts.forEachChild(sourceFile, function (node) { - mainExportDeclaration = mainExportDeclaration || isNodeKindExportDeclaration(node); - mainExportAssignment = mainExportAssignment || isNodeKindExportAssignment(node); - }); - } - const emitOutput = program.emit(sourceFile, writeFile); - if (emitOutput.emitSkipped || emitOutput.diagnostics.length > 0) { - reject(getError(emitOutput.diagnostics - .concat(program.getSemanticDiagnostics(sourceFile)) - .concat(program.getSyntacticDiagnostics(sourceFile)) - .concat(program.getDeclarationDiagnostics(sourceFile)))); - return true; - } - }); - if (options.main && !foundMain) { - throw new Error(`main module ${options.main} was not found`); - } - if (options.main) { - output.write(`declare module '${options.name}' {` + eol + indent); - if (compilerOptions.target >= ts.ScriptTarget.ES2015) { - if (mainExportAssignment) { - output.write(`export {default} from '${options.main}';` + eol + indent); - } - if (mainExportDeclaration) { - output.write(`export * from '${options.main}';` + eol); - } - } - else { - output.write(`import main = require('${options.main}');` + eol + indent); - output.write('export = main;' + eol); - } - output.write('}' + eol); - sendMessage(`Aliased main module ${options.name} to ${options.main}`); - } - if (!options.stdout) { - sendMessage(`output to "${options.out}"`); - output.end(); + return resolved; + } + /* For some reason, SourceFile.externalModuleIndicator is missing from 1.6+, so having + * to use a sledgehammer on the nut */ + if (declarationFile.externalModuleIndicator) { + let resolvedModuleId = sourceModuleId; + if (options.resolveModuleId) { + const resolveModuleIdResult = options.resolveModuleId({ + currentModuleId: currentModuleId + }); + if (resolveModuleIdResult) { + resolvedModuleId = resolveModuleIdResult; + } + else if (options.prefix) { + resolvedModuleId = `${options.prefix}/${resolvedModuleId}`; + } + } + else if (options.prefix) { + resolvedModuleId = `${options.prefix}/${resolvedModuleId}`; + } + output.write('declare module \'' + resolvedModuleId + '\' {' + eol + indent); + const content = processTree(declarationFile, function (node) { + if (isNodeKindExternalModuleReference(node)) { + // TODO figure out if this branch is possible, and if so, write a test + // that covers it. + const expression = node.expression; + // convert both relative and non-relative module names in import = require(...) + // statements. + const resolved = resolveModuleImport(expression.text); + return ` require('${resolved}')`; + } + else if (node.kind === ts.SyntaxKind.DeclareKeyword) { + return ''; + } + else if (isNodeKindStringLiteral(node) && node.parent && + (isNodeKindExportDeclaration(node.parent) || isNodeKindImportDeclaration(node.parent))) { + // This block of code is modifying the names of imported modules + const text = node.text; + const resolved = resolveModuleImport(text); + if (resolved) { + return ` '${resolved}'`; } + } }); - function writeDeclaration(declarationFile, isOutput) { - // resolving is important for dealting with relative outDirs - const filename = pathUtil.resolve(declarationFile.fileName); - // use the outDir here, not the baseDir, because the declarationFiles are - // outputs of the build process; baseDir points instead to the inputs. - // However we have to account for .d.ts files in our inputs that this code - // is also used for. Also if no outDir is used, the compiled code ends up - // alongside the source, so use baseDir in that case too. - const outputDir = (isOutput && Boolean(outDir)) ? pathUtil.resolve(outDir) : baseDir; - const sourceModuleId = filenameToMid(filename.slice(outputDir.length + 1, -DTSLEN)); - const currentModuleId = filenameToMid(filename.slice(outputDir.length + 1, -DTSLEN)); - function resolveModuleImport(moduleId) { - const isDeclaredExternalModule = declaredExternalModules.indexOf(moduleId) !== -1; - let resolved; - if (options.resolveModuleImport) { - resolved = options.resolveModuleImport({ - importedModuleId: moduleId, - currentModuleId: currentModuleId, - isDeclaredExternalModule: isDeclaredExternalModule - }); - } - if (!resolved) { - // resolve relative imports relative to the current module id. - if (moduleId.charAt(0) === '.') { - resolved = filenameToMid(pathUtil.join(pathUtil.dirname(sourceModuleId), moduleId)); - } - else { - resolved = moduleId; - } - // prefix the import with options.prefix, so that both non-relative imports - // and relative imports end up prefixed with options.prefix. We only - // do this when no resolveModuleImport function is given so that that - // function has complete control of the imports that get outputed. - // NOTE: we may want to revisit the isDeclaredExternalModule behavior. - // discussion is on https://github.com/SitePen/dts-generator/pull/94 - // but currently there's no strong argument against this behavior. - if (Boolean(options.prefix) && !isDeclaredExternalModule) { - resolved = `${options.prefix}/${resolved}`; - } - } - return resolved; - } - /* For some reason, SourceFile.externalModuleIndicator is missing from 1.6+, so having - * to use a sledgehammer on the nut */ - if (declarationFile.externalModuleIndicator) { - let resolvedModuleId = sourceModuleId; - if (options.resolveModuleId) { - const resolveModuleIdResult = options.resolveModuleId({ - currentModuleId: currentModuleId - }); - if (resolveModuleIdResult) { - resolvedModuleId = resolveModuleIdResult; - } - else if (options.prefix) { - resolvedModuleId = `${options.prefix}/${resolvedModuleId}`; - } - } - else if (options.prefix) { - resolvedModuleId = `${options.prefix}/${resolvedModuleId}`; - } - output.write('declare module \'' + resolvedModuleId + '\' {' + eol + indent); - const content = processTree(declarationFile, function (node) { - if (isNodeKindExternalModuleReference(node)) { - // TODO figure out if this branch is possible, and if so, write a test - // that covers it. - const expression = node.expression; - // convert both relative and non-relative module names in import = require(...) - // statements. - const resolved = resolveModuleImport(expression.text); - return ` require('${resolved}')`; - } - else if (node.kind === ts.SyntaxKind.DeclareKeyword) { - return ''; - } - else if (isNodeKindStringLiteral(node) && node.parent && - (isNodeKindExportDeclaration(node.parent) || isNodeKindImportDeclaration(node.parent))) { - // This block of code is modifying the names of imported modules - const text = node.text; - const resolved = resolveModuleImport(text); - if (resolved) { - return ` '${resolved}'`; - } - } - }); - output.write(content.replace(nonEmptyLineStart, '$&' + indent)); - output.write(eol + '}' + eol); - } - else { - output.write(declarationFile.text); - } - } + output.write(content.replace(nonEmptyLineStart, '$&' + indent)); + output.write(eol + '}' + eol); + } + else { + output.write(declarationFile.text); + } } - exports.default = generate; -}); + } + exports.default = generate; +})(); const path = require("path"); const fs = require("fs"); @@ -414,19 +411,19 @@ const stream = require("stream"); const util = require("util"); function OutputStream(options) { - stream.Writable.call(this, options); - this.chunks = []; + stream.Writable.call(this, options); + this.chunks = []; } util.inherits(OutputStream, stream.Writable); -OutputStream.prototype._write = function(chunk, enc, cb) { - this.chunks.push(chunk); - cb(); +OutputStream.prototype._write = function (chunk, enc, cb) { + this.chunks.push(chunk); + cb(); }; -OutputStream.prototype.toBuffer = function() { - return Buffer.concat(this.chunks); +OutputStream.prototype.toBuffer = function () { + return Buffer.concat(this.chunks); }; -OutputStream.prototype.toString = function() { - return this.toBuffer().toString("utf8"); +OutputStream.prototype.toString = function () { + return this.toBuffer().toString("utf8"); }; const stdout = new OutputStream(); @@ -436,27 +433,27 @@ stdout.write(`declare module 'assemblyscript' { `); module.exports.default({ - project: path.resolve(__dirname, "..", "src"), - prefix: "assemblyscript", - exclude: [ - "glue/js/index.ts", - "glue/js/node.d.ts", - "glue/binaryen.d.ts" - ], - verbose: true, - sendMessage: console.log, - stdout: stdout + project: path.resolve(__dirname, "..", "src"), + prefix: "assemblyscript", + exclude: [ + "glue/js/index.ts", + "glue/js/node.d.ts", + "glue/binaryen.d.ts" + ], + verbose: true, + sendMessage: console.log, + stdout: stdout }); stdout.write("\n"); module.exports.default({ - project: path.resolve(__dirname, "..", "std/assembly/shared"), - prefix: "assemblyscript/std/assembly/shared", - exclude: [], - verbose: true, - sendMessage: console.log, - stdout: stdout + project: path.resolve(__dirname, "..", "std/assembly/shared"), + prefix: "assemblyscript/std/assembly/shared", + exclude: [], + verbose: true, + sendMessage: console.log, + stdout: stdout }); var source = stdout.toString().replace(/\/\/\/ ]*>\r?\n/g, ""); @@ -467,32 +464,32 @@ const sourceFile = ts.createSourceFile("assemblyscript.d.ts", source, ts.ScriptT console.log("transforming:"); var numReplaced = 0; const result = ts.transform(sourceFile, [ - function(context) { - const visit = node => { - node = ts.visitEachChild(node, visit, context); - if (ts.isTypeNode(node)) { - const name = node.getText(sourceFile); - switch (name) { - // this is wrong, but works - case "bool": ++numReplaced; return ts.createIdentifier("boolean"); - default: if (!/^(?:Binaryen|Relooper)/.test(name)) break; - case "i8": case "i16": case "i32": case "isize": - case "u8": case "u16": case "u32": case "usize": - case "f32": case "f64": ++numReplaced; return ts.createIdentifier("number"); - } - } - return node; - }; - return node => ts.visitNode(node, visit); - } + function (context) { + const visit = node => { + node = ts.visitEachChild(node, visit, context); + if (ts.isTypeNode(node)) { + const name = node.getText(sourceFile); + switch (name) { + // this is wrong, but works + case "bool": ++numReplaced; return ts.createIdentifier("boolean"); + default: if (!/^(?:Binaryen|Relooper)/.test(name)) break; + case "i8": case "i16": case "i32": case "isize": + case "u8": case "u16": case "u32": case "usize": + case "f32": case "f64": ++numReplaced; return ts.createIdentifier("number"); + } + } + return node; + }; + return node => ts.visitNode(node, visit); + } ]); console.log(" replaced " + numReplaced + " AS types with JS types"); if (!fs.existsSync(path.join(__dirname, "..", "dist"))) { - fs.mkdirSync(path.join(__dirname, "..", "dist")); + fs.mkdirSync(path.join(__dirname, "..", "dist")); } fs.writeFileSync( - path.resolve(__dirname, "..", "dist", "assemblyscript.d.ts"), - ts.createPrinter().printFile(result.transformed[0]), - "utf8" + path.resolve(__dirname, "..", "dist", "assemblyscript.d.ts"), + ts.createPrinter().printFile(result.transformed[0]), + "utf8" ); diff --git a/scripts/build.js b/scripts/build.js index 245be4fbd3..9e6d573d49 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,5 +1,6 @@ const webpack = require("webpack"); +const config = require("../webpack.config.js"); -webpack(require("../webpack.config.js"), (err, stats) => { +webpack(config, err => { if (err) throw err; }); diff --git a/scripts/hexfloat.js b/scripts/hexfloat.js index b1a90d5e6a..f7807a7498 100644 --- a/scripts/hexfloat.js +++ b/scripts/hexfloat.js @@ -23,60 +23,60 @@ */ // see: https://github.com/maurobringolf/webassembly-floating-point-hex-parser function parse(input) { - input = input.toUpperCase(); - const splitIndex = input.indexOf('P'); - let mantissa, exponent; + input = input.toUpperCase(); + const splitIndex = input.indexOf('P'); + let mantissa, exponent; - if (splitIndex !== -1) { - mantissa = input.substring(0, splitIndex); - exponent = parseInt(input.substring(splitIndex + 1)); - } else { - mantissa = input; - exponent = 0; - } + if (splitIndex !== -1) { + mantissa = input.substring(0, splitIndex); + exponent = parseInt(input.substring(splitIndex + 1)); + } else { + mantissa = input; + exponent = 0; + } - const dotIndex = mantissa.indexOf('.'); + const dotIndex = mantissa.indexOf('.'); - if (dotIndex !== -1) { - let integerPart = parseInt(mantissa.substring(0,dotIndex), 16); - let sign = Math.sign(integerPart); - integerPart = sign * integerPart; - const fractionLength = mantissa.length - dotIndex - 1; - const fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16); - const fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0; - if (sign === 0) { - if (fraction === 0) { - mantissa = sign; - } else { - if (Object.is(sign, -0)) { - mantissa = - fraction; - } else { - mantissa = fraction; - } - } - } else { - mantissa = sign * (integerPart + fraction); - } - } else { - mantissa = parseInt(mantissa, 16); - } + if (dotIndex !== -1) { + let integerPart = parseInt(mantissa.substring(0, dotIndex), 16); + let sign = Math.sign(integerPart); + integerPart = sign * integerPart; + const fractionLength = mantissa.length - dotIndex - 1; + const fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16); + const fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0; + if (sign === 0) { + if (fraction === 0) { + mantissa = sign; + } else { + if (Object.is(sign, -0)) { + mantissa = - fraction; + } else { + mantissa = fraction; + } + } + } else { + mantissa = sign * (integerPart + fraction); + } + } else { + mantissa = parseInt(mantissa, 16); + } - return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1); + return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1); } if (typeof process !== "undefined") { - if (process.argv.length < 3) { - console.error("Usage: hexfloat 0x1p1023"); - process.exit(1); - } + if (process.argv.length < 3) { + console.error("Usage: hexfloat 0x1p1023"); + process.exit(1); + } - var output = parse(process.argv[2]); - var double = output.toPrecision(18); // 17 - var single = output.toPrecision(10); // 9 + var output = parse(process.argv[2]); + var double = output.toPrecision(18); // 17 + var single = output.toPrecision(10); // 9 - console.log("" + double); - console.log("" + single); + console.log("" + double); + console.log("" + single); - if (!(parseFloat(double) === output)) throw Error("double precision error"); - if (!(Math.fround(parseFloat(single)) === Math.fround(output))) throw Error("single precision error"); + if (!(parseFloat(double) === output)) throw Error("double precision error"); + if (!(Math.fround(parseFloat(single)) === Math.fround(output))) throw Error("single precision error"); } diff --git a/src/builtins.ts b/src/builtins.ts index fa363468f6..2ddeed6264 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -2551,7 +2551,6 @@ function builtin_memory_data(ctx: BuiltinContext): ExpressionRef { compiler.currentType = usizeType; return module.unreachable(); } - let nativeElementType = elementType.toNativeType(); let valuesOperand = operands[0]; if (valuesOperand.kind != NodeKind.LITERAL || (valuesOperand).literalKind != LiteralKind.ARRAY) { compiler.error( @@ -4121,20 +4120,20 @@ function builtin_v128_eq(ctx: BuiltinContext): ExpressionRef { if (!type.is(TypeFlags.REFERENCE)) { switch (type.kind) { case TypeKind.I8: - case TypeKind.U8: return module.binary(BinaryOp.EqI8x16, arg0, arg1); - case TypeKind.I16: - case TypeKind.U16: return module.binary(BinaryOp.EqI16x8, arg0, arg1); - case TypeKind.I32: - case TypeKind.U32: return module.binary(BinaryOp.EqI32x4, arg0, arg1); - case TypeKind.ISIZE: - case TypeKind.USIZE: { - if (!compiler.options.isWasm64) { - return module.binary(BinaryOp.EqI32x4, arg0, arg1); - } - break; + case TypeKind.U8: return module.binary(BinaryOp.EqI8x16, arg0, arg1); + case TypeKind.I16: + case TypeKind.U16: return module.binary(BinaryOp.EqI16x8, arg0, arg1); + case TypeKind.I32: + case TypeKind.U32: return module.binary(BinaryOp.EqI32x4, arg0, arg1); + case TypeKind.ISIZE: + case TypeKind.USIZE: { + if (!compiler.options.isWasm64) { + return module.binary(BinaryOp.EqI32x4, arg0, arg1); } - case TypeKind.F32: return module.binary(BinaryOp.EqF32x4, arg0, arg1); - case TypeKind.F64: return module.binary(BinaryOp.EqF64x2, arg0, arg1); + break; + } + case TypeKind.F32: return module.binary(BinaryOp.EqF32x4, arg0, arg1); + case TypeKind.F64: return module.binary(BinaryOp.EqF64x2, arg0, arg1); } } compiler.error( @@ -4165,20 +4164,20 @@ function builtin_v128_ne(ctx: BuiltinContext): ExpressionRef { if (!type.is(TypeFlags.REFERENCE)) { switch (type.kind) { case TypeKind.I8: - case TypeKind.U8: return module.binary(BinaryOp.NeI8x16, arg0, arg1); - case TypeKind.I16: - case TypeKind.U16: return module.binary(BinaryOp.NeI16x8, arg0, arg1); - case TypeKind.I32: - case TypeKind.U32: return module.binary(BinaryOp.NeI32x4, arg0, arg1); - case TypeKind.ISIZE: - case TypeKind.USIZE: { - if (!compiler.options.isWasm64) { - return module.binary(BinaryOp.NeI32x4, arg0, arg1); - } - break; + case TypeKind.U8: return module.binary(BinaryOp.NeI8x16, arg0, arg1); + case TypeKind.I16: + case TypeKind.U16: return module.binary(BinaryOp.NeI16x8, arg0, arg1); + case TypeKind.I32: + case TypeKind.U32: return module.binary(BinaryOp.NeI32x4, arg0, arg1); + case TypeKind.ISIZE: + case TypeKind.USIZE: { + if (!compiler.options.isWasm64) { + return module.binary(BinaryOp.NeI32x4, arg0, arg1); } - case TypeKind.F32: return module.binary(BinaryOp.NeF32x4, arg0, arg1); - case TypeKind.F64: return module.binary(BinaryOp.NeF64x2, arg0, arg1); + break; + } + case TypeKind.F32: return module.binary(BinaryOp.NeF32x4, arg0, arg1); + case TypeKind.F64: return module.binary(BinaryOp.NeF64x2, arg0, arg1); } } compiler.error( diff --git a/src/compiler.ts b/src/compiler.ts index f4f08bbf48..c2fb1490cd 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -2827,9 +2827,9 @@ export class Compiler extends DiagnosticEmitter { // otherwise br to default respectively out of the switch if there is no default case breaks[breakIndex] = module.br((defaultIndex >= 0 - ? "case" + defaultIndex.toString() - : "break" - ) + "|" + context); + ? "case" + defaultIndex.toString() + : "break" + ) + "|" + context); // nest blocks in order var currentBlock = module.block("case0|" + context, breaks, NativeType.None); @@ -4236,7 +4236,7 @@ export class Compiler extends DiagnosticEmitter { leftExpr = this.compileExpression(left, contextualType); leftType = this.currentType; - // check operator overload + // check operator overload if (operator == Token.EQUALS_EQUALS && this.currentType.is(TypeFlags.REFERENCE)) { let classReference = leftType.classReference; if (classReference) { @@ -4337,7 +4337,7 @@ export class Compiler extends DiagnosticEmitter { leftExpr = this.compileExpression(left, contextualType); leftType = this.currentType; - // check operator overload + // check operator overload if (operator == Token.EXCLAMATION_EQUALS && this.currentType.is(TypeFlags.REFERENCE)) { let classReference = leftType.classReference; if (classReference) { diff --git a/src/definitions.ts b/src/definitions.ts index a3668c7cdc..0c2f05646b 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -38,7 +38,7 @@ import { import { SourceKind - } from "./ast"; +} from "./ast"; import { indent diff --git a/src/diagnostics.ts b/src/diagnostics.ts index f32723fba3..b145714c75 100644 --- a/src/diagnostics.ts +++ b/src/diagnostics.ts @@ -275,7 +275,8 @@ export abstract class DiagnosticEmitter { /** Initializes this diagnostic emitter. */ protected constructor(diagnostics: DiagnosticMessage[] | null = null) { - this.diagnostics = diagnostics ? diagnostics : new Array(); + if (!diagnostics) diagnostics = new Array(); + this.diagnostics = diagnostics; } /** Emits a diagnostic message of the specified category. */ diff --git a/src/extra/ast.ts b/src/extra/ast.ts index 5e4cdb3ced..855234a022 100644 --- a/src/extra/ast.ts +++ b/src/extra/ast.ts @@ -44,7 +44,6 @@ import { ClassExpression, ObjectLiteralExpression, - Statement, BlockStatement, BreakStatement, ContinueStatement, @@ -971,6 +970,7 @@ export class ASTBuilder { } visitEmptyStatement(node: EmptyStatement): void { + /* nop */ } visitEnumDeclaration(node: EnumDeclaration, isDefault: bool = false): void { diff --git a/src/flow.ts b/src/flow.ts index 4a5caa880e..1c88ab3a28 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -200,7 +200,9 @@ export class Flow { private constructor( /** Function this flow belongs to. */ public parentFunction: Function - ) {} + ) { + /* nop */ + } /** Parent flow. */ parent: Flow | null = null; @@ -1219,7 +1221,8 @@ export class Flow { getExpressionId(operand = getBinaryRight(expr)) == ExpressionId.Const && getConstValueI32(operand) > shift // must clear MSB ) - : this.canOverflow(getBinaryLeft(expr), type) && !( + : this.canOverflow(getBinaryLeft(expr), type) && + !( getExpressionId(operand = getBinaryRight(expr)) == ExpressionId.Const && getConstValueI32(operand) >= shift // can leave MSB ); diff --git a/src/glue/js/float.js b/src/glue/js/float.js index 0ab2809b5b..ee3992b149 100644 --- a/src/glue/js/float.js +++ b/src/glue/js/float.js @@ -3,6 +3,8 @@ * @license Apache-2.0 */ +/* eslint-disable no-undef */ + const F64 = new Float64Array(1); const F32 = new Float32Array(F64.buffer); const I32 = new Int32Array(F64.buffer); diff --git a/src/glue/js/i64.js b/src/glue/js/i64.js index 1aafab9730..18b70578f5 100644 --- a/src/glue/js/i64.js +++ b/src/glue/js/i64.js @@ -3,6 +3,8 @@ * @license Apache-2.0 */ +/* eslint-disable no-undef */ + const Long = global.Long || require("long"); global.i64_zero = Long.ZERO; diff --git a/src/glue/js/node.d.ts b/src/glue/js/node.d.ts index eb548b3ab8..2d4fb94da6 100644 --- a/src/glue/js/node.d.ts +++ b/src/glue/js/node.d.ts @@ -3,5 +3,5 @@ * @license Apache-2.0 */ -declare const global: any; -declare function require(name: string): any; +declare const global: Record; +declare function require(name: string): unknown; diff --git a/src/glue/wasm/collections.ts b/src/glue/wasm/collections.ts index 2989a2bc37..11fe30208e 100644 --- a/src/glue/wasm/collections.ts +++ b/src/glue/wasm/collections.ts @@ -3,6 +3,8 @@ * @license Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-unused-vars */ + // @ts-ignore: decorator @global function Map_keys(map: Map): K[] { diff --git a/src/glue/wasm/float.ts b/src/glue/wasm/float.ts index 7331fe8e18..ad852e04fe 100644 --- a/src/glue/wasm/float.ts +++ b/src/glue/wasm/float.ts @@ -3,6 +3,8 @@ * @license Apache-2.0 */ +/* eslint-disable @typescript-eslint/no-unused-vars */ + // @ts-ignore: decorator @global function f32_as_i32(value: f32): i32 { diff --git a/src/glue/wasm/i64.ts b/src/glue/wasm/i64.ts index 59087872fd..14ebe1f625 100644 --- a/src/glue/wasm/i64.ts +++ b/src/glue/wasm/i64.ts @@ -3,13 +3,12 @@ * @license Apache-2.0 */ -// @ts-ignore: decorator -@global -const i64_zero: i64 = 0; +/* eslint-disable @typescript-eslint/no-unused-vars */ + +@global const i64_zero: i64 = 0; // @ts-ignore: decorator -@global -const i64_one: i64 = 1; +@global const i64_one: i64 = 1; // @ts-ignore: decorator @global diff --git a/src/module.ts b/src/module.ts index a114ea3e8c..9655c69b62 100644 --- a/src/module.ts +++ b/src/module.ts @@ -839,7 +839,7 @@ export class Module { var ret = isReturn ? binaryen._BinaryenReturnCall(this.ref, cStr, cArr, operands ? operands.length : 0, returnType) : binaryen._BinaryenCall(this.ref, cStr, cArr, operands ? operands.length : 0, returnType); - binaryen._free(cArr); + binaryen._free(cArr); return ret; } diff --git a/src/parser.ts b/src/parser.ts index 177e3240ad..210b4f162c 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -157,7 +157,6 @@ export class Parser extends DiagnosticEmitter { let statement = this.parseTopLevelStatement(tn, null); if (statement) statements.push(statement); } - tn.finish(); } /** Parses a top-level statement. */ @@ -1510,9 +1509,9 @@ export class Parser extends DiagnosticEmitter { return null; } - // or at '(' of arrow function: - // Parameters (':' Type)? - // Statement + // or at '(' of arrow function: + // Parameters (':' Type)? + // Statement } else { arrowKind = ArrowKind.ARROW_PARENTHESIZED; @@ -3213,7 +3212,7 @@ export class Parser extends DiagnosticEmitter { ); } - // 'default' ':' Statement* + // 'default' ':' Statement* } else if (tn.skip(Token.DEFAULT)) { if (tn.skip(Token.COLON)) { @@ -3577,7 +3576,7 @@ export class Parser extends DiagnosticEmitter { } again = false; // parenthesized break; - } + } case Token.COMMA: { break; // continue } diff --git a/src/program.ts b/src/program.ts index 8215c87781..e6f628e46d 100644 --- a/src/program.ts +++ b/src/program.ts @@ -1588,10 +1588,10 @@ export class Program extends DiagnosticEmitter { ): File | null { var filesByName = this.filesByName; return filesByName.has(foreignPath) - ? assert(filesByName.get(foreignPath)) - : filesByName.has(foreignPathAlt) - ? assert(filesByName.get(foreignPathAlt)) - : null; + ? assert(filesByName.get(foreignPath)) + : filesByName.has(foreignPathAlt) + ? assert(filesByName.get(foreignPathAlt)) + : null; } /** Tries to locate a foreign element by traversing exports and queued exports. */ @@ -3347,8 +3347,8 @@ export class FunctionPrototype extends DeclaredElement { /** Tests if this prototype is bound to a class. */ get isBound(): bool { var parent = this.parent; - return parent.kind == ElementKind.CLASS - || parent.kind == ElementKind.PROPERTY_PROTOTYPE && ( + return parent.kind == ElementKind.CLASS || + parent.kind == ElementKind.PROPERTY_PROTOTYPE && ( parent.parent.kind == ElementKind.CLASS || parent.parent.kind == ElementKind.INTERFACE ); diff --git a/src/tokenizer.ts b/src/tokenizer.ts index 4feeeb0d1d..d37bb36a7d 100644 --- a/src/tokenizer.ts +++ b/src/tokenizer.ts @@ -1261,7 +1261,7 @@ export class Tokenizer extends DiagnosticEmitter { i64_shl(value, i64_4), i64_new(c - CharCode._0) ); - } else if (c >= CharCode.A && c <= CharCode.F) { + } else if (c >= CharCode.A && c <= CharCode.F) { // value = (value << 4) + 10 + c - CharCode.A; value = i64_add( i64_shl(value, i64_4), @@ -1566,9 +1566,6 @@ export class Tokenizer extends DiagnosticEmitter { ((value32 - 0x10000) & 1023) | 0xDC00 ); } - - finish(): void { - } } /** Tokenizer state as returned by {@link Tokenizer#mark} and consumed by {@link Tokenizer#reset}. */ diff --git a/src/util/text.ts b/src/util/text.ts index 574bf9c12f..22b2063d2c 100644 --- a/src/util/text.ts +++ b/src/util/text.ts @@ -378,13 +378,13 @@ function lookupInUnicodeMap(code: u16, map: u16[]): bool { } function isUnicodeIdentifierStart(code: i32): bool { - return code < 170 || code > 65500 ? false - : lookupInUnicodeMap(code as u16, unicodeIdentifierStart); + return code < 170 || code > 65500 ? false : + lookupInUnicodeMap(code as u16, unicodeIdentifierStart); } function isUnicodeIdentifierPart(code: i32): bool { - return code < 170 || code > 65500 ? false - : lookupInUnicodeMap(code as u16, unicodeIdentifierPart); + return code < 170 || code > 65500 ? false : + lookupInUnicodeMap(code as u16, unicodeIdentifierPart); } const indentX1 = " "; diff --git a/std/assembly/array.ts b/std/assembly/array.ts index 36ee37fcd7..107e3272ca 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -254,7 +254,8 @@ export class Array { var dataStart = this.dataStart; var len = this.length_; - end = min(end, len); + end = min(end, len); + var to = target < 0 ? max(len + target, 0) : min(target, len); var from = start < 0 ? max(len + start, 0) : min(start, len); var last = end < 0 ? max(len + end, 0) : min(end, len); @@ -366,7 +367,7 @@ export class Array { base + sizeof(), lastIndex << alignof() ); - store(base + (lastIndex << alignof()), isReference() ? null : 0); + store(base + (lastIndex << alignof()), changetype(0)); this.length_ = lastIndex; return element; // no need to retain -> is moved } diff --git a/std/assembly/atomics.ts b/std/assembly/atomics.ts index d506624706..45b5a6b895 100644 --- a/std/assembly/atomics.ts +++ b/std/assembly/atomics.ts @@ -6,18 +6,20 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function load(array: T, index: i32): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.load>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset + changetype(array.buffer) + (index << align) + array.byteOffset ); } // @ts-ignore: decorator @inline export function store(array: T, index: i32, value: valueof): void { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); atomic.store>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -25,9 +27,10 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function add(array: T, index: i32, value: valueof): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.add>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -35,9 +38,10 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function sub(array: T, index: i32, value: valueof): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.sub>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -45,9 +49,10 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function and(array: T, index: i32, value: valueof): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.and>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -55,9 +60,10 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function or(array: T, index: i32, value: valueof): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.or>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -65,9 +71,10 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function xor(array: T, index: i32, value: valueof): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.xor>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -75,9 +82,10 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function exchange(array: T, index: i32, value: valueof): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.xchg>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, value ); } @@ -90,9 +98,10 @@ export namespace Atomics { expectedValue: valueof, replacementValue: valueof ): valueof { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); return atomic.cmpxchg>( - changetype(array.buffer) + (index << alignof>()) + array.byteOffset, + changetype(array.buffer) + (index << align) + array.byteOffset, expectedValue, replacementValue ); @@ -107,8 +116,9 @@ export namespace Atomics { // @ts-ignore: decorator @inline export function notify(array: T, index: i32, count: i32 = -1): i32 { - if (index < 0 || (index << alignof>()) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); - return atomic.notify(changetype(array.buffer) + (index << alignof>()) + array.byteOffset, count); + const align = alignof>(); + if (index < 0 || (index << align) >= array.byteLength) throw new RangeError(E_INDEXOUTOFRANGE); + return atomic.notify(changetype(array.buffer) + (index << align) + array.byteOffset, count); } export function isLockFree(size: usize): bool { diff --git a/std/assembly/bindings/Reflect.ts b/std/assembly/bindings/Reflect.ts index cae3adfb7c..ed08e7cd2b 100644 --- a/std/assembly/bindings/Reflect.ts +++ b/std/assembly/bindings/Reflect.ts @@ -1,4 +1,4 @@ -export declare function get(target: anyref, propertyKey: anyref/*, receiver: anyref*/): anyref; +export declare function get(target: anyref, propertyKey: anyref/* , receiver: anyref */): anyref; export declare function has(target: anyref, propertyKey: anyref): bool; -export declare function set(target: anyref, propertyKey: anyref, value: anyref/*, receiver: anyref*/): anyref; +export declare function set(target: anyref, propertyKey: anyref, value: anyref/* , receiver: anyref */): anyref; export declare function apply(target: anyref, thisArgument: anyref, argumentsList: anyref): anyref; diff --git a/std/assembly/dataview.ts b/std/assembly/dataview.ts index 3bb7f25875..3ab53b634a 100644 --- a/std/assembly/dataview.ts +++ b/std/assembly/dataview.ts @@ -35,11 +35,7 @@ export class DataView { ) throw new RangeError(E_INDEXOUTOFRANGE); return littleEndian ? load(this.dataStart + byteOffset) - : reinterpret( - bswap( - load(this.dataStart + byteOffset) - ) - ); + : reinterpret(bswap(load(this.dataStart + byteOffset))); } getFloat64(byteOffset: i32, littleEndian: boolean = false): f64 { @@ -48,11 +44,7 @@ export class DataView { ) throw new RangeError(E_INDEXOUTOFRANGE); return littleEndian ? load(this.dataStart + byteOffset) - : reinterpret( - bswap( - load(this.dataStart + byteOffset) - ) - ); + : reinterpret(bswap(load(this.dataStart + byteOffset))); } getInt8(byteOffset: i32): i8 { diff --git a/std/assembly/map.ts b/std/assembly/map.ts index f79ae8dd1f..2a193773f3 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -6,24 +6,19 @@ import { E_KEYNOTFOUND } from "util/error"; // A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht // @ts-ignore: decorator -@inline -const INITIAL_CAPACITY = 4; +@inline const INITIAL_CAPACITY = 4; // @ts-ignore: decorator -@inline -const FILL_FACTOR_N = 8; +@inline const FILL_FACTOR_N = 8; // @ts-ignore: decorator -@inline -const FILL_FACTOR_D = 3; +@inline const FILL_FACTOR_D = 3; // @ts-ignore: decorator -@inline -const FREE_FACTOR_N = 3; +@inline const FREE_FACTOR_N = 3; // @ts-ignore: decorator -@inline -const FREE_FACTOR_D = 4; +@inline const FREE_FACTOR_D = 4; /** Structure of a map entry. */ @unmanaged class MapEntry { @@ -34,13 +29,11 @@ const FREE_FACTOR_D = 4; /** Empty bit. */ // @ts-ignore: decorator -@inline -const EMPTY: usize = 1 << 0; +@inline const EMPTY: usize = 1 << 0; /** Size of a bucket. */ // @ts-ignore: decorator -@inline -const BUCKET_SIZE = sizeof(); +@inline const BUCKET_SIZE = sizeof(); /** Computes the alignment of an entry. */ // @ts-ignore: decorator @@ -74,6 +67,7 @@ export class Map { private entriesCount: i32 = 0; constructor() { + /* nop */ } get size(): i32 { diff --git a/std/assembly/math.ts b/std/assembly/math.ts index d2645c48ef..d5c865d39c 100644 --- a/std/assembly/math.ts +++ b/std/assembly/math.ts @@ -29,15 +29,11 @@ import { /** @internal */ // @ts-ignore: decorator -@lazy -var rempio2_y0: f64, - rempio2_y1: f64, - res128_hi: u64; +@lazy var rempio2_y0: f64, rempio2_y1: f64, res128_hi: u64; /** @internal */ // @ts-ignore: decorator -@lazy @inline -const PIO2_TABLE = memory.data([ +@lazy @inline const PIO2_TABLE = memory.data([ 0x00000000A2F9836E, 0x4E441529FC2757D1, 0xF534DDC0DB629599, 0x3C439041FE5163AB, 0xDEBBC561B7246E3A, 0x424DD2E006492EEA, 0x09D1921CFE1DEB1C, 0xB129A73EE88235F5, 0x2EBB4484E99C7026, 0xB45F7E413991D639, 0x835339F49C845F8B, 0xBDF9283B1FF897FF, @@ -385,24 +381,13 @@ function dtoi32(x: f64): i32 { } // @ts-ignore: decorator -@lazy -var random_seeded = false; +@lazy var random_seeded = false; // @ts-ignore: decorator -@lazy -var random_state0_64: u64; +@lazy var random_state0_64: u64, random_state1_64: u64; // @ts-ignore: decorator -@lazy -var random_state1_64: u64; - -// @ts-ignore: decorator -@lazy -var random_state0_32: u32; - -// @ts-ignore: decorator -@lazy -var random_state1_32: u32; +@lazy var random_state0_32: u32, random_state1_32: u32; function murmurHash3(h: u64): u64 { // Force all bits of a hash block to avalanche h ^= h >> 33; // see: https://github.com/aappleby/smhasher @@ -985,8 +970,11 @@ export namespace NativeMath { x *= Ox1p54; u = reinterpret(x); hx = (u >> 32); - } else if (hx >= 0x7FF00000) return x; - else if (hx == 0x3FF00000 && u << 32 == 0) return 0; + } else if (hx >= 0x7FF00000) { + return x; + } else if (hx == 0x3FF00000 && u << 32 == 0) { + return 0; + } hx += 0x3FF00000 - 0x3FE6A09E; k += (hx >> 20) - 0x3FF; hx = (hx & 0x000FFFFF) + 0x3FE6A09E; @@ -1029,8 +1017,11 @@ export namespace NativeMath { x *= Ox1p54; u = reinterpret(x); hx = (u >> 32); - } else if (hx >= 0x7FF00000) return x; - else if (hx == 0x3FF00000 && u << 32 == 0) return 0; + } else if (hx >= 0x7FF00000) { + return x; + } else if (hx == 0x3FF00000 && u << 32 == 0) { + return 0; + } hx += 0x3FF00000 - 0x3FE6A09E; k += (hx >> 20) - 0x3FF; hx = (hx & 0x000FFFFF) + 0x3FE6A09E; @@ -1135,8 +1126,11 @@ export namespace NativeMath { x *= Ox1p54; u = reinterpret(x); hx = (u >> 32); - } else if (hx >= 0x7FF00000) return x; - else if (hx == 0x3FF00000 && u << 32 == 0) return 0; + } else if (hx >= 0x7FF00000) { + return x; + } else if (hx == 0x3FF00000 && u << 32 == 0) { + return 0; + } hx += 0x3FF00000 - 0x3FE6A09E; k += (hx >> 20) - 0x3FF; hx = (hx & 0x000FFFFF) + 0x3FE6A09E; @@ -1682,7 +1676,7 @@ export namespace NativeMath { } break; } while (false); - // end: + // end: if (ex > 0) { uxi -= 1 << 52; uxi |= ex << 52; @@ -1743,12 +1737,10 @@ export namespace NativeMath { } // @ts-ignore: decorator -@lazy -var rempio2f_y: f64; +@lazy var rempio2f_y: f64; // @ts-ignore: decorator -@lazy @inline -const PIO2F_TABLE = memory.data([ +@lazy @inline const PIO2F_TABLE = memory.data([ 0xA2F9836E4E441529, 0xFC2757D1F534DDC0, 0xDB6295993C439041, @@ -2453,8 +2445,11 @@ export namespace NativeMathf { k -= 25; x *= Ox1p25f; u = reinterpret(x); - } else if (u >= 0x7F800000) return x; - else if (u == 0x3F800000) return 0; + } else if (u >= 0x7F800000) { + return x; + } else if (u == 0x3F800000) { + return 0; + } u += 0x3F800000 - 0x3F3504F3; k += (u >> 23) - 0x7F; u = (u & 0x007FFFFF) + 0x3F3504F3; @@ -2491,8 +2486,11 @@ export namespace NativeMathf { k -= 25; x *= Ox1p25f; ix = reinterpret(x); - } else if (ix >= 0x7F800000) return x; - else if (ix == 0x3F800000) return 0; + } else if (ix >= 0x7F800000) { + return x; + } else if (ix == 0x3F800000) { + return 0; + } ix += 0x3F800000 - 0x3F3504F3; k += (ix >> 23) - 0x7F; ix = (ix & 0x007FFFFF) + 0x3F3504F3; @@ -2580,8 +2578,11 @@ export namespace NativeMathf { k -= 25; x *= Ox1p25f; ix = reinterpret(x); - } else if (ix >= 0x7F800000) return x; - else if (ix == 0x3F800000) return 0; + } else if (ix >= 0x7F800000) { + return x; + } else if (ix == 0x3F800000) { + return 0; + } ix += 0x3F800000 - 0x3F3504F3; k += (ix >> 23) - 0x7F; ix = (ix & 0x007FFFFF) + 0x3F3504F3; @@ -2977,7 +2978,7 @@ export namespace NativeMathf { } break; } while (false); - // end + // end: if (ex > 0) { uxi -= 1 << 23; uxi |= ex << 23; diff --git a/std/assembly/rt/pure.ts b/std/assembly/rt/pure.ts index 863fc141a2..9b7955fb06 100644 --- a/std/assembly/rt/pure.ts +++ b/std/assembly/rt/pure.ts @@ -3,8 +3,8 @@ import { Block, freeBlock, ROOT } from "rt/tlsf"; import { TypeinfoFlags } from "shared/typeinfo"; import { onincrement, ondecrement, onfree, onalloc } from "./rtrace"; -/////////////////////////// A Pure Reference Counting Garbage Collector /////////////////////////// -// see: https://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon03Pure.pdf +// === A Pure Reference Counting Garbage Collector === +// see: https://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon03Pure.pdf // ╒══════════════════════ GC Info structure ══════════════════════╕ // │ 3 2 1 │ @@ -63,7 +63,7 @@ import { onincrement, ondecrement, onfree, onalloc } from "./rtrace"; // @ts-ignore: decorator @global @unsafe @lazy -function __visit(ref: usize, cookie: i32): void { +function __visit(ref: usize, cookie: i32): void { // eslint-disable-line @typescript-eslint/no-unused-vars if (ref < __heap_base) return; if (isDefined(__GC_ALL_ACYCLIC)) { if (DEBUG) assert(cookie == VISIT_DECREMENT); diff --git a/std/assembly/rt/stub.ts b/std/assembly/rt/stub.ts index 53ad191389..a064bb905f 100644 --- a/std/assembly/rt/stub.ts +++ b/std/assembly/rt/stub.ts @@ -1,12 +1,10 @@ import { AL_MASK, BLOCK, BLOCK_OVERHEAD, BLOCK_MAXSIZE, AL_SIZE, DEBUG } from "rt/common"; // @ts-ignore: decorator -@lazy -var startOffset: usize = (__heap_base + AL_MASK) & ~AL_MASK; +@lazy var startOffset: usize = (__heap_base + AL_MASK) & ~AL_MASK; // @ts-ignore: decorator -@lazy -var offset: usize = startOffset; +@lazy var offset: usize = startOffset; function maybeGrowMemory(newOffset: usize): void { // assumes newOffset is aligned @@ -90,14 +88,17 @@ export function __retain(ref: usize): usize { // @ts-ignore: decorator @global @unsafe export function __release(ref: usize): void { + /* nop */ } // @ts-ignore: decorator @global @unsafe -function __visit(ref: usize, cookie: u32): void { +function __visit(ref: usize, cookie: u32): void { // eslint-disable-line @typescript-eslint/no-unused-vars + /* nop */ } // @ts-ignore: decorator @global @unsafe export function __collect(): void { + /* nop */ } diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 2a71356ff3..2b4ab8a251 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -2,8 +2,8 @@ import { AL_BITS, AL_MASK, DEBUG, BLOCK, BLOCK_OVERHEAD, BLOCK_MAXSIZE } from "r import { onfree, onalloc, onrealloc } from "./rtrace"; import { REFCOUNT_MASK } from "./pure"; -/////////////////////// The TLSF (Two-Level Segregate Fit) memory allocator /////////////////////// -// see: http://www.gii.upv.es/tlsf/ +// === The TLSF (Two-Level Segregate Fit) memory allocator === +// see: http://www.gii.upv.es/tlsf/ // - `ffs(x)` is equivalent to `ctz(x)` with x != 0 // - `fls(x)` is equivalent to `sizeof(x) * 8 - clz(x) - 1` @@ -174,7 +174,7 @@ import { REFCOUNT_MASK } from "./pure"; /** Sets the head of the free list for the specified combination of first and second level. */ // @ts-ignore: decorator @inline function SETHEAD(root: Root, fl: usize, sl: u32, head: Block | null): void { - store( + store( changetype(root) + (((fl << SL_BITS) + sl) << alignof()), head, HL_START @@ -493,8 +493,7 @@ export function maybeInitialize(): Root { } // @ts-ignore: decorator -@lazy -var collectLock: bool = false; +@lazy var collectLock: bool = false; /** Allocates a block of the specified size. */ export function allocateBlock(root: Root, size: usize, id: u32): Block { diff --git a/std/assembly/set.ts b/std/assembly/set.ts index 191f8759cd..fe2aa50fdf 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -5,24 +5,19 @@ import { HASH } from "./util/hash"; // A deterministic hash set based on CloseTable from https://github.com/jorendorff/dht // @ts-ignore: decorator -@inline -const INITIAL_CAPACITY = 4; +@inline const INITIAL_CAPACITY = 4; // @ts-ignore: decorator -@inline -const FILL_FACTOR_N = 8; +@inline const FILL_FACTOR_N = 8; // @ts-ignore: decorator -@inline -const FILL_FACTOR_D = 3; +@inline const FILL_FACTOR_D = 3; // @ts-ignore: decorator -@inline -const FREE_FACTOR_N = 3; +@inline const FREE_FACTOR_N = 3; // @ts-ignore: decorator -@inline -const FREE_FACTOR_D = 4; +@inline const FREE_FACTOR_D = 4; /** Structure of a set entry. */ @unmanaged class SetEntry { @@ -32,13 +27,11 @@ const FREE_FACTOR_D = 4; /** Empty bit. */ // @ts-ignore: decorator -@inline -const EMPTY: usize = 1 << 0; +@inline const EMPTY: usize = 1 << 0; /** Size of a bucket. */ // @ts-ignore: decorator -@inline -const BUCKET_SIZE = sizeof(); +@inline const BUCKET_SIZE = sizeof(); /** Computes the alignment of an entry. */ // @ts-ignore: decorator @@ -71,6 +64,7 @@ export class Set { private entriesCount: i32 = 0; constructor() { + /* nop */ } get size(): i32 { diff --git a/std/assembly/symbol.ts b/std/assembly/symbol.ts index d05cedc86a..9fd06cd707 100644 --- a/std/assembly/symbol.ts +++ b/std/assembly/symbol.ts @@ -1,16 +1,13 @@ import { Map } from "./map"; // @ts-ignore: decorator -@lazy -var stringToId: Map; +@lazy var stringToId: Map; // @ts-ignore: decorator -@lazy -var idToString: Map; +@lazy var idToString: Map; // @ts-ignore: decorator -@lazy -var nextId: usize = 12; // Symbol.unscopables + 1 +@lazy var nextId: usize = 12; // Symbol.unscopables + 1 @unmanaged @final abstract class _Symbol { diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index 947fbf917c..e1e32d4192 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -1506,7 +1506,7 @@ function COPY_WITHIN( var len = array.length; var dataStart = array.dataStart; - end = min(end, len); + end = min(end, len); var to = target < 0 ? max(len + target, 0) : min(target, len); var from = start < 0 ? max(len + start, 0) : min(start, len); var last = end < 0 ? max(len + end, 0) : min(end, len); diff --git a/std/assembly/util/casemap.ts b/std/assembly/util/casemap.ts index 11bddff6a7..431dad1e54 100644 --- a/std/assembly/util/casemap.ts +++ b/std/assembly/util/casemap.ts @@ -2,8 +2,7 @@ // See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/casemap.h // @ts-ignore: decorator -@lazy @inline -const TAB = memory.data([ +@lazy @inline const TAB = memory.data([ 7, 8, 9, 10, 11, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 6, 15, 16, 17, 18, 6, 19, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 21, 6, 6, @@ -174,8 +173,7 @@ const TAB = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const RULES = memory.data([ +@lazy @inline const RULES = memory.data([ 0x0, 0x2001, -0x2000, 0x1dbf00, 0x2e700, 0x7900, 0x2402, 0x101, -0x100, 0x0, 0x201, -0x200, -0xc6ff, -0xe800, -0x78ff, -0x12c00, 0xc300, 0xd201, @@ -219,8 +217,7 @@ const RULES = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const RULE_BASES = memory.data([ +@lazy @inline const RULE_BASES = memory.data([ 0, 6, 39, 81, 111, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 131, 142, 146, 151, 0, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 196, 0, 0, @@ -256,8 +253,7 @@ const RULE_BASES = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const EXCEPTIONS = memory.data([ +@lazy @inline const EXCEPTIONS = memory.data([ 48, 12, 49, 13, 120, 14, 127, 15, 128, 16, 129, 17, 134, 18, 137, 19, 138, 19, 142, 20, 143, 21, 144, 22, @@ -430,8 +426,7 @@ export const SPECIALS_UPPER: StaticArray = [ ]; // @ts-ignore: decorator -@lazy @inline -const MT = memory.data([ +@lazy @inline const MT = memory.data([ 2048, 342, 57 ]); diff --git a/std/assembly/util/hash.ts b/std/assembly/util/hash.ts index 2d58d92909..c168fa4903 100644 --- a/std/assembly/util/hash.ts +++ b/std/assembly/util/hash.ts @@ -21,12 +21,10 @@ export function HASH(key: T): u32 { // FNV-1a 32-bit as a starting point, see: http://isthe.com/chongo/tech/comp/fnv/ // @ts-ignore: decorator -@inline -const FNV_OFFSET: u32 = 2166136261; +@inline const FNV_OFFSET: u32 = 2166136261; // @ts-ignore: decorator -@inline -const FNV_PRIME: u32 = 16777619; +@inline const FNV_PRIME: u32 = 16777619; function hash8(key: u32): u32 { return (FNV_OFFSET ^ key) * FNV_PRIME; diff --git a/std/assembly/util/math.ts b/std/assembly/util/math.ts index e345bbb7a6..da31d474de 100644 --- a/std/assembly/util/math.ts +++ b/std/assembly/util/math.ts @@ -3,12 +3,10 @@ // // @ts-ignore: decorator -@inline -const EXP2F_TABLE_BITS = 5; +@inline const EXP2F_TABLE_BITS = 5; // @ts-ignore: decorator -@lazy @inline -const EXP2F_DATA_TAB = memory.data([ +@lazy @inline const EXP2F_DATA_TAB = memory.data([ // exp2f_data_tab[i] = uint(2^(i/N)) - (i << 52-BITS) // used for computing 2^(k/N) for an int |k| < 150 N as // double(tab[k%N] + (k << 52-BITS)) @@ -124,12 +122,10 @@ export function expf_lut(x: f32): f32 { // // @ts-ignore: decorator -@inline -const LOG2F_TABLE_BITS = 4; +@inline const LOG2F_TABLE_BITS = 4; // @ts-ignore: decorator -@lazy @inline -const LOG2F_DATA_TAB = memory.data([ +@lazy @inline const LOG2F_DATA_TAB = memory.data([ reinterpret(0x3FF661EC79F8F3BE), reinterpret(0xBFDEFEC65B963019), // 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2, reinterpret(0x3FF571ED4AAF883D), reinterpret(0xBFDB0B6832D4FCA4), // 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2, reinterpret(0x3FF49539F0F010B0), reinterpret(0xBFD7418B0A1FB77B), // 0x1.49539f0f010bp+0 , -0x1.7418b0a1fb77bp-2, @@ -207,12 +203,10 @@ export function log2f_lut(x: f32): f32 { // // @ts-ignore: decorator -@inline -const LOGF_TABLE_BITS = 4; +@inline const LOGF_TABLE_BITS = 4; // @ts-ignore: decorator -@lazy @inline -const LOGF_DATA_TAB = memory.data([ +@lazy @inline const LOGF_DATA_TAB = memory.data([ reinterpret(0x3FF661EC79F8F3BE), reinterpret(0xBFD57BF7808CAADE), // 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2, reinterpret(0x3FF571ED4AAF883D), reinterpret(0xBFD2BEF0A7C06DDB), // 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2, reinterpret(0x3FF49539F0F010B0), reinterpret(0xBFD01EAE7F513A67), // 0x1.49539f0f010bp+0 , -0x1.01eae7f513a67p-2, @@ -461,12 +455,10 @@ export function powf_lut(x: f32, y: f32): f32 { // // @ts-ignore: decorator -@inline -const EXP_TABLE_BITS = 7; +@inline const EXP_TABLE_BITS = 7; // @ts-ignore: decorator -@lazy @inline -const EXP_DATA_TAB = memory.data([ +@lazy @inline const EXP_DATA_TAB = memory.data([ 0x0000000000000000, 0x3FF0000000000000, 0x3C9B3B4F1A88BF6E, 0x3FEFF63DA9FB3335, 0xBC7160139CD8DC5D, 0x3FEFEC9A3E778061, @@ -687,7 +679,7 @@ export function exp_lut(x: f64): f64 { var kd = z + shift; var ki = reinterpret(kd); kd -= shift; -// #endif + // #endif var r = x + kd * NegLn2hiN + kd * NegLn2loN; // 2^(k/N) ~= scale * (1 + tail). var idx = ((ki & N_MASK) << 1); @@ -808,8 +800,7 @@ export function exp2_lut(x: f64): f64 { // // @ts-ignore: decorator -@inline -const LOG2_TABLE_BITS = 6; +@inline const LOG2_TABLE_BITS = 6; /* Algorithm: @@ -839,8 +830,7 @@ that logc + poly(z/c - 1) has small error, however near x == 1 when |log2(x)| < 0x1p-4, this is not enough so that is special cased. */ // @ts-ignore: decorator -@lazy @inline -const LOG2_DATA_TAB1 = memory.data([ +@lazy @inline const LOG2_DATA_TAB1 = memory.data([ // invc , logc reinterpret(0x3FF724286BB1ACF8), reinterpret(0xBFE1095FEECDB000), reinterpret(0x3FF6E1F766D2CCA1), reinterpret(0xBFE08494BD76D000), @@ -909,8 +899,7 @@ const LOG2_DATA_TAB1 = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const LOG2_DATA_TAB2 = memory.data([ +@lazy @inline const LOG2_DATA_TAB2 = memory.data([ // chi , clo reinterpret(0x3FE6200012B90A8E), reinterpret(0x3C8904AB0644B605), reinterpret(0x3FE66000045734A6), reinterpret(0x3C61FF9BEA62F7A9), @@ -1015,15 +1004,15 @@ export function log2_lut(x: f64): f64 { var ix = reinterpret(x); if (ix - LO < HI - LO) { let r = x - 1.0; -// #if __FP_FAST_FMA -// hi = r * InvLn2hi; -// lo = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -hi); -// #else + // #if __FP_FAST_FMA + // hi = r * InvLn2hi; + // lo = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -hi); + // #else let rhi = reinterpret(reinterpret(r) & 0xFFFFFFFF00000000); let rlo = r - rhi; let hi = rhi * InvLn2hi; let lo = rlo * InvLn2hi + r * InvLn2lo; -// #endif + // #endif let r2 = r * r; // rounding error: 0x1p-62 let r4 = r2 * r2; // Worst-case error is less than 0.54 ULP (0.55 ULP without fma) @@ -1060,12 +1049,12 @@ export function log2_lut(x: f64): f64 { // log2(x) = log2(z/c) + log2(c) + k. // r ~= z/c - 1, |r| < 1/(2*N). -// #if __FP_FAST_FMA -// // rounding error: 0x1p-55/N. -// r = __builtin_fma(z, invc, -1.0); -// t1 = r * InvLn2hi; -// t2 = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -t1); -// #else + // #if __FP_FAST_FMA + // // rounding error: 0x1p-55/N. + // r = __builtin_fma(z, invc, -1.0); + // t1 = r * InvLn2hi; + // t2 = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -t1); + // #else // rounding error: 0x1p-55/N + 0x1p-65. var chi = load(LOG2_DATA_TAB2 + (i << (1 + alignof())), 0 << alignof()); // T[i].chi; var clo = load(LOG2_DATA_TAB2 + (i << (1 + alignof())), 1 << alignof()); // T[i].clo; @@ -1075,7 +1064,7 @@ export function log2_lut(x: f64): f64 { var rlo = r - rhi; var t1 = rhi * InvLn2hi; var t2 = rlo * InvLn2hi + r * InvLn2lo; -// #endif + // #endif // hi + lo = r/ln2 + log2(c) + k var t3 = kd + logc; @@ -1096,8 +1085,7 @@ export function log2_lut(x: f64): f64 { // // @ts-ignore: decorator -@inline -const LOG_TABLE_BITS = 7; +@inline const LOG_TABLE_BITS = 7; /* Algorithm: @@ -1127,8 +1115,7 @@ that logc + poly(z/c - 1) has small error, however near x == 1 when |log(x)| < 0x1p-4, this is not enough so that is special cased.*/ // @ts-ignore: decorator -@lazy @inline -const LOG_DATA_TAB1 = memory.data([ +@lazy @inline const LOG_DATA_TAB1 = memory.data([ // invc , logc reinterpret(0x3FF734F0C3E0DE9F), reinterpret(0xBFD7CC7F79E69000), reinterpret(0x3FF713786A2CE91F), reinterpret(0xBFD76FEEC20D0000), @@ -1261,8 +1248,7 @@ const LOG_DATA_TAB1 = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const LOG_DATA_TAB2 = memory.data([ +@lazy @inline const LOG_DATA_TAB2 = memory.data([ // chi , clo reinterpret(0x3FE61000014FB66B), reinterpret(0x3C7E026C91425B3C), reinterpret(0x3FE63000034DB495), reinterpret(0x3C8DBFEA48005D41), @@ -1473,15 +1459,15 @@ export function log_lut(x: f64): f64 { // log(x) = log1p(z/c-1) + log(c) + k*Ln2. // r ~= z/c - 1, |r| < 1/(2*N) -// #if __FP_FAST_FMA -// // rounding error: 0x1p-55/N -// r = __builtin_fma(z, invc, -1.0); -// #else + // #if __FP_FAST_FMA + // // rounding error: 0x1p-55/N + // r = __builtin_fma(z, invc, -1.0); + // #else // rounding error: 0x1p-55/N + 0x1p-66 const chi = load(LOG_DATA_TAB2 + (i << (1 + alignof())), 0 << alignof()); // T2[i].chi const clo = load(LOG_DATA_TAB2 + (i << (1 + alignof())), 1 << alignof()); // T2[i].clo var r = (z - chi - clo) * invc; -// #endif + // #endif var kd = k; // hi + lo = r + log(c) + k*Ln2 @@ -1503,8 +1489,7 @@ export function log_lut(x: f64): f64 { // // @ts-ignore: decorator -@inline -const POW_LOG_TABLE_BITS = 7; +@inline const POW_LOG_TABLE_BITS = 7; /* Algorithm: @@ -1530,8 +1515,7 @@ error and the interval for z is selected such that near x == 1, where log(x) is tiny, large cancellation error is avoided in logc + poly(z/c - 1). */ // @ts-ignore: decorator -@lazy @inline -const POW_LOG_DATA_TAB = memory.data([ +@lazy @inline const POW_LOG_DATA_TAB = memory.data([ // invc ,pad, logc , logctail reinterpret(0x3FF6A00000000000), 0, reinterpret(0xBFD62C82F2B9C800), reinterpret(0x3CFAB42428375680), reinterpret(0x3FF6800000000000), 0, reinterpret(0xBFD5D1BDBF580800), reinterpret(0xBD1CA508D8E0F720), @@ -1703,8 +1687,7 @@ function zeroinfnan(u: u64): bool { } // @ts-ignore: decorator -@lazy -var log_tail: f64 = 0; +@lazy var log_tail: f64 = 0; // Compute y+TAIL = log(x) where the rounded result is y and TAIL has about // additional 15 bits precision. IX is the bit representation of x, but @@ -1779,8 +1762,7 @@ function log_inline(ix: u64): f64 { } // @ts-ignore: decorator -@inline -const SIGN_BIAS = 0x800 << EXP_TABLE_BITS; +@inline const SIGN_BIAS = 0x800 << EXP_TABLE_BITS; // Computes sign*exp(x+xtail) where |xtail| < 2^-8/N and |xtail| <= |x|. // The sign_bias argument is SIGN_BIAS or 0 and sets the sign to -1 or 1. @@ -1828,20 +1810,20 @@ function exp_inline(x: f64, xtail: f64, sign_bias: u32): f64 { // x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]. z = InvLn2N * x; -// #if TOINT_INTRINSICS -// kd = roundtoint(z); -// ki = converttoint(z); -// #elif EXP_USE_TOINT_NARROW -// // z - kd is in [-0.5-2^-16, 0.5] in all rounding modes. -// kd = eval_as_double(z + shift); -// ki = asuint64(kd) >> 16; -// kd = (double_t)(int32_t)ki; -// #else + // #if TOINT_INTRINSICS + // kd = roundtoint(z); + // ki = converttoint(z); + // #elif EXP_USE_TOINT_NARROW + // // z - kd is in [-0.5-2^-16, 0.5] in all rounding modes. + // kd = eval_as_double(z + shift); + // ki = asuint64(kd) >> 16; + // kd = (double_t)(int32_t)ki; + // #else // z - kd is in [-1, 1] in non-nearest rounding modes kd = z + shift; ki = reinterpret(kd); kd -= shift; -// #endif + // #endif r = x + kd * NegLn2hiN + kd * NegLn2loN; // The code assumes 2^-200 < |xtail| < 2^-8/N r += xtail; @@ -1920,16 +1902,16 @@ export function pow_lut(x: f64, y: f64): f64 { var hi = log_inline(ix); var lo = log_tail; var ehi: f64, elo: f64; -// #if __FP_FAST_FMA -// ehi = y * hi; -// elo = y * lo + __builtin_fma(y, hi, -ehi); -// #else + // #if __FP_FAST_FMA + // ehi = y * hi; + // elo = y * lo + __builtin_fma(y, hi, -ehi); + // #else var yhi = reinterpret(iy & 0xFFFFFFFFF8000000); var ylo = y - yhi; var lhi = reinterpret(reinterpret(hi) & 0xFFFFFFFFF8000000); var llo = hi - lhi + lo; ehi = yhi * lhi; elo = ylo * lhi + y * llo; // |elo| < |ehi| * 2^-25. -// #endif + // #endif return exp_inline(ehi, elo, sign_bias); } diff --git a/std/assembly/util/number.ts b/std/assembly/util/number.ts index 0d9bac794b..986f7f1480 100644 --- a/std/assembly/util/number.ts +++ b/std/assembly/util/number.ts @@ -8,8 +8,7 @@ import { CharCode } from "./string"; export const MAX_DOUBLE_LENGTH = 28; // @ts-ignore: decorator -@lazy @inline -const POWERS10 = memory.data([ +@lazy @inline const POWERS10 = memory.data([ 1, 10, 100, @@ -37,8 +36,7 @@ const POWERS10 = memory.data([ "90", "91", "92", "93", "94", "95", "96", "97", "98", "99" */ // @ts-ignore: decorator -@lazy @inline -const DIGITS = memory.data([ +@lazy @inline const DIGITS = memory.data([ 0x00300030, 0x00310030, 0x00320030, 0x00330030, 0x00340030, 0x00350030, 0x00360030, 0x00370030, 0x00380030, 0x00390030, 0x00300031, 0x00310031, 0x00320031, 0x00330031, 0x00340031, @@ -63,8 +61,7 @@ const DIGITS = memory.data([ // Lookup table for pairwise char codes in range [0x00-0xFF] // @ts-ignore: decorator -@lazy @inline -const HEX_DIGITS = +@lazy @inline const HEX_DIGITS = "000102030405060708090a0b0c0d0e0f\ 101112131415161718191a1b1c1d1e1f\ 202122232425262728292a2b2c2d2e2f\ @@ -83,12 +80,10 @@ e0e1e2e3e4e5e6e7e8e9eaebecedeeef\ f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"; // @ts-ignore: decorator -@lazy @inline -const ANY_DIGITS = "0123456789abcdefghijklmnopqrstuvwxyz"; +@lazy @inline const ANY_DIGITS = "0123456789abcdefghijklmnopqrstuvwxyz"; // @ts-ignore: decorator -@lazy @inline -const EXP_POWERS = memory.data([ +@lazy @inline const EXP_POWERS = memory.data([/* eslint-disable indent */ -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661, -635, -608, -582, -555, -529, -502, -475, -449, @@ -98,12 +93,11 @@ const EXP_POWERS = memory.data([ 375, 402, 428, 455, 481, 508, 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066 -]); +/* eslint-enable indent */]); // 1e-348, 1e-340, ..., 1e340 // @ts-ignore: decorator -@lazy @inline -const FRC_POWERS = memory.data([ +@lazy @inline const FRC_POWERS = memory.data([ 0xFA8FD5A0081C0288, 0xBAAEE17FA23EBF76, 0x8B16FB203055AC76, 0xCF42894A5DCE35EA, 0x9A6BB0AA55653B2D, 0xE61ACF033D1A45DF, 0xAB70FE17C79AC6CA, 0xFF77B1FCBEBCDC4F, 0xBE5691EF416BD60C, 0x8DD01FAD907FFC3C, 0xD3515C2831559A83, 0x9D71AC8FADA6C9B5, @@ -461,32 +455,26 @@ export function itoa64(value: i64, radix: i32): String { } // @ts-ignore: decorator -@lazy -var _K: i32 = 0; +@lazy var _K: i32 = 0; // // @ts-ignore: decorator // @lazy // var _frc: u64 = 0; // @ts-ignore: decorator -@lazy -var _exp: i32 = 0; +@lazy var _exp: i32 = 0; // @ts-ignore: decorator -@lazy -var _frc_minus: u64 = 0; +@lazy var _frc_minus: u64 = 0; // @ts-ignore: decorator -@lazy -var _frc_plus: u64 = 0; +@lazy var _frc_plus: u64 = 0; // @ts-ignore: decorator -@lazy -var _frc_pow: u64 = 0; +@lazy var _frc_pow: u64 = 0; // @ts-ignore: decorator -@lazy -var _exp_pow: i32 = 0; +@lazy var _exp_pow: i32 = 0; // @ts-ignore: decorator @inline @@ -555,7 +543,7 @@ function getCachedPower(minExp: i32): void { const c = reinterpret(0x3FD34413509F79FE); // 1 / lg(10) = 0.30102999566398114 var dk = (-61 - minExp) * c + 347; // dk must be positive, so can do ceiling in positive var k = dk; - k += i32(k != dk); // conversion with ceil + k += i32(k != dk); // conversion with ceil var index = (k >> 3) + 1; _K = 348 - (index << 3); // decimal exponent no need lookup table @@ -572,7 +560,7 @@ function grisu2(value: f64, buffer: usize, sign: i32): i32 { var exp = i32((uv & 0x7FF0000000000000) >>> 52); var sid = uv & 0x000FFFFFFFFFFFFF; var frc = (u64(exp != 0) << 52) + sid; - exp = select(exp, 1, exp) - (0x3FF + 52); + exp = select(exp, 1, exp) - (0x3FF + 52); normalizedBoundaries(frc, exp); getCachedPower(_exp); @@ -603,7 +591,6 @@ function genDigits(buffer: usize, w_frc: u64, w_exp: i32, mp_frc: u64, mp_exp: i var mask = one_frc - 1; var wp_w_frc = mp_frc - w_frc; - var wp_w_exp = mp_exp; var p1 = u32(mp_frc >> one_exp); var p2 = mp_frc & mask; @@ -731,7 +718,7 @@ export function dtoa_core(buffer: usize, value: f64): i32 { } // assert(value > 0 && value <= 1.7976931348623157e308); var len = grisu2(value, buffer, sign); - len = prettify(buffer + (sign << 1), len - sign, _K); + len = prettify(buffer + (sign << 1), len - sign, _K); return len + sign; } diff --git a/std/assembly/util/string.ts b/std/assembly/util/string.ts index 9a44d9cf62..98568cd714 100644 --- a/std/assembly/util/string.ts +++ b/std/assembly/util/string.ts @@ -12,8 +12,7 @@ import { ipow32 } from "../math"; // See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/alpha.h // size: 3904 bytes // @ts-ignore -@inline @lazy -const ALPHA_TABLE = memory.data([ +@inline @lazy const ALPHA_TABLE = memory.data([ 18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40, 41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54, @@ -194,8 +193,7 @@ const ALPHA_TABLE = memory.data([ // size: 1568 bytes (compressed to ~1380 bytes after binaryen) // @ts-ignore: decorator -@lazy @inline -const CASED = memory.data([ +@lazy @inline const CASED = memory.data([ 18,19,20,21,22,23,16,16,16,16,16,16,16,16,16,16, 24,16,16,25,16,16,16,16,16,16,16,16,26,27,17,28, 29,30,16,16,31,16,16,16,16,16,16,16,32,33,16,16, @@ -278,8 +276,7 @@ const CASED = memory.data([ // size: 2976 bytes (compressed to ~2050 bytes after binaryen) // @ts-ignore: decorator -@lazy @inline -const CASE_IGNORABLES = memory.data([ +@lazy @inline const CASE_IGNORABLES = memory.data([ 18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32, 33,16,16,34,16,16,16,35,36,37,38,39,40,41,16,42, 43,16,16,16,16,16,16,16,16,16,16,16,44,45,46,16, @@ -421,8 +418,7 @@ const CASE_IGNORABLES = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const LOWER127 = memory.data([ +@lazy @inline const LOWER127 = memory.data([ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, @@ -437,8 +433,7 @@ const LOWER127 = memory.data([ ]); // @ts-ignore: decorator -@lazy @inline -const UPPER127 = memory.data([ +@lazy @inline const UPPER127 = memory.data([ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, @@ -454,8 +449,7 @@ const UPPER127 = memory.data([ // 23 * 8 = 184 bytes // @ts-ignore: decorator -@lazy @inline -const POWERS10 = memory.data([ +@lazy @inline const POWERS10 = memory.data([ 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22 @@ -1130,8 +1124,7 @@ function parseExp(ptr: usize, len: i32): i32 { } // @ts-ignore: decorator -@lazy -var __fixmulShift: u64 = 0; +@lazy var __fixmulShift: u64 = 0; // Adopted from metallic lib: // https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h diff --git a/std/assembly/wasi/index.ts b/std/assembly/wasi/index.ts index a5d472f18a..ac91ab370e 100644 --- a/std/assembly/wasi/index.ts +++ b/std/assembly/wasi/index.ts @@ -12,10 +12,9 @@ import { } from "util/number"; // @ts-ignore: decorator -@global @inline -const ASC_WASI = true; +@global @inline const ASC_WASI = true; // eslint-disable-line @typescript-eslint/no-unused-vars -function abort( +function abort( // eslint-disable-line @typescript-eslint/no-unused-vars message: string | null = null, fileName: string | null = null, lineNumber: u32 = 0, @@ -58,7 +57,7 @@ function abort( proc_exit(255); } -function trace( +function trace( // eslint-disable-line @typescript-eslint/no-unused-vars message: string, n: i32 = 0, a0: f64 = 0, @@ -108,7 +107,7 @@ function trace( __free(iovPtr); } -function seed(): f64 { +function seed(): f64 { // eslint-disable-line @typescript-eslint/no-unused-vars var temp = load(0); var rand: u64; do { diff --git a/std/portable/index.js b/std/portable/index.js index 95e528eae3..8915c554e3 100644 --- a/std/portable/index.js +++ b/std/portable/index.js @@ -17,75 +17,84 @@ var F64 = new Float64Array(1); var U64 = new Uint32Array(F64.buffer); Object.defineProperties( - globalScope["i8"] = function i8(value) { return value << 24 >> 24; } -, { - "MIN_VALUE": { value: -128, writable: false }, - "MAX_VALUE": { value: 127, writable: false } -}); + globalScope["i8"] = function i8(value) { return value << 24 >> 24; }, + { + "MIN_VALUE": { value: -128, writable: false }, + "MAX_VALUE": { value: 127, writable: false } + } +); Object.defineProperties( - globalScope["i16"] = function i16(value) { return value << 16 >> 16; } -, { - "MIN_VALUE": { value: -32768, writable: false }, - "MAX_VALUE": { value: 32767, writable: false } -}); + globalScope["i16"] = function i16(value) { return value << 16 >> 16; }, + { + "MIN_VALUE": { value: -32768, writable: false }, + "MAX_VALUE": { value: 32767, writable: false } + } +); Object.defineProperties( - globalScope["i32"] = globalScope["isize"] = function i32(value) { return value | 0; } -, { - "MIN_VALUE": { value: -2147483648, writable: false }, - "MAX_VALUE": { value: 2147483647, writable: false } -}); + globalScope["i32"] = globalScope["isize"] = function i32(value) { return value | 0; }, + { + "MIN_VALUE": { value: -2147483648, writable: false }, + "MAX_VALUE": { value: 2147483647, writable: false } + } +); Object.defineProperties( - globalScope["u8"] = function u8(value) { return value & 0xff; } -, { - "MIN_VALUE": { value: 0, writable: false }, - "MAX_VALUE": { value: 255, writable: false } -}); + globalScope["u8"] = function u8(value) { return value & 0xff; }, + { + "MIN_VALUE": { value: 0, writable: false }, + "MAX_VALUE": { value: 255, writable: false } + } +); Object.defineProperties( - globalScope["u16"] = function u16(value) { return value & 0xffff; } -, { - "MIN_VALUE": { value: 0, writable: false }, - "MAX_VALUE": { value: 65535, writable: false } -}); + globalScope["u16"] = function u16(value) { return value & 0xffff; }, + { + "MIN_VALUE": { value: 0, writable: false }, + "MAX_VALUE": { value: 65535, writable: false } + } +); Object.defineProperties( - globalScope["u32"] = globalScope["usize"] = function u32(value) { return value >>> 0; } -, { - "MIN_VALUE": { value: 0, writable: false }, - "MAX_VALUE": { value: 4294967295, writable: false } -}); + globalScope["u32"] = globalScope["usize"] = function u32(value) { return value >>> 0; }, + { + "MIN_VALUE": { value: 0, writable: false }, + "MAX_VALUE": { value: 4294967295, writable: false } + } +); Object.defineProperties( - globalScope["bool"] = function bool(value) { return !!value; } -, { - "MIN_VALUE": { value: false, writable: false }, - "MAX_VALUE": { value: true, writable: false } -}); + globalScope["bool"] = function bool(value) { return !!value; }, + { + "MIN_VALUE": { value: false, writable: false }, + "MAX_VALUE": { value: true, writable: false } + } +); Object.defineProperties( - globalScope["f32"] = function f32(value) { return Math.fround(value); } -, { - "EPSILON": { value: Math.fround(1.1920929e-07), writable: false }, - "MIN_VALUE": { value: Math.fround(1.4012985e-45), writable: false }, - "MAX_VALUE": { value: Math.fround(3.4028235e+38), writable: false }, - "MIN_NORMAL_VALUE": { value: Math.fround(1.17549435e-38), writable: false }, - "MIN_SAFE_INTEGER": { value: -16777215, writable: false }, - "MAX_SAFE_INTEGER": { value: 16777215, writable: false } -}); + globalScope["f32"] = function f32(value) { return Math.fround(value); }, + { + "EPSILON": { value: Math.fround(1.1920929e-07), writable: false }, + "MIN_VALUE": { value: Math.fround(1.4012985e-45), writable: false }, + "MAX_VALUE": { value: Math.fround(3.4028235e+38), writable: false }, + "MIN_NORMAL_VALUE": { value: Math.fround(1.17549435e-38), writable: false }, + "MIN_SAFE_INTEGER": { value: -16777215, writable: false }, + "MAX_SAFE_INTEGER": { value: 16777215, writable: false } + } +); Object.defineProperties( - globalScope["f64"] = function f64(value) { return +value; } -, { - "EPSILON": { value: 2.2204460492503131e-16, writable: false }, - "MIN_VALUE": { value: 5e-324, writable: false }, - "MAX_VALUE": { value: 1.7976931348623157e+308, writable: false }, - "MIN_NORMAL_VALUE": { value: 2.2250738585072014e-308 , writable: false }, - "MIN_SAFE_INTEGER": { value: -9007199254740991, writable: false }, - "MAX_SAFE_INTEGER": { value: 9007199254740991, writable: false } -}); + globalScope["f64"] = function f64(value) { return +value; }, + { + "EPSILON": { value: 2.2204460492503131e-16, writable: false }, + "MIN_VALUE": { value: 5e-324, writable: false }, + "MAX_VALUE": { value: 1.7976931348623157e+308, writable: false }, + "MIN_NORMAL_VALUE": { value: 2.2250738585072014e-308 , writable: false }, + "MIN_SAFE_INTEGER": { value: -9007199254740991, writable: false }, + "MAX_SAFE_INTEGER": { value: 9007199254740991, writable: false } + } +); globalScope["clz"] = Math.clz32; @@ -232,7 +241,7 @@ globalScope["isFloat"] = function isFloat(arg) { globalScope["isNullable"] = function isNullable(arg) { return true; -} +}; globalScope["isReference"] = function isReference(arg) { return typeof arg === "object" || typeof arg === "string"; @@ -240,7 +249,7 @@ globalScope["isReference"] = function isReference(arg) { globalScope["isFunction"] = function isFunction(arg) { return typeof arg === "function"; -} +}; globalScope["isString"] = function isString(arg) { return typeof arg === "string" || arg instanceof String; @@ -257,7 +266,7 @@ globalScope["isArrayLike"] = function isArrayLike(expr) { globalScope["isDefined"] = function isDefined(expr) { return typeof expr !== "undefined"; -} +}; globalScope["isConstant"] = function isConstant(expr) { return false; @@ -298,7 +307,7 @@ Object.defineProperties(globalScope["JSMath"], { } }); -globalScope["unmanaged"] = function() {}; +globalScope["unmanaged"] = function() { /* nop */ }; globalScope["trace"] = function(message, n) { if (n) message += Array.prototype.slice.call(arguments, 2, 2 + n); diff --git a/tests/allocators/index.js b/tests/allocators/index.js index d253b2a882..421e16479f 100644 --- a/tests/allocators/index.js +++ b/tests/allocators/index.js @@ -33,12 +33,12 @@ function test(file) { try { alloc(COMMON_MAX + 1, 0); // unreachable overflow = true; - } catch (e) {} + } catch (e) { /* nop */ } if (overflow) throw Error("allocation can overflow COMMON_MAX + 1"); try { alloc(0xffffffff, 0); // unreachable overflow = true; - } catch (e) {} + } catch (e) { /* nop */ } if (overflow) throw Error("allocation can overflow 0xffffffff"); } diff --git a/tests/allocators/runner.js b/tests/allocators/runner.js index 915a5f0aff..e2ce731f29 100644 --- a/tests/allocators/runner.js +++ b/tests/allocators/runner.js @@ -22,7 +22,7 @@ function runner(exports, runs, allocs) { function preciseFree(ptr) { var idx = ptrs.indexOf(ptr); if (idx < 0) throw Error("unknown pointer"); - var ptr = ptrs[idx]; + ptr = ptrs[idx]; ptrs.splice(idx, 1); if (typeof ptr !== "number") throw Error(); free(ptr); @@ -75,15 +75,15 @@ function runner(exports, runs, allocs) { try { reset(); - var ptr = alloc(64, 0); + let ptr = alloc(64, 0); if (ptr !== base) throw Error("expected " + base + " but got " + ptr); reset(); } catch (e) { // should now be possible to reuse the entire memory // just try a large portion of the memory here, for example because of // SL+1 for allocations in TLSF - var size = ((exports.memory.buffer.byteLength - base) * 9 / 10) >>> 0; - var ptr = alloc(size, 0); + let size = ((exports.memory.buffer.byteLength - base) * 9 / 10) >>> 0; + let ptr = alloc(size, 0); // if (fill) fill(ptr, 0xac, size); if (ptr !== base) throw Error("expected " + base + " but got " + ptr); free(ptr); @@ -95,11 +95,11 @@ function runner(exports, runs, allocs) { } } -function mem(memory, offset, count) { +/* function mem(memory, offset, count) { if (!offset) offset = 0; if (!count) count = 1024; var mem = new Uint8Array(memory.buffer, offset); - var stackTop = new Uint32Array(memory.buffer, 4, 1)[0]; + // var stackTop = new Uint32Array(memory.buffer, 4, 1)[0]; var hex = []; for (var i = 0; i < count; ++i) { var o = (offset + i).toString(16); @@ -112,6 +112,6 @@ function mem(memory, offset, count) { hex.push(h); } console.log(hex.join(" ") + " ..."); -} +} */ if (typeof module === "object" && typeof exports === "object") module.exports = runner; diff --git a/tests/binaryen/asmjs-math-builtins.js b/tests/binaryen/asmjs-math-builtins.js index cf8452b86c..d60abbe2ea 100644 --- a/tests/binaryen/asmjs-math-builtins.js +++ b/tests/binaryen/asmjs-math-builtins.js @@ -3,35 +3,35 @@ var binaryen = require("binaryen"); var mod = new binaryen.Module(); var funcType = mod.addFunctionType("F", binaryen.f64, [ binaryen.f64 ]); -var func = mod.addFunction("floor", funcType, [], +mod.addFunction("floor", funcType, [], mod.f64.floor( mod.get_local(0, binaryen.f64) ) ); mod.addExport("floor", "floor"); -func = mod.addFunction("ceil", funcType, [], +mod.addFunction("ceil", funcType, [], mod.f64.ceil( mod.get_local(0, binaryen.f64) ) ); mod.addExport("ceil", "ceil"); -func = mod.addFunction("sqrt", funcType, [], +mod.addFunction("sqrt", funcType, [], mod.f64.sqrt( mod.get_local(0, binaryen.f64) ) ); mod.addExport("sqrt", "sqrt"); -func = mod.addFunction("trunc", funcType, [], +mod.addFunction("trunc", funcType, [], mod.f64.trunc( mod.get_local(0, binaryen.f64) ) ); mod.addExport("trunc", "trunc"); -func = mod.addFunction("nearest", funcType, [], +mod.addFunction("nearest", funcType, [], mod.f64.nearest( mod.get_local(0, binaryen.f64) ) diff --git a/tests/binaryen/multi-value.js b/tests/binaryen/multi-value.js index ce092877e0..f9610b0018 100644 --- a/tests/binaryen/multi-value.js +++ b/tests/binaryen/multi-value.js @@ -2,7 +2,7 @@ var binaryen = require("binaryen"); var mod = new binaryen.Module(); var ii = binaryen.createType([ binaryen.i32, binaryen.i32 ]); -var func = mod.addFunction("test", ii, ii, [], +mod.addFunction("test", ii, ii, [], mod.unreachable() ); mod.addExport("test", "test"); diff --git a/tests/binaryen/optimize-if-eqz.js b/tests/binaryen/optimize-if-eqz.js index 18ea28984d..fb85fb8289 100644 --- a/tests/binaryen/optimize-if-eqz.js +++ b/tests/binaryen/optimize-if-eqz.js @@ -2,7 +2,7 @@ var binaryen = require("binaryen"); var mod = new binaryen.Module(); var funcType = mod.addFunctionType("i", binaryen.i32, [ binaryen.i32 ]); -var func = mod.addFunction("test", funcType, [], +mod.addFunction("test", funcType, [], mod.if( mod.i32.eqz(mod.getLocal(0, binaryen.i32)), mod.i32.const(0), diff --git a/tests/binaryen/reloop.js b/tests/binaryen/reloop.js index c133002653..1a4e739ad8 100644 --- a/tests/binaryen/reloop.js +++ b/tests/binaryen/reloop.js @@ -38,7 +38,7 @@ function usingBranches() { } usingBranches(); -function usingSwitch() { +/* function usingSwitch() { var module = new binaryen.Module(); var rl = new binaryen.Relooper(module); var entry = rl.addBlockWithSwitch(module.nop(), module.local.get(0, binaryen.i32)); @@ -68,4 +68,4 @@ function usingSwitch() { module.optimize(); console.log(module.emitText()); } -// usingSwitch(); +usingSwitch(); */ diff --git a/tests/binaryen/unreachable-loop.js b/tests/binaryen/unreachable-loop.js index 9da0aa35f1..462d790a3b 100644 --- a/tests/binaryen/unreachable-loop.js +++ b/tests/binaryen/unreachable-loop.js @@ -2,7 +2,7 @@ var binaryen = require("binaryen"); var mod = new binaryen.Module(); var funcType = mod.addFunctionType("v", binaryen.none, []); -var func = mod.addFunction("0", funcType, [], +mod.addFunction("0", funcType, [], mod.drop( mod.block("label$1", [ mod.loop("label$2", diff --git a/tests/binaryen/unreachable-spam.js b/tests/binaryen/unreachable-spam.js index e5d4b214a4..621892c636 100644 --- a/tests/binaryen/unreachable-spam.js +++ b/tests/binaryen/unreachable-spam.js @@ -22,4 +22,4 @@ mod.addExport("0", "0"); if (!mod.validate()) console.log("-> does not validate"); console.log(mod.emitText()); -console.log(mod.emitStackIR(/*true*/)); // optimize-stack-ir fixes this +console.log(mod.emitStackIR(/* true */)); // optimize-stack-ir fixes this diff --git a/tests/browser-asc.js b/tests/browser-asc.js index 9a28f17cf8..b48649268b 100644 --- a/tests/browser-asc.js +++ b/tests/browser-asc.js @@ -49,7 +49,7 @@ asc.main([ stderr: stderr, readFile: (name, baseDir) => { console.log("readFile: " + name + ", baseDir=" + baseDir); - if (files.hasOwnProperty(name)) return files[name]; + if (Object.prototype.hasOwnProperty.call(files, name)) return files[name]; return null; }, writeFile: (name, data, baseDir) => { diff --git a/tests/compiler.js b/tests/compiler.js index 5d9d249d6c..c1de4130af 100644 --- a/tests/compiler.js +++ b/tests/compiler.js @@ -101,7 +101,7 @@ function section(title) { case SKIPPED: console.log(" " + colorsUtil.yellow("SKIPPED") + " (" + time + ")\n"); break; } } - } + }; } const SUCCESS = 0; const FAILURE = 1; @@ -284,14 +284,14 @@ function runTest(basename) { const instantiateUntouched = section("instantiate untouched"); if (!config.skipInstantiate) { - if (!testInstantiate(basename, untouchedBuffer, "untouched", glue)) { + if (!testInstantiate(basename, untouchedBuffer, glue, stderr)) { failed = true; failedTests.add(basename); instantiateUntouched.end(FAILURE); } else { instantiateUntouched.end(SUCCESS); const instantiateOptimized = section("instantiate optimized"); - if (!testInstantiate(basename, optimizedBuffer, "optimized", glue)) { + if (!testInstantiate(basename, optimizedBuffer, glue, stderr)) { failed = true; failedTests.add(basename); instantiateOptimized.end(FAILURE); @@ -306,12 +306,12 @@ function runTest(basename) { if (failed) return 1; }); if (v8_no_flags) v8.setFlagsFromString(v8_no_flags); - if (!args.createBinary) fs.unlink(path.join(basedir, basename + ".untouched.wasm"), err => {}); + if (!args.createBinary) fs.unlink(path.join(basedir, basename + ".untouched.wasm"), err => { /* nop */ }); if (cluster.isWorker) process.send({ cmd: "done", failed: failed, message: failedMessages.get(basename) }); } // Tests if instantiation of a module succeeds -function testInstantiate(basename, binaryBuffer, name, glue) { +function testInstantiate(basename, binaryBuffer, glue, stderr) { var failed = false; try { let memory = new WebAssembly.Memory({ initial: 10 }); @@ -380,6 +380,7 @@ function testInstantiate(basename, binaryBuffer, name, glue) { let msg = "memory leak detected: " + leakCount + " leaking"; failed = true; failedMessages.set(basename, msg); + console.log(" " + msg); } if (!failed) { if (rtr.active) { diff --git a/tests/compiler/binary.ts b/tests/compiler/binary.ts index 694f04868a..35a0d69d24 100644 --- a/tests/compiler/binary.ts +++ b/tests/compiler/binary.ts @@ -65,7 +65,7 @@ I - 1; I * 1; I / 1; I % 1; -I ** 1; +(I) ** 1; I << 1; I >> 1; I >>> 1; @@ -84,7 +84,7 @@ I = I - 1; I = I * 1; I = I / 1; I = I % 1; -I = (I ** 1); +I = ((I) ** 1); I = I << 1; I = I >> 1; I = I >>> 1; diff --git a/tests/compiler/declare.js b/tests/compiler/declare.js index 1172f00551..e99808baa3 100644 --- a/tests/compiler/declare.js +++ b/tests/compiler/declare.js @@ -1,8 +1,8 @@ exports.preInstantiate = function(imports, exports) { imports.declare = { - externalFunction: function() { }, + externalFunction: function() { /* nop */ }, externalConstant: 1, - "my.externalFunction": function() { }, + "my.externalFunction": function() { /* nop */ }, "my.externalConstant": 2 }; }; diff --git a/tests/compiler/do.optimized.wat b/tests/compiler/do.optimized.wat index d3ce08b230..4c1302c68e 100644 --- a/tests/compiler/do.optimized.wat +++ b/tests/compiler/do.optimized.wat @@ -812,7 +812,7 @@ if i32.const 0 i32.const 1072 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -882,7 +882,7 @@ if i32.const 0 i32.const 1072 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -898,7 +898,7 @@ if i32.const 0 i32.const 1072 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/do.untouched.wat b/tests/compiler/do.untouched.wat index 4ba3692148..eacfebc0d4 100644 --- a/tests/compiler/do.untouched.wat +++ b/tests/compiler/do.untouched.wat @@ -1744,7 +1744,7 @@ if i32.const 0 i32.const 64 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1791,7 +1791,7 @@ if i32.const 0 i32.const 64 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1812,7 +1812,7 @@ if i32.const 0 i32.const 64 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1833,7 +1833,7 @@ if i32.const 0 i32.const 64 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-baseaggregate.optimized.wat b/tests/compiler/extends-baseaggregate.optimized.wat index e0b0674624..b74e0bf3f5 100644 --- a/tests/compiler/extends-baseaggregate.optimized.wat +++ b/tests/compiler/extends-baseaggregate.optimized.wat @@ -908,7 +908,7 @@ if i32.const 0 i32.const 1136 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1000,7 +1000,7 @@ if i32.const 0 i32.const 1136 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1016,7 +1016,7 @@ if i32.const 0 i32.const 1136 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1131,7 +1131,7 @@ if i32.const 0 i32.const 1136 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/extends-baseaggregate.untouched.wat b/tests/compiler/extends-baseaggregate.untouched.wat index 38f5b817f3..a940f6a811 100644 --- a/tests/compiler/extends-baseaggregate.untouched.wat +++ b/tests/compiler/extends-baseaggregate.untouched.wat @@ -1341,7 +1341,7 @@ if i32.const 0 i32.const 128 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1388,7 +1388,7 @@ if i32.const 0 i32.const 128 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1409,7 +1409,7 @@ if i32.const 0 i32.const 128 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1430,7 +1430,7 @@ if i32.const 0 i32.const 128 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1603,7 +1603,7 @@ if i32.const 0 i32.const 128 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/external.js b/tests/compiler/external.js index 40f33bb2e8..503cde0fa0 100644 --- a/tests/compiler/external.js +++ b/tests/compiler/external.js @@ -1,11 +1,11 @@ exports.preInstantiate = function(imports, exports) { imports.external = { - foo: function() {}, - "foo.bar": function() {}, - bar: function() {} + foo: function() { /* nop */ }, + "foo.bar": function() { /* nop */ }, + bar: function() { /* nop */ } }; imports.foo = { - baz: function() {}, + baz: function() { /* nop */ }, "var": 3 }; }; diff --git a/tests/compiler/features/simd.optimized.wat b/tests/compiler/features/simd.optimized.wat index 317d754484..71fb2f303b 100644 --- a/tests/compiler/features/simd.optimized.wat +++ b/tests/compiler/features/simd.optimized.wat @@ -72,7 +72,7 @@ if i32.const 0 i32.const 1040 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/features/simd.untouched.wat b/tests/compiler/features/simd.untouched.wat index acc103cd20..e308f01d2d 100644 --- a/tests/compiler/features/simd.untouched.wat +++ b/tests/compiler/features/simd.untouched.wat @@ -145,7 +145,7 @@ if i32.const 0 i32.const 32 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -164,7 +164,7 @@ if i32.const 0 i32.const 32 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/for.optimized.wat b/tests/compiler/for.optimized.wat index 5ffcec178e..b5c9d05fb1 100644 --- a/tests/compiler/for.optimized.wat +++ b/tests/compiler/for.optimized.wat @@ -809,7 +809,7 @@ if i32.const 0 i32.const 1072 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -879,7 +879,7 @@ if i32.const 0 i32.const 1072 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -895,7 +895,7 @@ if i32.const 0 i32.const 1072 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/for.untouched.wat b/tests/compiler/for.untouched.wat index 70b18169ff..3ea1d01e04 100644 --- a/tests/compiler/for.untouched.wat +++ b/tests/compiler/for.untouched.wat @@ -1757,7 +1757,7 @@ if i32.const 0 i32.const 64 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1804,7 +1804,7 @@ if i32.const 0 i32.const 64 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1825,7 +1825,7 @@ if i32.const 0 i32.const 64 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1846,7 +1846,7 @@ if i32.const 0 i32.const 64 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/implicit-getter-setter.optimized.wat b/tests/compiler/implicit-getter-setter.optimized.wat index 454a19e0c9..d9967cfc2f 100644 --- a/tests/compiler/implicit-getter-setter.optimized.wat +++ b/tests/compiler/implicit-getter-setter.optimized.wat @@ -891,7 +891,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1002,7 +1002,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1018,7 +1018,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/implicit-getter-setter.untouched.wat b/tests/compiler/implicit-getter-setter.untouched.wat index 8074e7f460..906a0165ec 100644 --- a/tests/compiler/implicit-getter-setter.untouched.wat +++ b/tests/compiler/implicit-getter-setter.untouched.wat @@ -1345,7 +1345,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1392,7 +1392,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1413,7 +1413,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1434,7 +1434,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/inlining.ts b/tests/compiler/inlining.ts index 4c34d848d3..1c98d1de75 100644 --- a/tests/compiler/inlining.ts +++ b/tests/compiler/inlining.ts @@ -40,7 +40,7 @@ function func_iv(a: i32): void { @inline function func_fe(): (a: i32) => i32 { - return (a: i32): i32 => a; + return (a: i32): i32 => a; } diff --git a/tests/compiler/issues/1095.optimized.wat b/tests/compiler/issues/1095.optimized.wat index 555c78f813..8ed6140eec 100644 --- a/tests/compiler/issues/1095.optimized.wat +++ b/tests/compiler/issues/1095.optimized.wat @@ -728,7 +728,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -798,7 +798,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -814,7 +814,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1095.untouched.wat b/tests/compiler/issues/1095.untouched.wat index 69356e6ffa..465e0af1e1 100644 --- a/tests/compiler/issues/1095.untouched.wat +++ b/tests/compiler/issues/1095.untouched.wat @@ -1331,7 +1331,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1378,7 +1378,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1399,7 +1399,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1420,7 +1420,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1225.optimized.wat b/tests/compiler/issues/1225.optimized.wat index 271e518e90..aa7d681c8d 100644 --- a/tests/compiler/issues/1225.optimized.wat +++ b/tests/compiler/issues/1225.optimized.wat @@ -730,7 +730,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -800,7 +800,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -816,7 +816,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/issues/1225.untouched.wat b/tests/compiler/issues/1225.untouched.wat index 52e7dc1158..ee99447b69 100644 --- a/tests/compiler/issues/1225.untouched.wat +++ b/tests/compiler/issues/1225.untouched.wat @@ -1333,7 +1333,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1380,7 +1380,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1401,7 +1401,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1422,7 +1422,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/logical.optimized.wat b/tests/compiler/logical.optimized.wat index dfcf05fc2e..6a5dcd493c 100644 --- a/tests/compiler/logical.optimized.wat +++ b/tests/compiler/logical.optimized.wat @@ -727,7 +727,7 @@ if i32.const 0 i32.const 1088 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -797,7 +797,7 @@ if i32.const 0 i32.const 1088 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -813,7 +813,7 @@ if i32.const 0 i32.const 1088 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/logical.untouched.wat b/tests/compiler/logical.untouched.wat index dd56298c72..c2dcfa73ee 100644 --- a/tests/compiler/logical.untouched.wat +++ b/tests/compiler/logical.untouched.wat @@ -1355,7 +1355,7 @@ if i32.const 0 i32.const 80 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1402,7 +1402,7 @@ if i32.const 0 i32.const 80 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1423,7 +1423,7 @@ if i32.const 0 i32.const 80 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1444,7 +1444,7 @@ if i32.const 0 i32.const 80 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/managed-cast.optimized.wat b/tests/compiler/managed-cast.optimized.wat index 0ed2b2c8b5..667d9c4940 100644 --- a/tests/compiler/managed-cast.optimized.wat +++ b/tests/compiler/managed-cast.optimized.wat @@ -729,7 +729,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -799,7 +799,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -815,7 +815,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/managed-cast.untouched.wat b/tests/compiler/managed-cast.untouched.wat index 819a059fba..ceadae9eda 100644 --- a/tests/compiler/managed-cast.untouched.wat +++ b/tests/compiler/managed-cast.untouched.wat @@ -1333,7 +1333,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1380,7 +1380,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1401,7 +1401,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1422,7 +1422,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/nullable.ts b/tests/compiler/nullable.ts index c7b260c7a7..3cffa68d67 100644 --- a/tests/compiler/nullable.ts +++ b/tests/compiler/nullable.ts @@ -4,4 +4,4 @@ function notNullable(a: Example): void {} notNullable(null); -ERROR("EOF") +ERROR("EOF"); diff --git a/tests/compiler/number.optimized.wat b/tests/compiler/number.optimized.wat index bd589cbb7a..e4c5ad5b7e 100644 --- a/tests/compiler/number.optimized.wat +++ b/tests/compiler/number.optimized.wat @@ -1439,7 +1439,7 @@ if i32.const 0 i32.const 2512 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -1454,7 +1454,7 @@ if i32.const 0 i32.const 2512 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/number.untouched.wat b/tests/compiler/number.untouched.wat index 9272fa9fc7..72f1cf224d 100644 --- a/tests/compiler/number.untouched.wat +++ b/tests/compiler/number.untouched.wat @@ -613,7 +613,7 @@ if i32.const 32 i32.const 160 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -957,23 +957,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -991,29 +990,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -1027,201 +1024,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 2872 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -1229,73 +1226,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -1303,67 +1300,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 2872 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -1372,81 +1369,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 @@ -3585,7 +3582,7 @@ if i32.const 0 i32.const 2944 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -3604,7 +3601,7 @@ if i32.const 0 i32.const 2944 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index e7c00c0c50..ef38fe6b69 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -883,7 +883,7 @@ if i32.const 0 i32.const 1088 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -994,7 +994,7 @@ if i32.const 0 i32.const 1088 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1010,7 +1010,7 @@ if i32.const 0 i32.const 1088 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1472,7 +1472,7 @@ if i32.const 0 i32.const 1088 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/object-literal.untouched.wat b/tests/compiler/object-literal.untouched.wat index a8a39b0dda..b44360f445 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -1339,7 +1339,7 @@ if i32.const 0 i32.const 80 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1386,7 +1386,7 @@ if i32.const 0 i32.const 80 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1407,7 +1407,7 @@ if i32.const 0 i32.const 80 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1428,7 +1428,7 @@ if i32.const 0 i32.const 80 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -3218,7 +3218,7 @@ if i32.const 0 i32.const 80 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/optional-typeparameters.ts b/tests/compiler/optional-typeparameters.ts index 4974050030..a726b28f4a 100644 --- a/tests/compiler/optional-typeparameters.ts +++ b/tests/compiler/optional-typeparameters.ts @@ -23,5 +23,5 @@ class TestDerived { var tConcrete = new TestConcrete(); tConcrete.test(1, 2); -var tDerived = new TestDerived() +var tDerived = new TestDerived(); tDerived.test(1, 2); diff --git a/tests/compiler/rc/local-init.optimized.wat b/tests/compiler/rc/local-init.optimized.wat index c49de915d2..fc9690d434 100644 --- a/tests/compiler/rc/local-init.optimized.wat +++ b/tests/compiler/rc/local-init.optimized.wat @@ -727,7 +727,7 @@ if i32.const 0 i32.const 1056 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -797,7 +797,7 @@ if i32.const 0 i32.const 1056 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -813,7 +813,7 @@ if i32.const 0 i32.const 1056 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/local-init.untouched.wat b/tests/compiler/rc/local-init.untouched.wat index 4c5c5cecdd..05fbb2d944 100644 --- a/tests/compiler/rc/local-init.untouched.wat +++ b/tests/compiler/rc/local-init.untouched.wat @@ -1344,7 +1344,7 @@ if i32.const 0 i32.const 48 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1391,7 +1391,7 @@ if i32.const 0 i32.const 48 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1412,7 +1412,7 @@ if i32.const 0 i32.const 48 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1433,7 +1433,7 @@ if i32.const 0 i32.const 48 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/logical-and-mismatch.optimized.wat b/tests/compiler/rc/logical-and-mismatch.optimized.wat index 6a906a7a83..9c4df4e424 100644 --- a/tests/compiler/rc/logical-and-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-and-mismatch.optimized.wat @@ -727,7 +727,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -797,7 +797,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -813,7 +813,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/logical-and-mismatch.untouched.wat b/tests/compiler/rc/logical-and-mismatch.untouched.wat index 9047c17834..8bc73c87c9 100644 --- a/tests/compiler/rc/logical-and-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-and-mismatch.untouched.wat @@ -1330,7 +1330,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1377,7 +1377,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1398,7 +1398,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1419,7 +1419,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/logical-or-mismatch.optimized.wat b/tests/compiler/rc/logical-or-mismatch.optimized.wat index 946c55476b..6d644fbf8f 100644 --- a/tests/compiler/rc/logical-or-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-or-mismatch.optimized.wat @@ -727,7 +727,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -797,7 +797,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -813,7 +813,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/logical-or-mismatch.untouched.wat b/tests/compiler/rc/logical-or-mismatch.untouched.wat index 1992299e68..16b203f1d7 100644 --- a/tests/compiler/rc/logical-or-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-or-mismatch.untouched.wat @@ -1330,7 +1330,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1377,7 +1377,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1398,7 +1398,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1419,7 +1419,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/optimize.optimized.wat b/tests/compiler/rc/optimize.optimized.wat index adad34ed33..037b79f47f 100644 --- a/tests/compiler/rc/optimize.optimized.wat +++ b/tests/compiler/rc/optimize.optimized.wat @@ -817,7 +817,7 @@ if i32.const 0 i32.const 1088 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -887,7 +887,7 @@ if i32.const 0 i32.const 1088 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -903,7 +903,7 @@ if i32.const 0 i32.const 1088 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/optimize.untouched.wat b/tests/compiler/rc/optimize.untouched.wat index adac094c22..a7367ce91f 100644 --- a/tests/compiler/rc/optimize.untouched.wat +++ b/tests/compiler/rc/optimize.untouched.wat @@ -1433,7 +1433,7 @@ if i32.const 0 i32.const 80 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1480,7 +1480,7 @@ if i32.const 0 i32.const 80 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1501,7 +1501,7 @@ if i32.const 0 i32.const 80 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1522,7 +1522,7 @@ if i32.const 0 i32.const 80 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/rereturn.optimized.wat b/tests/compiler/rc/rereturn.optimized.wat index 160b6e5eb6..0dfd029536 100644 --- a/tests/compiler/rc/rereturn.optimized.wat +++ b/tests/compiler/rc/rereturn.optimized.wat @@ -877,7 +877,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -988,7 +988,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1004,7 +1004,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/rereturn.untouched.wat b/tests/compiler/rc/rereturn.untouched.wat index 6e8fcd49cc..46ec808478 100644 --- a/tests/compiler/rc/rereturn.untouched.wat +++ b/tests/compiler/rc/rereturn.untouched.wat @@ -1332,7 +1332,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1379,7 +1379,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1400,7 +1400,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1421,7 +1421,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/ternary-mismatch.optimized.wat b/tests/compiler/rc/ternary-mismatch.optimized.wat index ae587c4e1a..1b8894e2ed 100644 --- a/tests/compiler/rc/ternary-mismatch.optimized.wat +++ b/tests/compiler/rc/ternary-mismatch.optimized.wat @@ -729,7 +729,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -799,7 +799,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -815,7 +815,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rc/ternary-mismatch.untouched.wat b/tests/compiler/rc/ternary-mismatch.untouched.wat index a0a89202e2..6dffb7d72d 100644 --- a/tests/compiler/rc/ternary-mismatch.untouched.wat +++ b/tests/compiler/rc/ternary-mismatch.untouched.wat @@ -1332,7 +1332,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1379,7 +1379,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1400,7 +1400,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1421,7 +1421,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-access.untouched.wat b/tests/compiler/resolve-access.untouched.wat index 93a1930bbb..1bbcca6d7c 100644 --- a/tests/compiler/resolve-access.untouched.wat +++ b/tests/compiler/resolve-access.untouched.wat @@ -2102,7 +2102,7 @@ if i32.const 176 i32.const 304 - i32.const 401 + i32.const 395 i32.const 5 call $~lib/builtins/abort unreachable @@ -2318,7 +2318,7 @@ if i32.const 176 i32.const 304 - i32.const 350 + i32.const 344 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-binary.optimized.wat b/tests/compiler/resolve-binary.optimized.wat index 74d084befd..3bf6705315 100644 --- a/tests/compiler/resolve-binary.optimized.wat +++ b/tests/compiler/resolve-binary.optimized.wat @@ -1388,7 +1388,7 @@ if i32.const 0 i32.const 2656 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -1403,7 +1403,7 @@ if i32.const 0 i32.const 2656 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-binary.untouched.wat b/tests/compiler/resolve-binary.untouched.wat index 2fb3bc0486..bf5e030a72 100644 --- a/tests/compiler/resolve-binary.untouched.wat +++ b/tests/compiler/resolve-binary.untouched.wat @@ -843,7 +843,7 @@ if i32.const 192 i32.const 320 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -1957,23 +1957,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -1991,29 +1990,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -2027,201 +2024,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 9160 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -2229,73 +2226,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -2303,67 +2300,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 9160 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -2372,81 +2369,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 @@ -4585,7 +4582,7 @@ if i32.const 0 i32.const 9232 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -4604,7 +4601,7 @@ if i32.const 0 i32.const 9232 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.optimized.wat b/tests/compiler/resolve-elementaccess.optimized.wat index 861ac27c32..8b4765c33e 100644 --- a/tests/compiler/resolve-elementaccess.optimized.wat +++ b/tests/compiler/resolve-elementaccess.optimized.wat @@ -1708,7 +1708,7 @@ if i32.const 0 i32.const 2352 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -1723,7 +1723,7 @@ if i32.const 0 i32.const 2352 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.untouched.wat b/tests/compiler/resolve-elementaccess.untouched.wat index 2533772e60..7ff88b8e09 100644 --- a/tests/compiler/resolve-elementaccess.untouched.wat +++ b/tests/compiler/resolve-elementaccess.untouched.wat @@ -584,23 +584,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -618,29 +617,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -654,201 +651,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 1272 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -856,73 +853,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -930,67 +927,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 1272 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -999,81 +996,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 @@ -3360,7 +3357,7 @@ if i32.const 0 i32.const 1744 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -3379,7 +3376,7 @@ if i32.const 0 i32.const 1744 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable @@ -3974,7 +3971,7 @@ if i32.const 1952 i32.const 2080 - i32.const 350 + i32.const 344 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-function-expression.untouched.wat b/tests/compiler/resolve-function-expression.untouched.wat index 054d2ab9b6..b6ccdcc3e0 100644 --- a/tests/compiler/resolve-function-expression.untouched.wat +++ b/tests/compiler/resolve-function-expression.untouched.wat @@ -593,7 +593,7 @@ if i32.const 112 i32.const 240 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-propertyaccess.untouched.wat b/tests/compiler/resolve-propertyaccess.untouched.wat index 594852c179..6961004ca8 100644 --- a/tests/compiler/resolve-propertyaccess.untouched.wat +++ b/tests/compiler/resolve-propertyaccess.untouched.wat @@ -597,7 +597,7 @@ if i32.const 32 i32.const 160 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-ternary.optimized.wat b/tests/compiler/resolve-ternary.optimized.wat index c960d9defc..57ff3b39f2 100644 --- a/tests/compiler/resolve-ternary.optimized.wat +++ b/tests/compiler/resolve-ternary.optimized.wat @@ -897,7 +897,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1008,7 +1008,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1024,7 +1024,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2393,7 +2393,7 @@ if i32.const 0 i32.const 1040 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-ternary.untouched.wat b/tests/compiler/resolve-ternary.untouched.wat index b901265ce8..b2feb10b03 100644 --- a/tests/compiler/resolve-ternary.untouched.wat +++ b/tests/compiler/resolve-ternary.untouched.wat @@ -1369,7 +1369,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1416,7 +1416,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1437,7 +1437,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1458,7 +1458,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2003,7 +2003,7 @@ if i32.const 192 i32.const 320 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -2344,23 +2344,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -2378,29 +2377,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -2414,201 +2411,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 3048 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -2616,73 +2613,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -2690,67 +2687,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 3048 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -2759,81 +2756,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 @@ -4996,7 +4993,7 @@ if i32.const 0 i32.const 32 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-unary.untouched.wat b/tests/compiler/resolve-unary.untouched.wat index e3e33ea2da..f4cae8cd46 100644 --- a/tests/compiler/resolve-unary.untouched.wat +++ b/tests/compiler/resolve-unary.untouched.wat @@ -593,7 +593,7 @@ if i32.const 32 i32.const 160 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index e3b306b5ff..58380a3cb1 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -925,7 +925,7 @@ if i32.const 0 i32.const 1136 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1017,7 +1017,7 @@ if i32.const 0 i32.const 1136 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1033,7 +1033,7 @@ if i32.const 0 i32.const 1136 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1310,7 +1310,7 @@ if i32.const 0 i32.const 1136 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -1825,7 +1825,7 @@ if i32.const 1296 i32.const 1088 - i32.const 299 + i32.const 300 i32.const 21 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index a2f9ce9a3e..3485935621 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -1357,7 +1357,7 @@ if i32.const 0 i32.const 128 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1404,7 +1404,7 @@ if i32.const 0 i32.const 128 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1425,7 +1425,7 @@ if i32.const 0 i32.const 128 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1446,7 +1446,7 @@ if i32.const 0 i32.const 128 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1880,7 +1880,7 @@ if i32.const 0 i32.const 128 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -3396,7 +3396,7 @@ if i32.const 288 i32.const 80 - i32.const 299 + i32.const 300 i32.const 21 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/retain-release.ts b/tests/compiler/retain-release.ts index bc4177571c..d6e9d930f3 100644 --- a/tests/compiler/retain-release.ts +++ b/tests/compiler/retain-release.ts @@ -31,7 +31,7 @@ export function receiveRefDrop(): void { // A straight forward optimization here is to detect immediate drops and skip // the temp local. - /*__release( */ returnRef() /* ) */; + /* __release( */ returnRef() /* ) */; } export function receiveRefRetain(): void { diff --git a/tests/compiler/retain-return.optimized.wat b/tests/compiler/retain-return.optimized.wat index b19a070365..a9774a845d 100644 --- a/tests/compiler/retain-return.optimized.wat +++ b/tests/compiler/retain-return.optimized.wat @@ -724,7 +724,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -794,7 +794,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -810,7 +810,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/retain-return.untouched.wat b/tests/compiler/retain-return.untouched.wat index 072fb06768..6222110570 100644 --- a/tests/compiler/retain-return.untouched.wat +++ b/tests/compiler/retain-return.untouched.wat @@ -1335,7 +1335,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1382,7 +1382,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1403,7 +1403,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1424,7 +1424,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.optimized.wat b/tests/compiler/rt/finalize.optimized.wat index 390f9872fd..8f08ee0a8f 100644 --- a/tests/compiler/rt/finalize.optimized.wat +++ b/tests/compiler/rt/finalize.optimized.wat @@ -899,7 +899,7 @@ if i32.const 0 i32.const 1152 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1011,7 +1011,7 @@ if i32.const 0 i32.const 1152 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1027,7 +1027,7 @@ if i32.const 0 i32.const 1152 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1814,7 +1814,7 @@ if i32.const 0 i32.const 1152 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/finalize.untouched.wat b/tests/compiler/rt/finalize.untouched.wat index c96a353ee5..ffe4f20ee7 100644 --- a/tests/compiler/rt/finalize.untouched.wat +++ b/tests/compiler/rt/finalize.untouched.wat @@ -1355,7 +1355,7 @@ if i32.const 0 i32.const 144 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1402,7 +1402,7 @@ if i32.const 0 i32.const 144 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1423,7 +1423,7 @@ if i32.const 0 i32.const 144 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1444,7 +1444,7 @@ if i32.const 0 i32.const 144 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -3527,7 +3527,7 @@ if i32.const 0 i32.const 144 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/stub-realloc.optimized.wat b/tests/compiler/rt/stub-realloc.optimized.wat index 9fe92e6df9..f8dd972f4e 100644 --- a/tests/compiler/rt/stub-realloc.optimized.wat +++ b/tests/compiler/rt/stub-realloc.optimized.wat @@ -314,7 +314,7 @@ if i32.const 0 i32.const 1040 - i32.const 43 + i32.const 41 i32.const 3 call $~lib/builtins/abort unreachable @@ -332,7 +332,7 @@ if i32.const 0 i32.const 1040 - i32.const 46 + i32.const 44 i32.const 14 call $~lib/builtins/abort unreachable @@ -541,7 +541,7 @@ if i32.const 0 i32.const 1040 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -556,7 +556,7 @@ if i32.const 0 i32.const 1040 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/rt/stub-realloc.untouched.wat b/tests/compiler/rt/stub-realloc.untouched.wat index 17b224bc59..2fd94b553b 100644 --- a/tests/compiler/rt/stub-realloc.untouched.wat +++ b/tests/compiler/rt/stub-realloc.untouched.wat @@ -1428,7 +1428,7 @@ if i32.const 0 i32.const 32 - i32.const 43 + i32.const 41 i32.const 3 call $~lib/builtins/abort unreachable @@ -1450,7 +1450,7 @@ if i32.const 0 i32.const 32 - i32.const 46 + i32.const 44 i32.const 14 call $~lib/builtins/abort unreachable @@ -1548,7 +1548,7 @@ if i32.const 0 i32.const 32 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/builtins/abort unreachable @@ -1567,7 +1567,7 @@ if i32.const 0 i32.const 32 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/runtime-full.optimized.wat b/tests/compiler/runtime-full.optimized.wat index fa32ef6903..33b47938f0 100644 --- a/tests/compiler/runtime-full.optimized.wat +++ b/tests/compiler/runtime-full.optimized.wat @@ -877,7 +877,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -988,7 +988,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1004,7 +1004,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/runtime-full.untouched.wat b/tests/compiler/runtime-full.untouched.wat index 23b59efce8..982cc205cd 100644 --- a/tests/compiler/runtime-full.untouched.wat +++ b/tests/compiler/runtime-full.untouched.wat @@ -1331,7 +1331,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1378,7 +1378,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1399,7 +1399,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1420,7 +1420,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index ddd2247e86..00411bd7b7 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -929,7 +929,7 @@ if i32.const 0 i32.const 1392 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 1392 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1056,7 +1056,7 @@ if i32.const 0 i32.const 1392 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index 8249707688..9f2be3362a 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -1418,7 +1418,7 @@ if i32.const 0 i32.const 384 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1465,7 +1465,7 @@ if i32.const 0 i32.const 384 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1486,7 +1486,7 @@ if i32.const 0 i32.const 384 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1507,7 +1507,7 @@ if i32.const 0 i32.const 384 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index ad0747d558..d61a0197ba 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -1144,7 +1144,7 @@ if i32.const 0 i32.const 1136 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1235,7 +1235,7 @@ if i32.const 0 i32.const 1136 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1251,7 +1251,7 @@ if i32.const 0 i32.const 1136 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2116,7 +2116,7 @@ if i32.const 0 i32.const 1136 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -2333,7 +2333,7 @@ if i32.const 1984 i32.const 1088 - i32.const 299 + i32.const 300 i32.const 21 call $~lib/builtins/abort unreachable @@ -3744,7 +3744,7 @@ if i32.const 0 i32.const 5040 - i32.const 1404 + i32.const 1398 i32.const 5 call $~lib/builtins/abort unreachable @@ -11159,7 +11159,7 @@ if i32.const 1984 i32.const 1088 - i32.const 360 + i32.const 361 i32.const 21 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.ts b/tests/compiler/std/array.ts index dbb76d1348..a37b971c25 100644 --- a/tests/compiler/std/array.ts +++ b/tests/compiler/std/array.ts @@ -518,7 +518,7 @@ var i: i32; // Test side effect pop every = arr.every((value: i32, _: i32, array: Array) => { - array.pop(); //poped items shouldn't be looked up, and we shouldn't go out of bounds + array.pop(); // popped items shouldn't be looked up, and we shouldn't go out of bounds return value < 3; }); // only 2 first items was looked up, since last 2 was removed by .pop() @@ -556,7 +556,7 @@ var i: i32; // Test side effect pop some = arr.some((value: i32, _: i32, array: Array) => { - array.pop(); // poped items shouldn't be looked up, and we shouldn't go out of bounds + array.pop(); // popped items shouldn't be looked up, and we shouldn't go out of bounds return value > 3; }); // only 2 first items was looked up, since last 2 was removed by .pop() @@ -577,7 +577,7 @@ var i: i32; // Test side effect push i = 0; arr.forEach((value: i32, _: i32, array: Array) => { - array.push(100); //push side effect should not affect this method by spec + array.push(100); // push side effect should not affect this method by spec i += value; }); // array should be changed, but this method result should be calculated for old array length @@ -595,7 +595,7 @@ var i: i32; // Test side effect pop i = 0; arr.forEach((value: i32, _: i32, array: Array) => { - array.pop(); //poped items shouldn't be looked up, and we shouldn't go out of bounds + array.pop(); // popped items shouldn't be looked up, and we shouldn't go out of bounds i += value; }); // only 2 first items was looked up, since last 2 was removed by .pop() @@ -645,7 +645,7 @@ var i: i32; // Test side effect push i = 0; arr.map((value: i32, _: i32, array: Array) => { - array.push(100); //push side effect should not affect this method by spec + array.push(100); // push side effect should not affect this method by spec i += value; return value; }); @@ -667,7 +667,7 @@ var i: i32; // Test side effect pop i = 0; arr.map((value: i32, _: i32, array: Array) => { - array.pop(); //poped items shouldn't be looked up, and we shouldn't go out of bounds + array.pop(); // popped items shouldn't be looked up, and we shouldn't go out of bounds i += value; return value; }); @@ -688,7 +688,7 @@ var i: i32; // Test side effect push i = 0; arr.filter((value: i32, _: i32, array: Array) => { - array.push(100); //push side effect should not affect this method by spec + array.push(100); // push side effect should not affect this method by spec i += value; return value >= 2; }); @@ -710,7 +710,7 @@ var i: i32; // Test side effect pop i = 0; arr.filter((value: i32, _: i32, array: Array) => { - array.pop(); //poped items shouldn't be looked up, and we shouldn't go out of bounds + array.pop(); // popped items shouldn't be looked up, and we shouldn't go out of bounds i += value; return value >= 2; }); @@ -756,7 +756,7 @@ var i: i32; // Test side effect pop i = arr.reduce(((prev: i32, current: i32, _: i32, array: Array): i32 => { - array.pop(); //poped items shouldn't be reduced, and we shouldn't go out of bounds + array.pop(); // popped items shouldn't be reduced, and we shouldn't go out of bounds return prev + current; }), 0); // only 2 first items was reduced, since last 2 was removed by .pop() @@ -801,7 +801,7 @@ var i: i32; // Test side effect pop i = arr.reduceRight(((prev: i32, current: i32, _: i32, array: Array): i32 => { - array.pop(); // poped items should be reduced + array.pop(); // popped items should be reduced return prev + current; }), 0); diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index f554ac96da..3b5bda504b 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -1581,7 +1581,7 @@ if i32.const 0 i32.const 128 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1628,7 +1628,7 @@ if i32.const 0 i32.const 128 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1649,7 +1649,7 @@ if i32.const 0 i32.const 128 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1670,7 +1670,7 @@ if i32.const 0 i32.const 128 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -4053,7 +4053,7 @@ if i32.const 0 i32.const 128 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -4344,7 +4344,7 @@ if i32.const 976 i32.const 80 - i32.const 299 + i32.const 300 i32.const 21 call $~lib/builtins/abort unreachable @@ -4765,7 +4765,7 @@ if i32.const 976 i32.const 80 - i32.const 360 + i32.const 361 i32.const 21 call $~lib/builtins/abort unreachable @@ -7176,7 +7176,7 @@ if i32.const 0 i32.const 4032 - i32.const 1404 + i32.const 1398 i32.const 5 call $~lib/builtins/abort unreachable @@ -13097,7 +13097,7 @@ if i32.const 5408 i32.const 5536 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -13504,7 +13504,7 @@ if i32.const 5408 i32.const 5536 - i32.const 350 + i32.const 344 i32.const 5 call $~lib/builtins/abort unreachable @@ -13849,23 +13849,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -13883,29 +13882,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -13919,201 +13916,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 8488 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -14121,73 +14118,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -14195,67 +14192,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 8488 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -14264,81 +14261,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 @@ -16923,7 +16920,7 @@ if i32.const 5408 i32.const 5536 - i32.const 401 + i32.const 395 i32.const 5 call $~lib/builtins/abort unreachable @@ -17353,7 +17350,7 @@ if i32.const 5408 i32.const 5536 - i32.const 431 + i32.const 425 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index 7b293d62ad..cf7c245122 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -891,7 +891,7 @@ if i32.const 0 i32.const 1152 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1002,7 +1002,7 @@ if i32.const 0 i32.const 1152 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1018,7 +1018,7 @@ if i32.const 0 i32.const 1152 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 18d1314edc..06c9a97c50 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -1348,7 +1348,7 @@ if i32.const 0 i32.const 144 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1395,7 +1395,7 @@ if i32.const 0 i32.const 144 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1416,7 +1416,7 @@ if i32.const 0 i32.const 144 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1437,7 +1437,7 @@ if i32.const 0 i32.const 144 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index 0dc4eb871c..cca8c7293e 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -899,7 +899,7 @@ if i32.const 0 i32.const 1152 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1010,7 +1010,7 @@ if i32.const 0 i32.const 1152 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1026,7 +1026,7 @@ if i32.const 0 i32.const 1152 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1359,7 +1359,7 @@ if i32.const 1312 i32.const 1440 - i32.const 48 + i32.const 44 i32.const 7 call $~lib/builtins/abort unreachable @@ -1385,7 +1385,7 @@ if i32.const 1312 i32.const 1440 - i32.const 59 + i32.const 51 i32.const 50 call $~lib/builtins/abort unreachable @@ -1423,7 +1423,7 @@ if i32.const 1312 i32.const 1440 - i32.const 66 + i32.const 58 i32.const 7 call $~lib/builtins/abort unreachable @@ -1457,7 +1457,7 @@ if i32.const 1312 i32.const 1440 - i32.const 74 + i32.const 66 i32.const 7 call $~lib/builtins/abort unreachable @@ -1486,7 +1486,7 @@ if i32.const 1312 i32.const 1440 - i32.const 159 + i32.const 151 i32.const 7 call $~lib/builtins/abort unreachable @@ -1511,7 +1511,7 @@ if i32.const 1312 i32.const 1440 - i32.const 80 + i32.const 72 i32.const 50 call $~lib/builtins/abort unreachable @@ -1547,7 +1547,7 @@ if i32.const 1312 i32.const 1440 - i32.const 87 + i32.const 79 i32.const 7 call $~lib/builtins/abort unreachable @@ -1581,7 +1581,7 @@ if i32.const 1312 i32.const 1440 - i32.const 95 + i32.const 87 i32.const 7 call $~lib/builtins/abort unreachable @@ -1610,7 +1610,7 @@ if i32.const 1312 i32.const 1440 - i32.const 167 + i32.const 159 i32.const 7 call $~lib/builtins/abort unreachable @@ -1635,7 +1635,7 @@ if i32.const 1312 i32.const 1440 - i32.const 103 + i32.const 95 i32.const 7 call $~lib/builtins/abort unreachable @@ -1663,7 +1663,7 @@ if i32.const 1312 i32.const 1440 - i32.const 111 + i32.const 103 i32.const 7 call $~lib/builtins/abort unreachable @@ -1691,7 +1691,7 @@ if i32.const 1312 i32.const 1440 - i32.const 124 + i32.const 116 i32.const 7 call $~lib/builtins/abort unreachable @@ -1715,7 +1715,7 @@ if i32.const 1312 i32.const 1440 - i32.const 131 + i32.const 123 i32.const 7 call $~lib/builtins/abort unreachable @@ -1739,7 +1739,7 @@ if i32.const 1312 i32.const 1440 - i32.const 175 + i32.const 167 i32.const 7 call $~lib/builtins/abort unreachable @@ -1763,7 +1763,7 @@ if i32.const 1312 i32.const 1440 - i32.const 143 + i32.const 135 i32.const 7 call $~lib/builtins/abort unreachable @@ -1787,7 +1787,7 @@ if i32.const 1312 i32.const 1440 - i32.const 150 + i32.const 142 i32.const 7 call $~lib/builtins/abort unreachable @@ -1811,7 +1811,7 @@ if i32.const 1312 i32.const 1440 - i32.const 182 + i32.const 174 i32.const 7 call $~lib/builtins/abort unreachable @@ -3107,7 +3107,7 @@ if i32.const 1312 i32.const 1440 - i32.const 117 + i32.const 109 i32.const 50 call $~lib/builtins/abort unreachable @@ -3246,7 +3246,7 @@ if i32.const 1312 i32.const 1440 - i32.const 136 + i32.const 128 i32.const 50 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 8581adb76a..d0b78e568f 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -1356,7 +1356,7 @@ if i32.const 0 i32.const 144 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1403,7 +1403,7 @@ if i32.const 0 i32.const 144 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1424,7 +1424,7 @@ if i32.const 0 i32.const 144 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1445,7 +1445,7 @@ if i32.const 0 i32.const 144 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2082,7 +2082,7 @@ if i32.const 304 i32.const 432 - i32.const 48 + i32.const 44 i32.const 7 call $~lib/builtins/abort unreachable @@ -2112,7 +2112,7 @@ if i32.const 304 i32.const 432 - i32.const 59 + i32.const 51 i32.const 50 call $~lib/builtins/abort unreachable @@ -2160,7 +2160,7 @@ if i32.const 304 i32.const 432 - i32.const 66 + i32.const 58 i32.const 7 call $~lib/builtins/abort unreachable @@ -2218,7 +2218,7 @@ if i32.const 304 i32.const 432 - i32.const 74 + i32.const 66 i32.const 7 call $~lib/builtins/abort unreachable @@ -2305,7 +2305,7 @@ if i32.const 304 i32.const 432 - i32.const 159 + i32.const 151 i32.const 7 call $~lib/builtins/abort unreachable @@ -2332,7 +2332,7 @@ if i32.const 304 i32.const 432 - i32.const 80 + i32.const 72 i32.const 50 call $~lib/builtins/abort unreachable @@ -2378,7 +2378,7 @@ if i32.const 304 i32.const 432 - i32.const 87 + i32.const 79 i32.const 7 call $~lib/builtins/abort unreachable @@ -2412,7 +2412,7 @@ if i32.const 304 i32.const 432 - i32.const 95 + i32.const 87 i32.const 7 call $~lib/builtins/abort unreachable @@ -2446,7 +2446,7 @@ if i32.const 304 i32.const 432 - i32.const 167 + i32.const 159 i32.const 7 call $~lib/builtins/abort unreachable @@ -2479,7 +2479,7 @@ if i32.const 304 i32.const 432 - i32.const 103 + i32.const 95 i32.const 7 call $~lib/builtins/abort unreachable @@ -2517,7 +2517,7 @@ if i32.const 304 i32.const 432 - i32.const 111 + i32.const 103 i32.const 7 call $~lib/builtins/abort unreachable @@ -2549,7 +2549,7 @@ if i32.const 304 i32.const 432 - i32.const 117 + i32.const 109 i32.const 50 call $~lib/builtins/abort unreachable @@ -2575,7 +2575,7 @@ if i32.const 304 i32.const 432 - i32.const 124 + i32.const 116 i32.const 7 call $~lib/builtins/abort unreachable @@ -2607,7 +2607,7 @@ if i32.const 304 i32.const 432 - i32.const 131 + i32.const 123 i32.const 7 call $~lib/builtins/abort unreachable @@ -2639,7 +2639,7 @@ if i32.const 304 i32.const 432 - i32.const 175 + i32.const 167 i32.const 7 call $~lib/builtins/abort unreachable @@ -2665,7 +2665,7 @@ if i32.const 304 i32.const 432 - i32.const 136 + i32.const 128 i32.const 50 call $~lib/builtins/abort unreachable @@ -2691,7 +2691,7 @@ if i32.const 304 i32.const 432 - i32.const 143 + i32.const 135 i32.const 7 call $~lib/builtins/abort unreachable @@ -2723,7 +2723,7 @@ if i32.const 304 i32.const 432 - i32.const 150 + i32.const 142 i32.const 7 call $~lib/builtins/abort unreachable @@ -2755,7 +2755,7 @@ if i32.const 304 i32.const 432 - i32.const 182 + i32.const 174 i32.const 7 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 36f41bfa7e..3936b0622e 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -922,7 +922,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1013,7 +1013,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1029,7 +1029,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1612,7 +1612,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -1972,7 +1972,7 @@ if i32.const 0 i32.const 1040 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -3825,7 +3825,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -5089,7 +5089,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -6372,7 +6372,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -7348,7 +7348,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -8811,7 +8811,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -10766,7 +10766,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -11992,7 +11992,7 @@ if i32.const 1360 i32.const 1424 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 3ed60db6e5..00c57c04ef 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -1354,7 +1354,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1401,7 +1401,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1422,7 +1422,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1443,7 +1443,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2245,7 +2245,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -2378,7 +2378,7 @@ if i32.const 0 i32.const 32 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -6146,7 +6146,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -7943,7 +7943,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -9750,7 +9750,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -11149,7 +11149,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -12350,7 +12350,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -14225,7 +14225,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -16035,7 +16035,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -17801,7 +17801,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -19550,7 +19550,7 @@ if i32.const 352 i32.const 416 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index a73ceeae40..cea64b836f 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -8438,7 +8438,7 @@ if i32.const 0 i32.const 3616 - i32.const 1404 + i32.const 1398 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/math.ts b/tests/compiler/std/math.ts index bfb9cb957d..00e394abca 100644 --- a/tests/compiler/std/math.ts +++ b/tests/compiler/std/math.ts @@ -1681,7 +1681,7 @@ assert(test_floorf(-7.888609052e-31, -1.0, 0.0, INEXACT)); //////////////////////////////////////////////////////////////////////////////////////////////////// function test_hypot(value1: f64, value2: f64, expected: f64, error: f64, flags: i32): bool { - return check(NativeMath.hypot(value1, value2), expected, error, flags) /*&& + return check(NativeMath.hypot(value1, value2), expected, error, flags) /* && (!js || check( JSMath.hypot(value1, value2), expected, error, flags))*/; // ^ FIXME: Math.hypot is broken in v8 7.7 (node 12.11) due to // https://bugs.chromium.org/p/v8/issues/detail?id=9546 diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index 7ee6e66b0b..dd414f8d2e 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -11422,7 +11422,7 @@ if i32.const 0 i32.const 13360 - i32.const 1404 + i32.const 1398 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index ceb2ad6dcf..fb949d1b7d 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -919,7 +919,7 @@ if i32.const 0 i32.const 1040 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1010,7 +1010,7 @@ if i32.const 0 i32.const 1040 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1026,7 +1026,7 @@ if i32.const 0 i32.const 1040 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1963,7 +1963,7 @@ if i32.const 0 i32.const 1040 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 19396fdf08..81665a6010 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -1349,7 +1349,7 @@ if i32.const 0 i32.const 32 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1396,7 +1396,7 @@ if i32.const 0 i32.const 32 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1417,7 +1417,7 @@ if i32.const 0 i32.const 32 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1438,7 +1438,7 @@ if i32.const 0 i32.const 32 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2314,7 +2314,7 @@ if i32.const 0 i32.const 32 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/static-array.optimized.wat b/tests/compiler/std/static-array.optimized.wat index 3edb592153..5a80874100 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -282,7 +282,7 @@ if i32.const 0 i32.const 1520 - i32.const 43 + i32.const 41 i32.const 3 call $~lib/builtins/abort unreachable @@ -300,7 +300,7 @@ if i32.const 0 i32.const 1520 - i32.const 46 + i32.const 44 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index dca5df6311..8f6a22bd54 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -1459,7 +1459,7 @@ if i32.const 0 i32.const 512 - i32.const 43 + i32.const 41 i32.const 3 call $~lib/builtins/abort unreachable @@ -1481,7 +1481,7 @@ if i32.const 0 i32.const 512 - i32.const 46 + i32.const 44 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.optimized.wat b/tests/compiler/std/staticarray.optimized.wat index ec97281e2d..25a05cd57c 100644 --- a/tests/compiler/std/staticarray.optimized.wat +++ b/tests/compiler/std/staticarray.optimized.wat @@ -929,7 +929,7 @@ if i32.const 0 i32.const 1328 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1040,7 +1040,7 @@ if i32.const 0 i32.const 1328 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1056,7 +1056,7 @@ if i32.const 0 i32.const 1328 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.untouched.wat b/tests/compiler/std/staticarray.untouched.wat index c975b65418..c964d62522 100644 --- a/tests/compiler/std/staticarray.untouched.wat +++ b/tests/compiler/std/staticarray.untouched.wat @@ -1408,7 +1408,7 @@ if i32.const 0 i32.const 320 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1455,7 +1455,7 @@ if i32.const 0 i32.const 320 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1476,7 +1476,7 @@ if i32.const 0 i32.const 320 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1497,7 +1497,7 @@ if i32.const 0 i32.const 320 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-casemapping.optimized.wat b/tests/compiler/std/string-casemapping.optimized.wat index c8dd2bf471..99baab6dd0 100644 --- a/tests/compiler/std/string-casemapping.optimized.wat +++ b/tests/compiler/std/string-casemapping.optimized.wat @@ -1245,7 +1245,7 @@ if i32.const 0 i32.const 1104 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1336,7 +1336,7 @@ if i32.const 0 i32.const 1104 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1352,7 +1352,7 @@ if i32.const 0 i32.const 1104 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1862,7 +1862,7 @@ if i32.const 0 i32.const 1104 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-casemapping.ts b/tests/compiler/std/string-casemapping.ts index 573e7c0b99..efed0bc741 100644 --- a/tests/compiler/std/string-casemapping.ts +++ b/tests/compiler/std/string-casemapping.ts @@ -42,8 +42,8 @@ assert( assert("ß".toUpperCase().toLowerCase() == "ss"); assert("fi".toUpperCase().toLowerCase() == "fi"); assert( - "𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 𠹷 𠺝 𠺢 𠻗 𠻹 𠻺 𠼭 𠼮 𠽌 𠾴 𠾼 𠿪 𡁜 𡁯 𡁵 𡁶 𡁻 𡃁" - .toUpperCase().toLowerCase() == + "𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 𠹷 𠺝 𠺢 𠻗 𠻹 𠻺 𠼭 𠼮 𠽌 𠾴 𠾼 𠿪 𡁜 𡁯 𡁵 𡁶 𡁻 𡃁".toUpperCase().toLowerCase() + == "𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 𠹷 𠺝 𠺢 𠻗 𠻹 𠻺 𠼭 𠼮 𠽌 𠾴 𠾼 𠿪 𡁜 𡁯 𡁵 𡁶 𡁻 𡃁" ); @@ -147,7 +147,7 @@ for (let i = 0; i <= 0x10FFFF; i++) { trace("origUpperCode != expectUpperCode", 1, i); trace(" origUpperCode = " + origUpperCode.toString()); trace(" expectUpperCode = " + expectUpperCode.toString()); - } + } // FIXME: enable these again once issue #1195 has been solved // assert(origLowerCode == expectLowerCode); diff --git a/tests/compiler/std/string-casemapping.untouched.wat b/tests/compiler/std/string-casemapping.untouched.wat index 33dbed80d2..23f9f1172d 100644 --- a/tests/compiler/std/string-casemapping.untouched.wat +++ b/tests/compiler/std/string-casemapping.untouched.wat @@ -1587,7 +1587,7 @@ if i32.const 0 i32.const 96 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1634,7 +1634,7 @@ if i32.const 0 i32.const 96 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1655,7 +1655,7 @@ if i32.const 0 i32.const 96 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1676,7 +1676,7 @@ if i32.const 0 i32.const 96 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -1950,7 +1950,7 @@ if i32.const 0 i32.const 96 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -5269,7 +5269,7 @@ if i32.const 17552 i32.const 17680 - i32.const 401 + i32.const 395 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-encoding.optimized.wat b/tests/compiler/std/string-encoding.optimized.wat index 0e16ace529..025fc99efd 100644 --- a/tests/compiler/std/string-encoding.optimized.wat +++ b/tests/compiler/std/string-encoding.optimized.wat @@ -975,7 +975,7 @@ if i32.const 0 i32.const 1184 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1066,7 +1066,7 @@ if i32.const 0 i32.const 1184 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1082,7 +1082,7 @@ if i32.const 0 i32.const 1184 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2666,7 +2666,7 @@ if i32.const 0 i32.const 1184 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string-encoding.untouched.wat b/tests/compiler/std/string-encoding.untouched.wat index 9ebfbcd5af..7890591f9c 100644 --- a/tests/compiler/std/string-encoding.untouched.wat +++ b/tests/compiler/std/string-encoding.untouched.wat @@ -1452,7 +1452,7 @@ if i32.const 0 i32.const 176 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1499,7 +1499,7 @@ if i32.const 0 i32.const 176 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1520,7 +1520,7 @@ if i32.const 0 i32.const 176 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1541,7 +1541,7 @@ if i32.const 0 i32.const 176 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -4214,7 +4214,7 @@ if i32.const 0 i32.const 176 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index b641bf71af..80f6dc7d09 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -1523,7 +1523,7 @@ if i32.const 0 i32.const 1360 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1614,7 +1614,7 @@ if i32.const 0 i32.const 1360 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1630,7 +1630,7 @@ if i32.const 0 i32.const 1360 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -4368,7 +4368,7 @@ if i32.const 0 i32.const 1360 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -5773,7 +5773,7 @@ if i32.const 13552 i32.const 13680 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -5878,7 +5878,7 @@ if i32.const 13552 i32.const 13680 - i32.const 350 + i32.const 344 i32.const 5 call $~lib/builtins/abort unreachable @@ -6071,7 +6071,7 @@ if i32.const 13552 i32.const 13680 - i32.const 401 + i32.const 395 i32.const 5 call $~lib/builtins/abort unreachable @@ -6173,7 +6173,7 @@ if i32.const 13552 i32.const 13680 - i32.const 431 + i32.const 425 i32.const 5 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 12559b898e..5f8ef11c8f 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -2098,7 +2098,7 @@ if i32.const 0 i32.const 352 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -2145,7 +2145,7 @@ if i32.const 0 i32.const 352 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -2166,7 +2166,7 @@ if i32.const 0 i32.const 352 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -2187,7 +2187,7 @@ if i32.const 0 i32.const 352 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -7319,7 +7319,7 @@ if i32.const 0 i32.const 352 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -9269,7 +9269,7 @@ if i32.const 12544 i32.const 12672 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -9411,7 +9411,7 @@ if i32.const 12544 i32.const 12672 - i32.const 350 + i32.const 344 i32.const 5 call $~lib/builtins/abort unreachable @@ -9712,7 +9712,7 @@ if i32.const 12544 i32.const 12672 - i32.const 401 + i32.const 395 i32.const 5 call $~lib/builtins/abort unreachable @@ -9865,7 +9865,7 @@ if i32.const 12544 i32.const 12672 - i32.const 431 + i32.const 425 i32.const 5 call $~lib/builtins/abort unreachable @@ -10028,23 +10028,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -10062,29 +10061,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -10098,201 +10095,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 20184 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -10300,73 +10297,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -10374,67 +10371,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 20184 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -10443,81 +10440,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 4d2afc686c..788292843d 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -1005,7 +1005,7 @@ if i32.const 1232 i32.const 1296 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -1104,7 +1104,7 @@ if i32.const 1232 i32.const 1296 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index f54cf796b1..491865bb72 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -896,7 +896,7 @@ if i32.const 224 i32.const 288 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable @@ -1739,7 +1739,7 @@ if i32.const 224 i32.const 288 - i32.const 110 + i32.const 104 i32.const 17 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 3f35707fde..16c8bba764 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1098,7 +1098,7 @@ if i32.const 0 i32.const 1152 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1189,7 +1189,7 @@ if i32.const 0 i32.const 1152 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1205,7 +1205,7 @@ if i32.const 0 i32.const 1152 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -2452,7 +2452,7 @@ if i32.const 0 i32.const 1152 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 2214f1f3e8..beca1da76b 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -1545,7 +1545,7 @@ if i32.const 0 i32.const 144 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1592,7 +1592,7 @@ if i32.const 0 i32.const 144 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1613,7 +1613,7 @@ if i32.const 0 i32.const 144 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1634,7 +1634,7 @@ if i32.const 0 i32.const 144 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable @@ -3219,7 +3219,7 @@ if i32.const 0 i32.const 144 - i32.const 581 + i32.const 580 i32.const 3 call $~lib/builtins/abort unreachable @@ -32266,7 +32266,7 @@ if i32.const 1936 i32.const 2064 - i32.const 373 + i32.const 367 i32.const 5 call $~lib/builtins/abort unreachable @@ -33072,7 +33072,7 @@ if i32.const 1936 i32.const 2064 - i32.const 350 + i32.const 344 i32.const 5 call $~lib/builtins/abort unreachable @@ -35080,7 +35080,7 @@ if i32.const 1936 i32.const 2064 - i32.const 431 + i32.const 425 i32.const 5 call $~lib/builtins/abort unreachable @@ -35621,7 +35621,7 @@ if i32.const 1936 i32.const 2064 - i32.const 401 + i32.const 395 i32.const 5 call $~lib/builtins/abort unreachable @@ -36095,23 +36095,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -36129,29 +36128,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -36165,201 +36162,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 4776 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -36367,73 +36364,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -36441,67 +36438,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 4776 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -36510,81 +36507,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 diff --git a/tests/compiler/wasi/abort.js b/tests/compiler/wasi/abort.js index f036fa120a..2b08412d0b 100644 --- a/tests/compiler/wasi/abort.js +++ b/tests/compiler/wasi/abort.js @@ -28,4 +28,4 @@ exports.postInstantiate = function(instance) { } if (!thrown) failed = "unexpected missing throw"; if (failed) throw Error(failed); -} +}; diff --git a/tests/compiler/wasi/seed.js b/tests/compiler/wasi/seed.js index 167da2f42e..710ac9af40 100644 --- a/tests/compiler/wasi/seed.js +++ b/tests/compiler/wasi/seed.js @@ -1,4 +1,5 @@ var memory; +var failed; exports.preInstantiate = function(imports, exports) { imports["wasi_snapshot_preview1"] = { @@ -22,4 +23,5 @@ exports.postInstantiate = function(instance) { const exports = instance.exports; memory = exports.memory; console.log("Math.random = " + exports.test()); -} + if (failed) throw Error(failed); +}; diff --git a/tests/compiler/wasi/seed.optimized.wat b/tests/compiler/wasi/seed.optimized.wat index 7551fbf30a..dd3bf9beee 100644 --- a/tests/compiler/wasi/seed.optimized.wat +++ b/tests/compiler/wasi/seed.optimized.wat @@ -297,7 +297,7 @@ (local $4 i32) i32.const 5 local.set $1 - i32.const 1404 + i32.const 1398 local.set $0 i32.const 0 i32.const 12 @@ -318,7 +318,7 @@ local.tee $2 i32.const 40 i32.store8 - i32.const 1404 + i32.const 1398 call $~lib/util/number/decimalCount32 local.tee $4 local.get $2 diff --git a/tests/compiler/wasi/seed.untouched.wat b/tests/compiler/wasi/seed.untouched.wat index 7b482d50a1..1b3bec1e6b 100644 --- a/tests/compiler/wasi/seed.untouched.wat +++ b/tests/compiler/wasi/seed.untouched.wat @@ -612,7 +612,7 @@ if i32.const 0 i32.const 32 - i32.const 1404 + i32.const 1398 i32.const 5 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/wasi/trace.js b/tests/compiler/wasi/trace.js index a3c0ac4864..9a3d00de50 100644 --- a/tests/compiler/wasi/trace.js +++ b/tests/compiler/wasi/trace.js @@ -1,4 +1,5 @@ var memory; +var failed; exports.preInstantiate = function(imports, exports) { imports["wasi_snapshot_preview1"] = { @@ -18,4 +19,5 @@ exports.preInstantiate = function(imports, exports) { exports.postInstantiate = function(instance) { const exports = instance.exports; memory = exports.memory; -} + if (failed) throw Error(failed); +}; diff --git a/tests/compiler/wasi/trace.optimized.wat b/tests/compiler/wasi/trace.optimized.wat index 475826e3b4..37dd3b71e2 100644 --- a/tests/compiler/wasi/trace.optimized.wat +++ b/tests/compiler/wasi/trace.optimized.wat @@ -1899,7 +1899,7 @@ select i32.eqz if - i32.const 70 + i32.const 68 i32.const 3 call $~lib/wasi/index/abort unreachable @@ -1912,7 +1912,7 @@ i32.const 1 i32.ne if - i32.const 72 + i32.const 70 i32.const 14 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/wasi/trace.untouched.wat b/tests/compiler/wasi/trace.untouched.wat index 4c4c14eaec..1942f96e70 100644 --- a/tests/compiler/wasi/trace.untouched.wat +++ b/tests/compiler/wasi/trace.untouched.wat @@ -545,23 +545,22 @@ (local $9 i64) (local $10 i64) (local $11 i32) - (local $12 i32) - (local $13 i64) + (local $12 i64) + (local $13 i32) (local $14 i32) (local $15 i32) (local $16 i32) (local $17 i32) - (local $18 i32) + (local $18 i64) (local $19 i64) (local $20 i64) (local $21 i64) (local $22 i64) - (local $23 i64) + (local $23 i32) (local $24 i32) (local $25 i32) (local $26 i32) - (local $27 i32) - (local $28 i64) + (local $27 i64) i32.const 0 local.get $4 i32.sub @@ -579,29 +578,27 @@ local.get $1 i64.sub local.set $10 - local.get $4 - local.set $11 local.get $3 local.get $7 i64.extend_i32_s i64.shr_u i32.wrap_i64 - local.set $12 + local.set $11 local.get $3 local.get $9 i64.and - local.set $13 - local.get $12 + local.set $12 + local.get $11 call $~lib/util/number/decimalCount32 - local.set $14 + local.set $13 local.get $6 - local.set $15 + local.set $14 loop $while-continue|0 - local.get $14 + local.get $13 i32.const 0 i32.gt_s - local.set $16 - local.get $16 + local.set $15 + local.get $15 if block $break|1 block $case10|1 @@ -615,201 +612,201 @@ block $case2|1 block $case1|1 block $case0|1 - local.get $14 - local.set $18 - local.get $18 + local.get $13 + local.set $17 + local.get $17 i32.const 10 i32.eq br_if $case0|1 - local.get $18 + local.get $17 i32.const 9 i32.eq br_if $case1|1 - local.get $18 + local.get $17 i32.const 8 i32.eq br_if $case2|1 - local.get $18 + local.get $17 i32.const 7 i32.eq br_if $case3|1 - local.get $18 + local.get $17 i32.const 6 i32.eq br_if $case4|1 - local.get $18 + local.get $17 i32.const 5 i32.eq br_if $case5|1 - local.get $18 + local.get $17 i32.const 4 i32.eq br_if $case6|1 - local.get $18 + local.get $17 i32.const 3 i32.eq br_if $case7|1 - local.get $18 + local.get $17 i32.const 2 i32.eq br_if $case8|1 - local.get $18 + local.get $17 i32.const 1 i32.eq br_if $case9|1 br $case10|1 end - local.get $12 + local.get $11 i32.const 1000000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 1000 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 1000 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 100 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 100 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 + local.get $11 i32.const 10 i32.div_u - local.set $17 - local.get $12 + local.set $16 + local.get $11 i32.const 10 i32.rem_u - local.set $12 + local.set $11 br $break|1 end - local.get $12 - local.set $17 + local.get $11 + local.set $16 i32.const 0 - local.set $12 + local.set $11 br $break|1 end i32.const 0 - local.set $17 + local.set $16 br $break|1 end - local.get $17 - local.get $15 + local.get $16 + local.get $14 i32.or if local.get $0 - local.get $15 - local.tee $18 + local.get $14 + local.tee $17 i32.const 1 i32.add - local.set $15 - local.get $18 + local.set $14 + local.get $17 i32.const 1 i32.shl i32.add i32.const 48 - local.get $17 + local.get $16 i32.const 65535 i32.and i32.add i32.store16 end - local.get $14 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $12 + local.set $13 + local.get $11 i64.extend_i32_u local.get $7 i64.extend_i32_s i64.shl - local.get $13 + local.get $12 i64.add - local.set $19 - local.get $19 + local.set $18 + local.get $18 local.get $5 i64.le_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $0 - local.set $24 - local.get $15 - local.set $18 - local.get $5 local.set $23 - local.get $19 + local.get $14 + local.set $17 + local.get $5 local.set $22 + local.get $18 + local.set $21 i32.const 928 - local.get $14 + local.get $13 i32.const 2 i32.shl i32.add @@ -817,73 +814,73 @@ local.get $7 i64.extend_i32_s i64.shl - local.set $21 - local.get $10 local.set $20 - local.get $24 - local.get $18 + local.get $10 + local.set $19 + local.get $23 + local.get $17 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $25 - local.get $25 + local.set $24 + local.get $24 i32.load16_u - local.set $26 + local.set $25 loop $while-continue|3 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $23 local.get $22 - i64.sub local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $27 - local.get $27 + local.set $26 + local.get $26 if - local.get $26 + local.get $25 i32.const 1 i32.sub - local.set $26 - local.get $22 + local.set $25 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|3 end end + local.get $24 local.get $25 - local.get $26 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|0 @@ -891,67 +888,67 @@ end loop $while-continue|4 i32.const 1 - local.set $16 - local.get $16 + local.set $15 + local.get $15 if - local.get $13 + local.get $12 i64.const 10 i64.mul - local.set $13 + local.set $12 local.get $5 i64.const 10 i64.mul local.set $5 - local.get $13 + local.get $12 local.get $7 i64.extend_i32_s i64.shr_u - local.set $23 - local.get $23 - local.get $15 + local.set $22 + local.get $22 + local.get $14 i64.extend_i32_s i64.or i64.const 0 i64.ne if local.get $0 - local.get $15 - local.tee $26 + local.get $14 + local.tee $25 i32.const 1 i32.add - local.set $15 - local.get $26 + local.set $14 + local.get $25 i32.const 1 i32.shl i32.add i32.const 48 - local.get $23 + local.get $22 i32.wrap_i64 i32.const 65535 i32.and i32.add i32.store16 end - local.get $13 + local.get $12 local.get $9 i64.and - local.set $13 - local.get $14 + local.set $12 + local.get $13 i32.const 1 i32.sub - local.set $14 - local.get $13 + local.set $13 + local.get $12 local.get $5 i64.lt_u if global.get $~lib/util/number/_K - local.get $14 + local.get $13 i32.add global.set $~lib/util/number/_K local.get $10 i32.const 928 i32.const 0 - local.get $14 + local.get $13 i32.sub i32.const 2 i32.shl @@ -960,81 +957,81 @@ i64.mul local.set $10 local.get $0 - local.set $18 - local.get $15 - local.set $27 + local.set $17 + local.get $14 + local.set $26 local.get $5 - local.set $28 - local.get $13 - local.set $22 - local.get $8 + local.set $27 + local.get $12 local.set $21 - local.get $10 + local.get $8 local.set $20 - local.get $18 - local.get $27 + local.get $10 + local.set $19 + local.get $17 + local.get $26 i32.const 1 i32.sub i32.const 1 i32.shl i32.add - local.set $26 - local.get $26 - i32.load16_u local.set $25 + local.get $25 + i32.load16_u + local.set $24 loop $while-continue|6 - local.get $22 - local.get $20 + local.get $21 + local.get $19 i64.lt_u if (result i32) - local.get $28 - local.get $22 - i64.sub + local.get $27 local.get $21 + i64.sub + local.get $20 i64.ge_u else i32.const 0 end if (result i32) - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.lt_u if (result i32) i32.const 1 else - local.get $20 - local.get $22 + local.get $19 + local.get $21 i64.sub - local.get $22 local.get $21 - i64.add local.get $20 + i64.add + local.get $19 i64.sub i64.gt_u end else i32.const 0 end - local.set $24 - local.get $24 + local.set $23 + local.get $23 if - local.get $25 + local.get $24 i32.const 1 i32.sub - local.set $25 - local.get $22 + local.set $24 local.get $21 + local.get $20 i64.add - local.set $22 + local.set $21 br $while-continue|6 end end - local.get $26 local.get $25 + local.get $24 i32.store16 - local.get $15 + local.get $14 return end br $while-continue|4 @@ -3450,7 +3447,7 @@ if i32.const 0 i32.const 1392 - i32.const 70 + i32.const 68 i32.const 3 call $~lib/wasi/index/abort unreachable @@ -3469,7 +3466,7 @@ if i32.const 0 i32.const 1392 - i32.const 72 + i32.const 70 i32.const 14 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/while.optimized.wat b/tests/compiler/while.optimized.wat index 9a365e4cff..215533560e 100644 --- a/tests/compiler/while.optimized.wat +++ b/tests/compiler/while.optimized.wat @@ -817,7 +817,7 @@ if i32.const 0 i32.const 1072 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -887,7 +887,7 @@ if i32.const 0 i32.const 1072 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -903,7 +903,7 @@ if i32.const 0 i32.const 1072 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/while.untouched.wat b/tests/compiler/while.untouched.wat index 9601138127..4886d25300 100644 --- a/tests/compiler/while.untouched.wat +++ b/tests/compiler/while.untouched.wat @@ -1786,7 +1786,7 @@ if i32.const 0 i32.const 64 - i32.const 501 + i32.const 500 i32.const 14 call $~lib/builtins/abort unreachable @@ -1833,7 +1833,7 @@ if i32.const 0 i32.const 64 - i32.const 513 + i32.const 512 i32.const 20 call $~lib/builtins/abort unreachable @@ -1854,7 +1854,7 @@ if i32.const 0 i32.const 64 - i32.const 518 + i32.const 517 i32.const 18 call $~lib/builtins/abort unreachable @@ -1875,7 +1875,7 @@ if i32.const 0 i32.const 64 - i32.const 521 + i32.const 520 i32.const 14 call $~lib/builtins/abort unreachable diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 9ad6e5b4c9..0000000000 --- a/tslint.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "extends": "./lib/lint", - "defaultSeverity": "error", - "rules": { - "as-internal-case": {}, - "as-internal-diagnostics": {}, - "indent": { - "options": ["spaces", 2] - }, - "member-access": { - "options": ["no-public"] - }, - "quotemark": { - "options": ["double"] - }, - "semicolon": { - "options": ["always"] - }, - "whitespace": { - "options": [ - "check-branch", - "check-decl", - "check-operator", - "check-module", - "check-rest-spread", - "check-type", - "check-type-operator", - "check-preblock" - ] - }, - "restrict-plus-operands": false - }, - "jsRules": { - "max-line-length": { - "options": [{ - "limit": 120, - "ignore-pattern": " *DiagnosticCode\\.[^ ]+,$" - }] - }, - "quotemark": { - "options": ["double"] - }, - "radix": {}, - "semicolon": { - "options": ["always"] - } - } -} diff --git a/webpack.config.js b/webpack.config.js index ed6bb8cec2..e63a7cfe84 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -103,7 +103,7 @@ const bin = { }, __dirname: JSON.stringify(".") }), - new webpack.IgnorePlugin(/\.\/src|package\.json|^(ts\-node|glob)$/) + new webpack.IgnorePlugin(/\.\/src|package\.json|^(ts-node|glob)$/) ], optimization: { minimize: true,