mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Cleanup; Initial tslint integration
This commit is contained in:
parent
16ffddc5d5
commit
8dc517e352
@ -2,5 +2,8 @@ language: node_js
|
||||
node_js:
|
||||
- lts/*
|
||||
- node
|
||||
before_script: npm run clean && node bin/asc -v && npm test
|
||||
script: npm run build && node bin/asc -v && npm test
|
||||
before_script:
|
||||
- npm run lint
|
||||
- npm run clean && node bin/asc -v && npm test
|
||||
script:
|
||||
- npm run build && node bin/asc -v && npm test
|
||||
|
@ -13,13 +13,13 @@ try {
|
||||
} catch (e) {
|
||||
try {
|
||||
require("ts-node").register({
|
||||
project: path.join(__dirname, "..", "src")
|
||||
project: path.join(__dirname, "..", "src", "tsconfig.json")
|
||||
});
|
||||
require("../src/glue/js");
|
||||
assemblyscript = require("../src");
|
||||
isDev = true;
|
||||
} catch (e) {
|
||||
// last resort: browser bundle under node
|
||||
// last resort: browser bundle under node (relative to 'dist/')
|
||||
assemblyscript = require("./assemblyscript");
|
||||
isDev = false;
|
||||
}
|
||||
@ -480,7 +480,7 @@ exports.main = function main(argv, options, callback) {
|
||||
}
|
||||
|
||||
// Write asm.js
|
||||
if (args.asmjsFile != null && args.asmjsFile.length) {
|
||||
if (args.asmjsFile != null) {
|
||||
let asm;
|
||||
if (args.asmjsFile.length) {
|
||||
stats.emitCount++;
|
||||
|
2
dist/asc.js
vendored
2
dist/asc.js
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js
vendored
2
dist/assemblyscript.js
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js.map
vendored
2
dist/assemblyscript.js.map
vendored
File diff suppressed because one or more lines are too long
63
lib/tslint/asFormatter.js
Normal file
63
lib/tslint/asFormatter.js
Normal file
@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var abstractFormatter_1 = require("tslint/lib/language/formatter/abstractFormatter");
|
||||
var colorBlue = "\u001b[93m";
|
||||
var colorYellow = "\u001b[93m";
|
||||
var colorRed = "\u001b[91m";
|
||||
var colorReset = "\u001b[0m";
|
||||
var Formatter = /** @class */ (function (_super) {
|
||||
__extends(Formatter, _super);
|
||||
function Formatter() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Formatter.prototype.format = function (failures) {
|
||||
return this.mapToMessages(failures).join("\n") + "\n";
|
||||
};
|
||||
Formatter.prototype.mapToMessages = function (failures) {
|
||||
var _this = this;
|
||||
return failures.map(function (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 {
|
||||
var 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;
|
||||
}
|
||||
});
|
||||
};
|
||||
Formatter.metadata = {
|
||||
formatterName: "as",
|
||||
description: "AssemblyScript's TSLint formatter.",
|
||||
sample: "Similar to ASC's output.",
|
||||
consumer: "human"
|
||||
};
|
||||
return Formatter;
|
||||
}(abstractFormatter_1.AbstractFormatter));
|
||||
exports.Formatter = Formatter;
|
53
lib/tslint/asFormatter.ts
Normal file
53
lib/tslint/asFormatter.ts
Normal file
@ -0,0 +1,53 @@
|
||||
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) => {
|
||||
const fileName = failure.getFileName();
|
||||
const failureString = failure.getFailure();
|
||||
const ruleName = failure.getRuleName();
|
||||
const lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
|
||||
const positionTuple = `:${lineAndCharacter.line + 1}:${lineAndCharacter.character + 1}`;
|
||||
if (this.lastSeverity == failure.getRuleSeverity() && this.lastFailure == failureString) {
|
||||
return " in " + fileName + positionTuple;
|
||||
} else {
|
||||
var 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
55
lib/tslint/asTypesRule.js
Normal file
55
lib/tslint/asTypesRule.js
Normal file
@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var Rule = /** @class */ (function (_super) {
|
||||
__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions()));
|
||||
};
|
||||
Rule.MISSING_TYPE_OR_INITIALIZER = "Missing type or initializer.";
|
||||
Rule.MISSING_RETURN_TYPE = "Missing return type.";
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var DiagnosticsWalker = /** @class */ (function (_super) {
|
||||
__extends(DiagnosticsWalker, _super);
|
||||
function DiagnosticsWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
DiagnosticsWalker.prototype.visitVariableDeclaration = function (node) {
|
||||
if (!node.type && !node.initializer &&
|
||||
node.parent.parent.kind != ts.SyntaxKind.ForOfStatement) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER);
|
||||
}
|
||||
};
|
||||
DiagnosticsWalker.prototype.visitPropertyDeclaration = function (node) {
|
||||
if (!node.type && !node.initializer) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER);
|
||||
}
|
||||
};
|
||||
DiagnosticsWalker.prototype.visitParameterDeclaration = function (node) {
|
||||
if (!node.type && !node.initializer) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER);
|
||||
}
|
||||
};
|
||||
DiagnosticsWalker.prototype.visitFunctionDeclaration = function (node) {
|
||||
if (!node.type) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_RETURN_TYPE);
|
||||
}
|
||||
};
|
||||
return DiagnosticsWalker;
|
||||
}(Lint.RuleWalker));
|
38
lib/tslint/asTypesRule.ts
Normal file
38
lib/tslint/asTypesRule.ts
Normal file
@ -0,0 +1,38 @@
|
||||
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.";
|
||||
|
||||
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
class DiagnosticsWalker extends Lint.RuleWalker {
|
||||
visitVariableDeclaration(node: ts.VariableDeclaration) {
|
||||
if (
|
||||
!node.type && !node.initializer &&
|
||||
node.parent.parent.kind != ts.SyntaxKind.ForOfStatement
|
||||
) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER);
|
||||
}
|
||||
}
|
||||
visitPropertyDeclaration(node: ts.PropertyDeclaration) {
|
||||
if (!node.type && !node.initializer) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER);
|
||||
}
|
||||
}
|
||||
visitParameterDeclaration(node: ts.ParameterDeclaration) {
|
||||
if (!node.type && !node.initializer) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_TYPE_OR_INITIALIZER);
|
||||
}
|
||||
}
|
||||
visitFunctionDeclaration(node: ts.FunctionDeclaration) {
|
||||
if (!node.type) {
|
||||
this.addFailureAtNode(node, Rule.MISSING_RETURN_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
43
lib/tslint/internal/asDiagnosticsRule.js
Normal file
43
lib/tslint/internal/asDiagnosticsRule.js
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var ts = require("typescript");
|
||||
var Lint = require("tslint");
|
||||
var tsutils_1 = require("tsutils");
|
||||
var Rule = /** @class */ (function (_super) {
|
||||
__extends(Rule, _super);
|
||||
function Rule() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Rule.prototype.apply = function (sourceFile) {
|
||||
return this.applyWithWalker(new DiagnosticsWalker(sourceFile, this.getOptions()));
|
||||
};
|
||||
Rule.NOT_ON_SEPARATE_LINE = "Diagnostic message not on a separate line.";
|
||||
return Rule;
|
||||
}(Lint.Rules.AbstractRule));
|
||||
exports.Rule = Rule;
|
||||
var DiagnosticsWalker = /** @class */ (function (_super) {
|
||||
__extends(DiagnosticsWalker, _super);
|
||||
function DiagnosticsWalker() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
DiagnosticsWalker.prototype.visitPropertyAccessExpression = function (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.prototype.visitPropertyAccessExpression.call(this, node);
|
||||
};
|
||||
return DiagnosticsWalker;
|
||||
}(Lint.RuleWalker));
|
26
lib/tslint/internal/asDiagnosticsRule.ts
Normal file
26
lib/tslint/internal/asDiagnosticsRule.ts
Normal file
@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
}
|
10
lib/tslint/tsconfig.json
Normal file
10
lib/tslint/tsconfig.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "es2015.collection"]
|
||||
},
|
||||
"include": [
|
||||
"./**/**.ts"
|
||||
]
|
||||
}
|
77
package-lock.json
generated
77
package-lock.json
generated
@ -4,15 +4,11 @@
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/strip-bom": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz",
|
||||
"integrity": "sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I="
|
||||
},
|
||||
"@types/strip-json-comments": {
|
||||
"version": "0.0.30",
|
||||
"resolved": "https://registry.npmjs.org/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz",
|
||||
"integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ=="
|
||||
"@types/node": {
|
||||
"version": "9.4.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-9.4.6.tgz",
|
||||
"integrity": "sha512-CTUtLb6WqCCgp6P59QintjHWqzf4VL1uPA27bipLAPxFqrtK1gEYllePzTICGqQ8rYsCbpnsNypXjjDzGAAjEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn": {
|
||||
"version": "5.4.1",
|
||||
@ -659,9 +655,10 @@
|
||||
"dev": true
|
||||
},
|
||||
"binaryen": {
|
||||
"version": "44.0.0",
|
||||
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-44.0.0.tgz",
|
||||
"integrity": "sha512-8teFxH0adnhbNv7aBS35scBzu9VIdIksxUPHN0p2ez+bg8VNQgAuizWZJohkejjuwiaC/ESP8Tfb0vD0BRJiqw=="
|
||||
"version": "44.0.0-nightly.20180224",
|
||||
"resolved": "https://registry.npmjs.org/binaryen/-/binaryen-44.0.0-nightly.20180224.tgz",
|
||||
"integrity": "sha512-6jkOphlItuzKBRafvIJLjFqfYphDHAFVglX7dQ2vbh4eVKoFGqgN6qCz2A3j45y0p/LhdkvQTpJnBLnCNU3n1g==",
|
||||
"dev": true
|
||||
},
|
||||
"bn.js": {
|
||||
"version": "4.11.8",
|
||||
@ -1715,14 +1712,6 @@
|
||||
"os-tmpdir": "1.0.2"
|
||||
}
|
||||
},
|
||||
"homedir-polyfill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz",
|
||||
"integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=",
|
||||
"requires": {
|
||||
"parse-passwd": "1.0.0"
|
||||
}
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz",
|
||||
@ -2156,9 +2145,9 @@
|
||||
}
|
||||
},
|
||||
"make-error": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.2.tgz",
|
||||
"integrity": "sha512-l9ra35l5VWLF24y75Tg8XgfGLX0ueRhph118WKM6H5denx4bB5QF59+4UAm9oJ2qsPQZas/CQUDdtDdfvYHBdQ=="
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",
|
||||
"integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g=="
|
||||
},
|
||||
"map-cache": {
|
||||
"version": "0.2.2",
|
||||
@ -2642,11 +2631,6 @@
|
||||
"error-ex": "1.3.1"
|
||||
}
|
||||
},
|
||||
"parse-passwd": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
|
||||
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY="
|
||||
},
|
||||
"pascalcase": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
|
||||
@ -3446,7 +3430,8 @@
|
||||
"strip-bom": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
||||
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
|
||||
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
|
||||
"dev": true
|
||||
},
|
||||
"strip-eof": {
|
||||
"version": "1.0.0",
|
||||
@ -3454,11 +3439,6 @@
|
||||
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
|
||||
"dev": true
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
|
||||
@ -3823,33 +3803,20 @@
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-4.1.0.tgz",
|
||||
"integrity": "sha512-xcZH12oVg9PShKhy3UHyDmuDLV3y7iKwX25aMVPt1SIXSuAfWkFiGPEkg+th8R4YKW/QCxDoW7lJdb15lx6QWg==",
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-5.0.0.tgz",
|
||||
"integrity": "sha512-mlSim/sQS1s5iT3KZEKXRaqsGC7xM2QoxkrhfznZJyou18dl47PTnY7/KMmbGqiVoQrO9Hk53CYpcychF5TNrQ==",
|
||||
"requires": {
|
||||
"arrify": "1.0.1",
|
||||
"chalk": "2.3.1",
|
||||
"diff": "3.4.0",
|
||||
"make-error": "1.3.2",
|
||||
"make-error": "1.3.4",
|
||||
"minimist": "1.2.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"source-map-support": "0.5.3",
|
||||
"tsconfig": "7.0.0",
|
||||
"v8flags": "3.0.1",
|
||||
"yn": "2.0.0"
|
||||
}
|
||||
},
|
||||
"tsconfig": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz",
|
||||
"integrity": "sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==",
|
||||
"requires": {
|
||||
"@types/strip-bom": "3.0.0",
|
||||
"@types/strip-json-comments": "0.0.30",
|
||||
"strip-bom": "3.0.0",
|
||||
"strip-json-comments": "2.0.1"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz",
|
||||
@ -4153,14 +4120,6 @@
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
},
|
||||
"v8flags": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.1.tgz",
|
||||
"integrity": "sha1-3Oj8N5wX2fLJ6e142JzgAFKxt2s=",
|
||||
"requires": {
|
||||
"homedir-polyfill": "1.0.1"
|
||||
}
|
||||
},
|
||||
"validate-npm-package-license": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
|
||||
|
@ -11,14 +11,15 @@
|
||||
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"binaryen": "44.0.0",
|
||||
"glob": "^7.1.2",
|
||||
"long": "^4.0.0",
|
||||
"minimist": "^1.2.0",
|
||||
"ts-node": "^4.1.0"
|
||||
"ts-node": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^9.4.6",
|
||||
"babel-minify-webpack-plugin": "^0.3.0",
|
||||
"binaryen": "44.0.0-nightly.20180224",
|
||||
"browser-process-hrtime": "^0.1.2",
|
||||
"chalk": "^2.3.1",
|
||||
"diff": "^3.4.0",
|
||||
@ -39,7 +40,7 @@
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"clean": "node scripts/clean",
|
||||
"lint": "tslint --project src",
|
||||
"lint": "tslint -c tslint.json --project src --formatters-dir lib/tslint --format as",
|
||||
"test:config": "npm run test:config:portable --scripts-prepend-node-path && npm run test:config:src --scripts-prepend-node-path",
|
||||
"test:config:portable": "tsc --noEmit -p std/portable --diagnostics --listFiles",
|
||||
"test:config:src": "tsc --noEmit -p src --diagnostics --listFiles",
|
||||
|
@ -2,7 +2,10 @@ var fs = require("fs");
|
||||
|
||||
var messages = require(__dirname + "/../src/diagnosticMessages.json");
|
||||
|
||||
var sb = [ "// code below is generated from diagnosticsMessages.json by scripts/build-diagnostics\n\n" ];
|
||||
var sb = [
|
||||
"// code below is generated from diagnosticsMessages.json by scripts/build-diagnostics\n",
|
||||
"/* tslint:disable:max-line-length */\n\n"
|
||||
];
|
||||
|
||||
function makeKey(text) {
|
||||
return text.replace(/[^\w]+/g, "_").replace(/_+$/, "");
|
||||
|
176
src/ast.ts
176
src/ast.ts
@ -434,8 +434,9 @@ export abstract class Node {
|
||||
case "offset": stmt.decoratorKind = DecoratorKind.OFFSET; break;
|
||||
default: stmt.decoratorKind = DecoratorKind.CUSTOM; break;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
stmt.decoratorKind = DecoratorKind.CUSTOM;
|
||||
}
|
||||
return stmt;
|
||||
}
|
||||
|
||||
@ -499,13 +500,14 @@ export abstract class Node {
|
||||
stmt.path = path;
|
||||
if (path) {
|
||||
var normalizedPath = normalizePath(path.value);
|
||||
if (path.value.startsWith(".")) // relative
|
||||
if (path.value.startsWith(".")) { // relative
|
||||
stmt.normalizedPath = resolvePath(
|
||||
normalizedPath,
|
||||
range.source.normalizedPath
|
||||
);
|
||||
else // absolute
|
||||
} else { // absolute
|
||||
stmt.normalizedPath = normalizedPath;
|
||||
}
|
||||
stmt.internalPath = mangleInternalPath(stmt.normalizedPath);
|
||||
} else {
|
||||
stmt.normalizedPath = null;
|
||||
@ -535,10 +537,11 @@ export abstract class Node {
|
||||
var elem = new ExportMember();
|
||||
elem.range = range;
|
||||
elem.name = name; name.parent = elem;
|
||||
if (!externalName)
|
||||
if (!externalName) {
|
||||
externalName = name;
|
||||
else
|
||||
} else {
|
||||
externalName.parent = elem;
|
||||
}
|
||||
elem.externalName = externalName;
|
||||
return elem;
|
||||
}
|
||||
@ -577,13 +580,14 @@ export abstract class Node {
|
||||
stmt.namespaceName = null;
|
||||
stmt.path = path;
|
||||
var normalizedPath = normalizePath(path.value);
|
||||
if (path.value.startsWith(".")) // relative
|
||||
if (path.value.startsWith(".")) { // relative
|
||||
stmt.normalizedPath = resolvePath(
|
||||
normalizedPath,
|
||||
range.source.normalizedPath
|
||||
);
|
||||
else // absolute
|
||||
} else { // absolute
|
||||
stmt.normalizedPath = normalizedPath;
|
||||
}
|
||||
stmt.internalPath = mangleInternalPath(stmt.normalizedPath);
|
||||
return stmt;
|
||||
}
|
||||
@ -614,10 +618,11 @@ export abstract class Node {
|
||||
var elem = new ImportDeclaration();
|
||||
elem.range = range;
|
||||
elem.externalName = externalName; externalName.parent = elem;
|
||||
if (!name)
|
||||
if (!name) {
|
||||
name = externalName;
|
||||
else
|
||||
} else {
|
||||
name.parent = elem;
|
||||
}
|
||||
elem.name = name;
|
||||
return elem;
|
||||
}
|
||||
@ -996,7 +1001,7 @@ export class CallExpression extends Expression {
|
||||
arguments: Expression[];
|
||||
}
|
||||
|
||||
/** Represents a comma expression composed of multiple sequential expressions. */
|
||||
/** Represents a comma expression composed of multiple expressions. */
|
||||
export class CommaExpression extends Expression {
|
||||
kind = NodeKind.COMMA;
|
||||
|
||||
@ -1223,47 +1228,50 @@ export abstract class DeclarationStatement extends Statement {
|
||||
|
||||
/** Gets the mangled program-level internal name of this declaration. */
|
||||
get programLevelInternalName(): string {
|
||||
if (!this.cachedProgramLevelInternalName)
|
||||
if (!this.cachedProgramLevelInternalName) {
|
||||
this.cachedProgramLevelInternalName = mangleInternalName(this, true);
|
||||
}
|
||||
return this.cachedProgramLevelInternalName;
|
||||
}
|
||||
|
||||
/** Gets the mangled file-level internal name of this declaration. */
|
||||
get fileLevelInternalName(): string {
|
||||
if (!this.cachedFileLevelInternalName)
|
||||
if (!this.cachedFileLevelInternalName) {
|
||||
this.cachedFileLevelInternalName = mangleInternalName(this, false);
|
||||
}
|
||||
return this.cachedFileLevelInternalName;
|
||||
}
|
||||
|
||||
/** Tests if this is a top-level declaration within its source file. */
|
||||
get isTopLevel(): bool {
|
||||
var parent = this.parent;
|
||||
if (!parent)
|
||||
if (!parent) {
|
||||
return false;
|
||||
if (parent.kind == NodeKind.VARIABLE)
|
||||
if (!(parent = parent.parent))
|
||||
return false;
|
||||
}
|
||||
if (parent.kind == NodeKind.VARIABLE && !(parent = parent.parent)) {
|
||||
return false;
|
||||
}
|
||||
return parent.kind == NodeKind.SOURCE;
|
||||
}
|
||||
|
||||
/** Tests if this declaration is a top-level export within its source file. */
|
||||
get isTopLevelExport(): bool {
|
||||
var parent = this.parent;
|
||||
if (!parent)
|
||||
if (!parent || (parent.kind == NodeKind.VARIABLE && !(parent = parent.parent))) {
|
||||
return false;
|
||||
if (parent.kind == NodeKind.VARIABLE)
|
||||
if (!(parent = parent.parent))
|
||||
return false;
|
||||
if (parent.kind == NodeKind.NAMESPACEDECLARATION)
|
||||
}
|
||||
if (parent.kind == NodeKind.NAMESPACEDECLARATION) {
|
||||
return (
|
||||
hasModifier(ModifierKind.EXPORT, this.modifiers) &&
|
||||
(<NamespaceDeclaration>parent).isTopLevelExport
|
||||
);
|
||||
if (parent.kind == NodeKind.CLASSDECLARATION)
|
||||
}
|
||||
if (parent.kind == NodeKind.CLASSDECLARATION) {
|
||||
return (
|
||||
hasModifier(ModifierKind.STATIC, this.modifiers) &&
|
||||
(<ClassDeclaration>parent).isTopLevelExport
|
||||
);
|
||||
}
|
||||
return (
|
||||
parent.kind == NodeKind.SOURCE &&
|
||||
hasModifier(ModifierKind.EXPORT, this.modifiers)
|
||||
@ -1642,9 +1650,7 @@ export class WhileStatement extends Statement {
|
||||
/** Cached unused modifiers for reuse. */
|
||||
var reusableModifiers: Modifier[] | null = null;
|
||||
|
||||
export function setReusableModifiers(
|
||||
modifiers: Modifier[]
|
||||
): void {
|
||||
export function setReusableModifiers(modifiers: Modifier[]): void {
|
||||
reusableModifiers = modifiers;
|
||||
}
|
||||
|
||||
@ -1654,113 +1660,105 @@ export function createModifiers(): Modifier[] {
|
||||
if (reusableModifiers != null) {
|
||||
ret = reusableModifiers;
|
||||
reusableModifiers = null;
|
||||
} else
|
||||
ret = new Array(1);
|
||||
} else {
|
||||
ret = [];
|
||||
}
|
||||
ret.length = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Utility
|
||||
|
||||
/** Adds a modifier to a set of modifiers. Creates a new set if `null`. */
|
||||
export function addModifier(
|
||||
modifier: Modifier,
|
||||
modifiers: Modifier[] | null
|
||||
): Modifier[] {
|
||||
if (modifiers == null)
|
||||
modifiers = createModifiers();
|
||||
export function addModifier(modifier: Modifier, modifiers: Modifier[] | null): Modifier[] {
|
||||
if (modifiers == null) modifiers = createModifiers();
|
||||
modifiers.push(modifier);
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
/** Gets a specific modifier from the specified set of modifiers. */
|
||||
export function getModifier(
|
||||
kind: ModifierKind,
|
||||
modifiers: Modifier[] | null
|
||||
): Modifier | null {
|
||||
if (modifiers)
|
||||
for (var i = 0, k = modifiers.length; i < k; ++i)
|
||||
if (modifiers[i].modifierKind == kind)
|
||||
export function getModifier(kind: ModifierKind, modifiers: Modifier[] | null): Modifier | null {
|
||||
if (modifiers) {
|
||||
for (var i = 0, k = modifiers.length; i < k; ++i) {
|
||||
if (modifiers[i].modifierKind == kind) {
|
||||
return modifiers[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Tests whether a modifier exists in the specified set of modifiers. */
|
||||
export function hasModifier(
|
||||
kind: ModifierKind,
|
||||
modifiers: Modifier[] | null
|
||||
): bool {
|
||||
export function hasModifier(kind: ModifierKind, modifiers: Modifier[] | null): bool {
|
||||
return getModifier(kind, modifiers) != null;
|
||||
}
|
||||
|
||||
/** Gets the first decorator by name within at set of decorators, if present. */
|
||||
export function getFirstDecorator(
|
||||
name: string,
|
||||
decorators: Decorator[] | null
|
||||
): Decorator | null {
|
||||
if (decorators)
|
||||
export function getFirstDecorator(name: string, decorators: Decorator[] | null): Decorator | null {
|
||||
if (decorators) {
|
||||
for (var i = 0, k = decorators.length; i < k; ++i) {
|
||||
var decorator = decorators[i];
|
||||
var expression = decorator.name;
|
||||
if (expression.kind == NodeKind.IDENTIFIER && (<IdentifierExpression>expression).text == name)
|
||||
if (expression.kind == NodeKind.IDENTIFIER && (<IdentifierExpression>expression).text == name) {
|
||||
return decorator;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Tests if a specific decorator is present within the specified decorators. */
|
||||
export function hasDecorator(
|
||||
name: string,
|
||||
decorators: Decorator[] | null
|
||||
): bool {
|
||||
export function hasDecorator(name: string, decorators: Decorator[] | null): bool {
|
||||
return getFirstDecorator(name, decorators) != null;
|
||||
}
|
||||
|
||||
/** Mangles a declaration's name to an internal name. */
|
||||
export function mangleInternalName(
|
||||
declaration: DeclarationStatement,
|
||||
asGlobal: bool = false
|
||||
): string {
|
||||
export function mangleInternalName(declaration: DeclarationStatement, asGlobal: bool = false): string {
|
||||
var name = declaration.name.text;
|
||||
var parent = declaration.parent;
|
||||
if (!parent)
|
||||
return name;
|
||||
if (declaration.kind == NodeKind.VARIABLEDECLARATION && parent.kind == NodeKind.VARIABLE) // skip over
|
||||
if (!(parent = parent.parent))
|
||||
return name;
|
||||
if (parent.kind == NodeKind.CLASSDECLARATION)
|
||||
if (!parent) return name;
|
||||
if (
|
||||
declaration.kind == NodeKind.VARIABLEDECLARATION &&
|
||||
parent.kind == NodeKind.VARIABLE
|
||||
) { // skip over
|
||||
if (!(parent = parent.parent)) return name;
|
||||
}
|
||||
if (parent.kind == NodeKind.CLASSDECLARATION) {
|
||||
return mangleInternalName(<ClassDeclaration>parent, asGlobal) + (
|
||||
hasModifier(ModifierKind.STATIC, declaration.modifiers) ? STATIC_DELIMITER : INSTANCE_DELIMITER
|
||||
hasModifier(ModifierKind.STATIC, declaration.modifiers)
|
||||
? STATIC_DELIMITER
|
||||
: INSTANCE_DELIMITER
|
||||
) + name;
|
||||
if (parent.kind == NodeKind.NAMESPACEDECLARATION || parent.kind == NodeKind.ENUMDECLARATION)
|
||||
return mangleInternalName(<DeclarationStatement>parent, asGlobal) + STATIC_DELIMITER + name;
|
||||
if (asGlobal)
|
||||
return name;
|
||||
return declaration.range.source.internalPath + PATH_DELIMITER + name;
|
||||
}
|
||||
if (
|
||||
parent.kind == NodeKind.NAMESPACEDECLARATION ||
|
||||
parent.kind == NodeKind.ENUMDECLARATION
|
||||
) {
|
||||
return mangleInternalName(<DeclarationStatement>parent, asGlobal) +
|
||||
STATIC_DELIMITER + name;
|
||||
}
|
||||
return asGlobal
|
||||
? name
|
||||
: declaration.range.source.internalPath + PATH_DELIMITER + name;
|
||||
}
|
||||
|
||||
/** Mangles an external to an internal path. */
|
||||
export function mangleInternalPath(
|
||||
path: string
|
||||
): string {
|
||||
if (path.endsWith(".ts"))
|
||||
path = path.substring(0, path.length - 3);
|
||||
export function mangleInternalPath(path: string): string {
|
||||
if (path.endsWith(".ts")) path = path.substring(0, path.length - 3);
|
||||
return path;
|
||||
}
|
||||
|
||||
function setParent(
|
||||
nodes: Node[],
|
||||
parent: Node
|
||||
): void {
|
||||
for (var i = 0, k = nodes.length; i < k; ++i)
|
||||
nodes[i].parent = parent;
|
||||
}
|
||||
// Helpers
|
||||
|
||||
function setParentOpt(
|
||||
nodes: (Node | null)[],
|
||||
parent: Node
|
||||
): void {
|
||||
function setParent(nodes: Node[], parent: Node): void {
|
||||
for (var i = 0, k = nodes.length; i < k; ++i) {
|
||||
var node = nodes[i];
|
||||
if (node)
|
||||
node.parent = parent;
|
||||
nodes[i].parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
function setParentOpt(nodes: (Node | null)[], parent: Node): void {
|
||||
for (var i = 0, k = nodes.length; i < k; ++i) {
|
||||
var node = nodes[i];
|
||||
if (node) node.parent = parent;
|
||||
}
|
||||
}
|
||||
|
1304
src/builtins.ts
1304
src/builtins.ts
File diff suppressed because it is too large
Load Diff
2226
src/compiler.ts
2226
src/compiler.ts
File diff suppressed because it is too large
Load Diff
@ -38,8 +38,7 @@ export class Decompiler {
|
||||
this.push(name);
|
||||
this.push("(");
|
||||
for (var i: Index = 0, k: Index = _BinaryenFunctionGetNumParams(func); i < k; ++i) {
|
||||
if (i > 0)
|
||||
this.push(", ");
|
||||
if (i > 0) this.push(", ");
|
||||
this.push("$");
|
||||
this.push(i.toString(10));
|
||||
this.push(": ");
|
||||
@ -119,8 +118,9 @@ export class Decompiler {
|
||||
this.push("break ");
|
||||
this.push(string);
|
||||
this.push(";\n");
|
||||
} else
|
||||
} else {
|
||||
this.push("break;\n");
|
||||
}
|
||||
return;
|
||||
|
||||
case ExpressionId.Switch:
|
||||
|
@ -1,4 +1,5 @@
|
||||
// code below is generated from diagnosticsMessages.json by scripts/build-diagnostics
|
||||
/* tslint:disable:max-line-length */
|
||||
|
||||
export enum DiagnosticCode {
|
||||
Operation_not_supported = 100,
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
} from "./diagnosticMessages.generated";
|
||||
|
||||
import {
|
||||
CharCode,
|
||||
isLineBreak
|
||||
} from "./util/charcode";
|
||||
|
||||
@ -59,24 +58,39 @@ export class DiagnosticMessage {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
static create(code: DiagnosticCode, category: DiagnosticCategory, arg0: string | null = null, arg1: string | null = null): DiagnosticMessage {
|
||||
static create(
|
||||
code: DiagnosticCode,
|
||||
category: DiagnosticCategory,
|
||||
arg0: string | null = null,
|
||||
arg1: string | null = null
|
||||
): DiagnosticMessage {
|
||||
var message = diagnosticCodeToString(code);
|
||||
if (arg0 != null)
|
||||
message = message.replace("{0}", arg0);
|
||||
if (arg1 != null)
|
||||
message = message.replace("{1}", arg1);
|
||||
if (arg0 != null) message = message.replace("{0}", arg0);
|
||||
if (arg1 != null) message = message.replace("{1}", arg1);
|
||||
return new DiagnosticMessage(code, category, message);
|
||||
}
|
||||
|
||||
static createInfo(code: DiagnosticCode, arg0: string | null = null, arg1: string | null = null): DiagnosticMessage {
|
||||
static createInfo(
|
||||
code: DiagnosticCode,
|
||||
arg0: string | null = null,
|
||||
arg1: string | null = null
|
||||
): DiagnosticMessage {
|
||||
return DiagnosticMessage.create(code, DiagnosticCategory.INFO, arg0, arg1);
|
||||
}
|
||||
|
||||
static createWarning(code: DiagnosticCode, arg0: string | null = null, arg1: string | null = null): DiagnosticMessage {
|
||||
static createWarning(
|
||||
code: DiagnosticCode,
|
||||
arg0: string | null = null,
|
||||
arg1: string | null = null
|
||||
): DiagnosticMessage {
|
||||
return DiagnosticMessage.create(code, DiagnosticCategory.WARNING, arg0, arg1);
|
||||
}
|
||||
|
||||
static createError(code: DiagnosticCode, arg0: string | null = null, arg1: string | null = null): DiagnosticMessage {
|
||||
static createError(
|
||||
code: DiagnosticCode,
|
||||
arg0: string | null = null,
|
||||
arg1: string | null = null
|
||||
): DiagnosticMessage {
|
||||
return DiagnosticMessage.create(code, DiagnosticCategory.ERROR, arg0, arg1);
|
||||
}
|
||||
|
||||
@ -86,17 +100,41 @@ export class DiagnosticMessage {
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
if (this.range)
|
||||
return diagnosticCategoryToString(this.category) + " " + this.code.toString(10) + ": \"" + this.message + "\" in " + this.range.source.normalizedPath + " @ " + this.range.start.toString(10) + "," + this.range.end.toString(10);
|
||||
return diagnosticCategoryToString(this.category) + " " + this.code.toString(10) + ": " + this.message;
|
||||
if (this.range) {
|
||||
return (
|
||||
diagnosticCategoryToString(this.category) +
|
||||
" " +
|
||||
this.code.toString(10) +
|
||||
": \"" +
|
||||
this.message +
|
||||
"\" in " +
|
||||
this.range.source.normalizedPath +
|
||||
" @ " +
|
||||
this.range.start.toString(10) +
|
||||
"," +
|
||||
this.range.end.toString(10)
|
||||
);
|
||||
}
|
||||
return (
|
||||
diagnosticCategoryToString(this.category) +
|
||||
" " +
|
||||
this.code.toString(10) +
|
||||
": " +
|
||||
this.message
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function formatDiagnosticMessage(message: DiagnosticMessage, useColors: bool = false, showContext: bool = false): string {
|
||||
export function formatDiagnosticMessage(
|
||||
message: DiagnosticMessage,
|
||||
useColors: bool = false,
|
||||
showContext: bool = false
|
||||
): string {
|
||||
// format context first (uses same string builder)
|
||||
var context = "";
|
||||
if (message.range && showContext)
|
||||
if (message.range && showContext) {
|
||||
context = formatDiagnosticContext(message.range, useColors);
|
||||
}
|
||||
|
||||
// general information
|
||||
var sb: string[] = [];
|
||||
@ -111,7 +149,6 @@ export function formatDiagnosticMessage(message: DiagnosticMessage, useColors: b
|
||||
// range information if available
|
||||
if (message.range) {
|
||||
var range = message.range;
|
||||
var text = range.source.text;
|
||||
if (showContext) {
|
||||
sb.push("\n");
|
||||
sb.push(context);
|
||||
@ -133,10 +170,12 @@ export function formatDiagnosticContext(range: Range, useColors: bool = false):
|
||||
var len = text.length;
|
||||
var start = range.start;
|
||||
var end = range.end;
|
||||
while (start > 0 && !isLineBreak(text.charCodeAt(start - 1)))
|
||||
while (start > 0 && !isLineBreak(text.charCodeAt(start - 1))) {
|
||||
start--;
|
||||
while (end < len && !isLineBreak(text.charCodeAt(end)))
|
||||
}
|
||||
while (end < len && !isLineBreak(text.charCodeAt(end))) {
|
||||
end++;
|
||||
}
|
||||
var sb: string[] = [
|
||||
"\n ",
|
||||
text.substring(start, end),
|
||||
@ -149,8 +188,11 @@ export function formatDiagnosticContext(range: Range, useColors: bool = false):
|
||||
if (useColors) sb.push(colorRed);
|
||||
if (range.start == range.end) {
|
||||
sb.push("^");
|
||||
} else while (start++ < range.end)
|
||||
sb.push("~");
|
||||
} else {
|
||||
while (start++ < range.end) {
|
||||
sb.push("~");
|
||||
}
|
||||
}
|
||||
if (useColors) sb.push(colorReset);
|
||||
return sb.join("");
|
||||
}
|
||||
@ -164,7 +206,13 @@ export abstract class DiagnosticEmitter {
|
||||
this.diagnostics = diagnostics ? <DiagnosticMessage[]>diagnostics : new Array();
|
||||
}
|
||||
|
||||
emitDiagnostic(code: DiagnosticCode, category: DiagnosticCategory, range: Range, arg0: string | null = null, arg1: string | null = null) {
|
||||
emitDiagnostic(
|
||||
code: DiagnosticCode,
|
||||
category: DiagnosticCategory,
|
||||
range: Range,
|
||||
arg0: string | null = null,
|
||||
arg1: string | null = null
|
||||
) {
|
||||
var message = DiagnosticMessage.create(code, category, arg0, arg1).withRange(range);
|
||||
this.diagnostics.push(message);
|
||||
// console.log(formatDiagnosticMessage(message, true, true) + "\n"); // temporary
|
||||
|
750
src/extra/ast.ts
750
src/extra/ast.ts
File diff suppressed because it is too large
Load Diff
362
src/module.ts
362
src/module.ts
@ -108,7 +108,7 @@ export enum UnaryOp {
|
||||
// ExtendI16ToI64 = _BinaryenExtendS16Int64()
|
||||
// ExtendI32ToI64 = _BinaryenExtendS32Int64()
|
||||
|
||||
// see: https://github.com/WebAssembly/nontrapping-float-to-int-conversions/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md#design
|
||||
// see: https://github.com/WebAssembly/nontrapping-float-to-int-conversions
|
||||
// TruncF32ToI32Sat
|
||||
// TruncF32ToU32Sat
|
||||
// TruncF64ToI32Sat
|
||||
@ -204,7 +204,7 @@ export enum HostOp {
|
||||
GrowMemory = _BinaryenGrowMemory(),
|
||||
HasFeature = _BinaryenHasFeature(),
|
||||
|
||||
// see: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md#design
|
||||
// see: https://github.com/WebAssembly/bulk-memory-operations
|
||||
// MoveMemory
|
||||
// SetMemory
|
||||
}
|
||||
@ -262,7 +262,11 @@ export class Module {
|
||||
|
||||
// types
|
||||
|
||||
addFunctionType(name: string, result: NativeType, paramTypes: NativeType[]): FunctionRef {
|
||||
addFunctionType(
|
||||
name: string,
|
||||
result: NativeType,
|
||||
paramTypes: NativeType[]
|
||||
): FunctionRef {
|
||||
var cStr = allocString(name);
|
||||
var cArr = allocI32Array(paramTypes);
|
||||
try {
|
||||
@ -273,7 +277,10 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
getFunctionTypeBySignature(result: NativeType, paramTypes: NativeType[]): FunctionTypeRef {
|
||||
getFunctionTypeBySignature(
|
||||
result: NativeType,
|
||||
paramTypes: NativeType[]
|
||||
): FunctionTypeRef {
|
||||
var cArr = allocI32Array(paramTypes);
|
||||
try {
|
||||
return _BinaryenGetFunctionTypeBySignature(this.ref, result, cArr, paramTypes.length);
|
||||
@ -282,7 +289,7 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
// expressions
|
||||
// constants
|
||||
|
||||
createI32(value: i32): ExpressionRef {
|
||||
var out = this.out;
|
||||
@ -290,9 +297,9 @@ export class Module {
|
||||
return _BinaryenConst(this.ref, out);
|
||||
}
|
||||
|
||||
createI64(lo: i32, hi: i32 = 0): ExpressionRef {
|
||||
createI64(valueLow: i32, valueHigh: i32 = 0): ExpressionRef {
|
||||
var out = this.out;
|
||||
_BinaryenLiteralInt64(out, lo, hi);
|
||||
_BinaryenLiteralInt64(out, valueLow, valueHigh);
|
||||
return _BinaryenConst(this.ref, out);
|
||||
}
|
||||
|
||||
@ -308,15 +315,28 @@ export class Module {
|
||||
return _BinaryenConst(this.ref, out);
|
||||
}
|
||||
|
||||
createUnary(op: UnaryOp, expr: ExpressionRef): ExpressionRef {
|
||||
// expressions
|
||||
|
||||
createUnary(
|
||||
op: UnaryOp,
|
||||
expr: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenUnary(this.ref, op, expr);
|
||||
}
|
||||
|
||||
createBinary(op: BinaryOp, left: ExpressionRef, right: ExpressionRef): ExpressionRef {
|
||||
createBinary(
|
||||
op: BinaryOp,
|
||||
left: ExpressionRef,
|
||||
right: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenBinary(this.ref, op, left, right);
|
||||
}
|
||||
|
||||
createHost(op: HostOp, name: string | null = null, operands: ExpressionRef[] | null = null): ExpressionRef {
|
||||
createHost(
|
||||
op: HostOp,
|
||||
name: string | null = null,
|
||||
operands: ExpressionRef[] | null = null
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(name);
|
||||
var cArr = allocI32Array(operands);
|
||||
try {
|
||||
@ -327,15 +347,24 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createGetLocal(index: i32, type: NativeType): ExpressionRef {
|
||||
createGetLocal(
|
||||
index: i32,
|
||||
type: NativeType
|
||||
): ExpressionRef {
|
||||
return _BinaryenGetLocal(this.ref, index, type);
|
||||
}
|
||||
|
||||
createTeeLocal(index: i32, value: ExpressionRef): ExpressionRef {
|
||||
createTeeLocal(
|
||||
index: i32,
|
||||
value: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenTeeLocal(this.ref, index, value);
|
||||
}
|
||||
|
||||
createGetGlobal(name: string, type: NativeType): ExpressionRef {
|
||||
createGetGlobal(
|
||||
name: string,
|
||||
type: NativeType
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(name);
|
||||
try {
|
||||
return _BinaryenGetGlobal(this.ref, cStr, type);
|
||||
@ -344,45 +373,96 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createLoad(bytes: Index, signed: bool, ptr: ExpressionRef, type: NativeType, offset: Index = 0): ExpressionRef {
|
||||
createLoad(
|
||||
bytes: Index,
|
||||
signed: bool,
|
||||
ptr: ExpressionRef,
|
||||
type: NativeType,
|
||||
offset: Index = 0
|
||||
): ExpressionRef {
|
||||
return _BinaryenLoad(this.ref, bytes, signed ? 1 : 0, offset, /* always aligned */ bytes, type, ptr);
|
||||
}
|
||||
|
||||
createStore(bytes: Index, ptr: ExpressionRef, value: ExpressionRef, type: NativeType, offset: Index = 0): ExpressionRef {
|
||||
createStore(
|
||||
bytes: Index,
|
||||
ptr: ExpressionRef,
|
||||
value: ExpressionRef,
|
||||
type: NativeType,
|
||||
offset: Index = 0
|
||||
): ExpressionRef {
|
||||
return _BinaryenStore(this.ref, bytes, offset, /* always aligned */ bytes, ptr, value, type);
|
||||
}
|
||||
|
||||
createAtomicLoad(bytes: Index, ptr: ExpressionRef, type: NativeType, offset: Index = 0): ExpressionRef {
|
||||
createAtomicLoad(
|
||||
bytes: Index,
|
||||
ptr: ExpressionRef,
|
||||
type: NativeType,
|
||||
offset: Index = 0
|
||||
): ExpressionRef {
|
||||
return _BinaryenAtomicLoad(this.ref, bytes, offset, type, ptr);
|
||||
}
|
||||
|
||||
createAtomicStore(bytes: Index, ptr: ExpressionRef, value: ExpressionRef, type: NativeType, offset: Index = 0): ExpressionRef {
|
||||
createAtomicStore(
|
||||
bytes: Index,
|
||||
ptr: ExpressionRef,
|
||||
value: ExpressionRef,
|
||||
type: NativeType,
|
||||
offset: Index = 0
|
||||
): ExpressionRef {
|
||||
return _BinaryenAtomicStore(this.ref, bytes, offset, ptr, value, type);
|
||||
}
|
||||
|
||||
createAtomicRMW(op: AtomicRMWOp, bytes: Index, offset: Index, ptr: ExpressionRef, value: ExpressionRef, type: NativeType): ExpressionRef {
|
||||
createAtomicRMW(
|
||||
op: AtomicRMWOp,
|
||||
bytes: Index,
|
||||
offset: Index,
|
||||
ptr: ExpressionRef,
|
||||
value: ExpressionRef,
|
||||
type: NativeType
|
||||
): ExpressionRef {
|
||||
return _BinaryenAtomicRMW(this.ref, op, bytes, offset, ptr, value, type);
|
||||
}
|
||||
|
||||
createAtomicCmpxchg(bytes: Index, offset: Index, ptr: ExpressionRef, expected: ExpressionRef, replacement: ExpressionRef, type: NativeType): ExpressionRef {
|
||||
createAtomicCmpxchg(
|
||||
bytes: Index,
|
||||
offset: Index,
|
||||
ptr: ExpressionRef,
|
||||
expected: ExpressionRef,
|
||||
replacement: ExpressionRef,
|
||||
type: NativeType
|
||||
): ExpressionRef {
|
||||
return _BinaryenAtomicCmpxchg(this.ref, bytes, offset, ptr, expected, replacement, type);
|
||||
}
|
||||
|
||||
createAtomicWait(ptr: ExpressionRef, expected: ExpressionRef, timeout: ExpressionRef, expectedType: NativeType): ExpressionRef {
|
||||
createAtomicWait(
|
||||
ptr: ExpressionRef,
|
||||
expected: ExpressionRef,
|
||||
timeout: ExpressionRef,
|
||||
expectedType: NativeType
|
||||
): ExpressionRef {
|
||||
return _BinaryenAtomicWait(this.ref, ptr, expected, timeout, expectedType);
|
||||
}
|
||||
|
||||
createAtomicWake(ptr: ExpressionRef, wakeCount: ExpressionRef): ExpressionRef {
|
||||
createAtomicWake(
|
||||
ptr: ExpressionRef,
|
||||
wakeCount: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenAtomicWake(this.ref, ptr, wakeCount);
|
||||
}
|
||||
|
||||
// statements
|
||||
|
||||
createSetLocal(index: Index, value: ExpressionRef): ExpressionRef {
|
||||
createSetLocal(
|
||||
index: Index,
|
||||
value: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenSetLocal(this.ref, index, value);
|
||||
}
|
||||
|
||||
createSetGlobal(name: string, value: ExpressionRef): ExpressionRef {
|
||||
createSetGlobal(
|
||||
name: string,
|
||||
value: ExpressionRef
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(name);
|
||||
try {
|
||||
return _BinaryenSetGlobal(this.ref, cStr, value);
|
||||
@ -391,7 +471,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createBlock(label: string | null, children: ExpressionRef[], type: NativeType = NativeType.Auto): ExpressionRef {
|
||||
createBlock(
|
||||
label: string | null,
|
||||
children: ExpressionRef[],
|
||||
type: NativeType = NativeType.None
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(label);
|
||||
var cArr = allocI32Array(children);
|
||||
try {
|
||||
@ -402,7 +486,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createBreak(label: string | null, condition: ExpressionRef = 0, value: ExpressionRef = 0): ExpressionRef {
|
||||
createBreak(
|
||||
label: string | null,
|
||||
condition: ExpressionRef = 0,
|
||||
value: ExpressionRef = 0
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(label);
|
||||
try {
|
||||
return _BinaryenBreak(this.ref, cStr, condition, value);
|
||||
@ -411,11 +499,16 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createDrop(expression: ExpressionRef): ExpressionRef {
|
||||
createDrop(
|
||||
expression: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenDrop(this.ref, expression);
|
||||
}
|
||||
|
||||
createLoop(label: string | null, body: ExpressionRef): ExpressionRef {
|
||||
createLoop(
|
||||
label: string | null,
|
||||
body: ExpressionRef
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(label);
|
||||
try {
|
||||
return _BinaryenLoop(this.ref, cStr, body);
|
||||
@ -424,7 +517,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createIf(condition: ExpressionRef, ifTrue: ExpressionRef, ifFalse: ExpressionRef = 0): ExpressionRef {
|
||||
createIf(
|
||||
condition: ExpressionRef,
|
||||
ifTrue: ExpressionRef,
|
||||
ifFalse: ExpressionRef = 0
|
||||
): ExpressionRef {
|
||||
return _BinaryenIf(this.ref, condition, ifTrue, ifFalse);
|
||||
}
|
||||
|
||||
@ -432,18 +529,30 @@ export class Module {
|
||||
return _BinaryenNop(this.ref);
|
||||
}
|
||||
|
||||
createReturn(expression: ExpressionRef = 0): ExpressionRef {
|
||||
createReturn(
|
||||
expression: ExpressionRef = 0
|
||||
): ExpressionRef {
|
||||
return _BinaryenReturn(this.ref, expression);
|
||||
}
|
||||
|
||||
createSelect(ifTrue: ExpressionRef, ifFalse: ExpressionRef, condition: ExpressionRef): ExpressionRef {
|
||||
createSelect(
|
||||
ifTrue: ExpressionRef,
|
||||
ifFalse: ExpressionRef,
|
||||
condition: ExpressionRef
|
||||
): ExpressionRef {
|
||||
return _BinaryenSelect(this.ref, condition, ifTrue, ifFalse);
|
||||
}
|
||||
|
||||
createSwitch(names: string[], defaultName: string | null, condition: ExpressionRef, value: ExpressionRef = 0): ExpressionRef {
|
||||
createSwitch(
|
||||
names: string[],
|
||||
defaultName: string | null,
|
||||
condition: ExpressionRef,
|
||||
value: ExpressionRef = 0
|
||||
): ExpressionRef {
|
||||
var strs = new Array<usize>(names.length);
|
||||
for (var i = 0, k: i32 = names.length; i < k; ++i)
|
||||
for (var i = 0, k: i32 = names.length; i < k; ++i) {
|
||||
strs[i] = allocString(names[i]);
|
||||
}
|
||||
var cArr = allocI32Array(strs);
|
||||
var cStr = allocString(defaultName);
|
||||
try {
|
||||
@ -455,7 +564,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createCall(target: string, operands: ExpressionRef[] | null, returnType: NativeType): ExpressionRef {
|
||||
createCall(
|
||||
target: string,
|
||||
operands: ExpressionRef[] | null,
|
||||
returnType: NativeType
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(target);
|
||||
var cArr = allocI32Array(operands);
|
||||
try {
|
||||
@ -466,7 +579,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
createCallImport(target: string, operands: ExpressionRef[] | null, returnType: NativeType): ExpressionRef {
|
||||
createCallImport(
|
||||
target: string,
|
||||
operands: ExpressionRef[] | null,
|
||||
returnType: NativeType
|
||||
): ExpressionRef {
|
||||
var cStr = allocString(target);
|
||||
var cArr = allocI32Array(operands);
|
||||
try {
|
||||
@ -483,7 +600,12 @@ export class Module {
|
||||
|
||||
// meta
|
||||
|
||||
addGlobal(name: string, type: NativeType, mutable: bool, initializer: ExpressionRef): GlobalRef {
|
||||
addGlobal(
|
||||
name: string,
|
||||
type: NativeType,
|
||||
mutable: bool,
|
||||
initializer: ExpressionRef
|
||||
): GlobalRef {
|
||||
var cStr = allocString(name);
|
||||
try {
|
||||
return _BinaryenAddGlobal(this.ref, cStr, type, mutable ? 1 : 0, initializer);
|
||||
@ -492,7 +614,12 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addFunction(name: string, type: FunctionTypeRef, varTypes: NativeType[], body: ExpressionRef): FunctionRef {
|
||||
addFunction(
|
||||
name: string,
|
||||
type: FunctionTypeRef,
|
||||
varTypes: NativeType[],
|
||||
body: ExpressionRef
|
||||
): FunctionRef {
|
||||
var cStr = allocString(name);
|
||||
var cArr = allocI32Array(varTypes);
|
||||
try {
|
||||
@ -512,7 +639,10 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addFunctionExport(internalName: string, externalName: string): ExportRef {
|
||||
addFunctionExport(
|
||||
internalName: string,
|
||||
externalName: string
|
||||
): ExportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalName);
|
||||
try {
|
||||
@ -523,7 +653,10 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addTableExport(internalName: string, externalName: string): ExportRef {
|
||||
addTableExport(
|
||||
internalName: string,
|
||||
externalName: string
|
||||
): ExportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalName);
|
||||
try {
|
||||
@ -534,7 +667,10 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addMemoryExport(internalName: string, externalName: string): ExportRef {
|
||||
addMemoryExport(
|
||||
internalName: string,
|
||||
externalName: string
|
||||
): ExportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalName);
|
||||
try {
|
||||
@ -545,7 +681,10 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addGlobalExport(internalName: string, externalName: string): ExportRef {
|
||||
addGlobalExport(
|
||||
internalName: string,
|
||||
externalName: string
|
||||
): ExportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalName);
|
||||
try {
|
||||
@ -565,7 +704,12 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addFunctionImport(internalName: string, externalModuleName: string, externalBaseName: string, functionType: FunctionTypeRef): ImportRef {
|
||||
addFunctionImport(
|
||||
internalName: string,
|
||||
externalModuleName: string,
|
||||
externalBaseName: string,
|
||||
functionType: FunctionTypeRef
|
||||
): ImportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalModuleName);
|
||||
var cStr3 = allocString(externalBaseName);
|
||||
@ -578,7 +722,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addTableImport(internalName: string, externalModuleName: string, externalBaseName: string): ImportRef {
|
||||
addTableImport(
|
||||
internalName: string,
|
||||
externalModuleName: string,
|
||||
externalBaseName: string
|
||||
): ImportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalModuleName);
|
||||
var cStr3 = allocString(externalBaseName);
|
||||
@ -591,7 +739,11 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addMemoryImport(internalName: string, externalModuleName: string, externalBaseName: string): ImportRef {
|
||||
addMemoryImport(
|
||||
internalName: string,
|
||||
externalModuleName: string,
|
||||
externalBaseName: string
|
||||
): ImportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalModuleName);
|
||||
var cStr3 = allocString(externalBaseName);
|
||||
@ -604,7 +756,12 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
addGlobalImport(internalName: string, externalModuleName: string, externalBaseName: string, globalType: NativeType): ImportRef {
|
||||
addGlobalImport(
|
||||
internalName: string,
|
||||
externalModuleName: string,
|
||||
externalBaseName: string,
|
||||
globalType: NativeType
|
||||
): ImportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalModuleName);
|
||||
var cStr3 = allocString(externalBaseName);
|
||||
@ -626,7 +783,13 @@ export class Module {
|
||||
}
|
||||
}
|
||||
|
||||
setMemory(initial: Index, maximum: Index, segments: MemorySegment[], target: Target, exportName: string | null = null): void {
|
||||
setMemory(
|
||||
initial: Index,
|
||||
maximum: Index,
|
||||
segments: MemorySegment[],
|
||||
target: Target,
|
||||
exportName: string | null = null
|
||||
): void {
|
||||
var cStr = allocString(exportName);
|
||||
var k = segments.length;
|
||||
var segs = new Array<usize>(k);
|
||||
@ -691,14 +854,16 @@ export class Module {
|
||||
runPasses(passes: string[], func: FunctionRef = 0): void {
|
||||
var k = passes.length;
|
||||
var names = new Array<usize>(k);
|
||||
for (var i = 0; i < k; ++i)
|
||||
for (var i = 0; i < k; ++i) {
|
||||
names[i] = allocString(passes[i]);
|
||||
}
|
||||
var cArr = allocI32Array(names);
|
||||
try {
|
||||
if (func)
|
||||
if (func) {
|
||||
_BinaryenFunctionRunPasses(func, this.ref, cArr, k);
|
||||
else
|
||||
} else {
|
||||
_BinaryenModuleRunPasses(this.ref, cArr, k);
|
||||
}
|
||||
} finally {
|
||||
free_memory(cArr);
|
||||
for (; i >= 0; --i) free_memory(names[i]);
|
||||
@ -752,10 +917,12 @@ export class Module {
|
||||
return Relooper.create(this);
|
||||
}
|
||||
|
||||
// currently supports side effect free expressions only
|
||||
cloneExpression(expr: ExpressionRef, noSideEffects: bool = false, maxDepth: i32 = i32.MAX_VALUE): ExpressionRef {
|
||||
if (maxDepth < 0)
|
||||
return 0;
|
||||
cloneExpression(expr: ExpressionRef,
|
||||
noSideEffects: bool = false,
|
||||
maxDepth: i32 = i32.MAX_VALUE
|
||||
): ExpressionRef { // currently supports side effect free expressions only
|
||||
if (maxDepth < 0) return 0;
|
||||
maxDepth -= 1;
|
||||
|
||||
var nested1: ExpressionRef,
|
||||
nested2: ExpressionRef;
|
||||
@ -764,39 +931,65 @@ export class Module {
|
||||
|
||||
case ExpressionId.Const:
|
||||
switch (_BinaryenExpressionGetType(expr)) {
|
||||
case NativeType.I32: return this.createI32(_BinaryenConstGetValueI32(expr));
|
||||
case NativeType.I64: return this.createI64(_BinaryenConstGetValueI64Low(expr), _BinaryenConstGetValueI64High(expr));
|
||||
case NativeType.F32: return this.createF32(_BinaryenConstGetValueF32(expr));
|
||||
case NativeType.F64: return this.createF64(_BinaryenConstGetValueF64(expr));
|
||||
default: throw new Error("concrete type expected");
|
||||
case NativeType.I32:
|
||||
return this.createI32(_BinaryenConstGetValueI32(expr));
|
||||
case NativeType.I64:
|
||||
return this.createI64(
|
||||
_BinaryenConstGetValueI64Low(expr),
|
||||
_BinaryenConstGetValueI64High(expr)
|
||||
);
|
||||
case NativeType.F32:
|
||||
return this.createF32(_BinaryenConstGetValueF32(expr));
|
||||
case NativeType.F64:
|
||||
return this.createF64(_BinaryenConstGetValueF64(expr));
|
||||
default:
|
||||
throw new Error("concrete type expected");
|
||||
}
|
||||
|
||||
case ExpressionId.GetLocal:
|
||||
return _BinaryenGetLocal(this.ref, _BinaryenGetLocalGetIndex(expr), _BinaryenExpressionGetType(expr));
|
||||
return _BinaryenGetLocal(this.ref,
|
||||
_BinaryenGetLocalGetIndex(expr),
|
||||
_BinaryenExpressionGetType(expr)
|
||||
);
|
||||
|
||||
case ExpressionId.GetGlobal:
|
||||
var globalName = _BinaryenGetGlobalGetName(expr);
|
||||
if (!globalName)
|
||||
break;
|
||||
if (!globalName) break;
|
||||
return _BinaryenGetGlobal(this.ref, globalName, _BinaryenExpressionGetType(expr));
|
||||
|
||||
case ExpressionId.Load:
|
||||
if (!(nested1 = this.cloneExpression(_BinaryenLoadGetPtr(expr), noSideEffects, maxDepth - 1)))
|
||||
if (!(nested1 = this.cloneExpression(_BinaryenLoadGetPtr(expr), noSideEffects, maxDepth))) {
|
||||
break;
|
||||
}
|
||||
return _BinaryenLoadIsAtomic(expr)
|
||||
? _BinaryenAtomicLoad(this.ref, _BinaryenLoadGetBytes(expr), _BinaryenLoadGetOffset(expr), _BinaryenExpressionGetType(expr), nested1)
|
||||
: _BinaryenLoad(this.ref, _BinaryenLoadGetBytes(expr), _BinaryenLoadIsSigned(expr) ? 1 : 0, _BinaryenLoadGetOffset(expr), _BinaryenLoadGetAlign(expr), _BinaryenExpressionGetType(expr), nested1);
|
||||
? _BinaryenAtomicLoad(this.ref,
|
||||
_BinaryenLoadGetBytes(expr),
|
||||
_BinaryenLoadGetOffset(expr),
|
||||
_BinaryenExpressionGetType(expr),
|
||||
nested1
|
||||
)
|
||||
: _BinaryenLoad(this.ref,
|
||||
_BinaryenLoadGetBytes(expr),
|
||||
_BinaryenLoadIsSigned(expr) ? 1 : 0,
|
||||
_BinaryenLoadGetOffset(expr),
|
||||
_BinaryenLoadGetAlign(expr),
|
||||
_BinaryenExpressionGetType(expr),
|
||||
nested1
|
||||
);
|
||||
|
||||
case ExpressionId.Unary:
|
||||
if (!(nested1 = this.cloneExpression(_BinaryenUnaryGetValue(expr), noSideEffects, maxDepth - 1)))
|
||||
if (!(nested1 = this.cloneExpression(_BinaryenUnaryGetValue(expr), noSideEffects, maxDepth))) {
|
||||
break;
|
||||
}
|
||||
return _BinaryenUnary(this.ref, _BinaryenUnaryGetOp(expr), nested1);
|
||||
|
||||
case ExpressionId.Binary:
|
||||
if (!(nested1 = this.cloneExpression(_BinaryenBinaryGetLeft(expr), noSideEffects, maxDepth - 1)))
|
||||
if (!(nested1 = this.cloneExpression(_BinaryenBinaryGetLeft(expr), noSideEffects, maxDepth))) {
|
||||
break;
|
||||
if (!(nested2 = this.cloneExpression(_BinaryenBinaryGetRight(expr), noSideEffects, maxDepth - 1)))
|
||||
}
|
||||
if (!(nested2 = this.cloneExpression(_BinaryenBinaryGetRight(expr), noSideEffects, maxDepth))) {
|
||||
break;
|
||||
}
|
||||
return _BinaryenBinary(this.ref, _BinaryenBinaryGetOp(expr), nested1, nested2);
|
||||
}
|
||||
return 0;
|
||||
@ -817,7 +1010,13 @@ export class Module {
|
||||
return readString(_BinaryenModuleGetDebugInfoFileName(this.ref, index));
|
||||
}
|
||||
|
||||
setDebugLocation(func: FunctionRef, expr: ExpressionRef, fileIndex: Index, lineNumber: Index, columnNumber: Index): void {
|
||||
setDebugLocation(
|
||||
func: FunctionRef,
|
||||
expr: ExpressionRef,
|
||||
fileIndex: Index,
|
||||
lineNumber: Index,
|
||||
columnNumber: Index
|
||||
): void {
|
||||
_BinaryenFunctionSetDebugLocation(func, expr, fileIndex, lineNumber, columnNumber);
|
||||
}
|
||||
}
|
||||
@ -876,8 +1075,9 @@ function allocU8Array(u8s: Uint8Array | null): usize {
|
||||
if (!u8s) return 0;
|
||||
var ptr = allocate_memory(u8s.length);
|
||||
var idx = ptr;
|
||||
for (var i = 0, k = u8s.length; i < k; ++i)
|
||||
for (var i = 0, k = u8s.length; i < k; ++i) {
|
||||
store<u8>(idx++, u8s[i]);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -901,20 +1101,22 @@ function stringLengthUTF8(str: string): usize {
|
||||
var len = 0;
|
||||
for (var i = 0, k = str.length; i < k; ++i) {
|
||||
var u = str.charCodeAt(i);
|
||||
if (u >= 0xD800 && u <= 0xDFFF && i + 1 < k)
|
||||
if (u >= 0xD800 && u <= 0xDFFF && i + 1 < k) {
|
||||
u = 0x10000 + ((u & 0x3FF) << 10) | (str.charCodeAt(++i) & 0x3FF);
|
||||
if (u <= 0x7F)
|
||||
}
|
||||
if (u <= 0x7F) {
|
||||
++len;
|
||||
else if (u <= 0x7FF)
|
||||
} else if (u <= 0x7FF) {
|
||||
len += 2;
|
||||
else if (u <= 0xFFFF)
|
||||
} else if (u <= 0xFFFF) {
|
||||
len += 3;
|
||||
else if (u <= 0x1FFFFF)
|
||||
} else if (u <= 0x1FFFFF) {
|
||||
len += 4;
|
||||
else if (u <= 0x3FFFFFF)
|
||||
} else if (u <= 0x3FFFFFF) {
|
||||
len += 5;
|
||||
else
|
||||
} else {
|
||||
len += 6;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@ -925,11 +1127,12 @@ function allocString(str: string | null): usize {
|
||||
var idx = ptr;
|
||||
for (var i = 0, k = str.length; i < k; ++i) {
|
||||
var u = str.charCodeAt(i);
|
||||
if (u >= 0xD800 && u <= 0xDFFF && i + 1 < k)
|
||||
if (u >= 0xD800 && u <= 0xDFFF && i + 1 < k) {
|
||||
u = 0x10000 + ((u & 0x3FF) << 10) | (str.charCodeAt(++i) & 0x3FF);
|
||||
if (u <= 0x7F)
|
||||
}
|
||||
if (u <= 0x7F) {
|
||||
store<u8>(idx++, u as u8);
|
||||
else if (u <= 0x7FF) {
|
||||
} else if (u <= 0x7FF) {
|
||||
store<u8>(idx++, (0xC0 | (u >>> 6) ) as u8);
|
||||
store<u8>(idx++, (0x80 | ( u & 63)) as u8);
|
||||
} else if (u <= 0xFFFF) {
|
||||
@ -971,8 +1174,9 @@ export function readInt(ptr: usize): i32 {
|
||||
|
||||
export function readBuffer(ptr: usize, length: usize): Uint8Array {
|
||||
var ret = new Uint8Array(length);
|
||||
for (var i: usize = 0; i < length; ++i)
|
||||
for (var i: usize = 0; i < length; ++i) {
|
||||
ret[i] = load<u8>(ptr + i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
1850
src/parser.ts
1850
src/parser.ts
File diff suppressed because it is too large
Load Diff
1470
src/program.ts
1470
src/program.ts
File diff suppressed because it is too large
Load Diff
409
src/tokenizer.ts
409
src/tokenizer.ts
@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
This is a modified version of TypeScript's scanner that doesn't perform
|
||||
as much bookkeeping, simply skips over trivia and provides a more general
|
||||
mark/reset mechanism for the parser to utilize on ambiguous tokens.
|
||||
This is a modified version of TypeScript's scanner that doesn't perform as much bookkeeping, simply
|
||||
skips over trivia and provides a more general mark/reset mechanism for the parser to utilize on
|
||||
ambiguous tokens.
|
||||
|
||||
next() advances the token
|
||||
peek() peeks for the next token
|
||||
@ -285,21 +285,29 @@ export class Range {
|
||||
}
|
||||
|
||||
static join(a: Range, b: Range): Range {
|
||||
if (a.source != b.source)
|
||||
throw new Error("source mismatch");
|
||||
return new Range(a.source, a.start < b.start ? a.start : b.start, a.end > b.end ? a.end : b.end);
|
||||
if (a.source != b.source) throw new Error("source mismatch");
|
||||
return new Range(a.source,
|
||||
a.start < b.start ? a.start : b.start,
|
||||
a.end > b.end ? a.end : b.end
|
||||
);
|
||||
}
|
||||
|
||||
get atStart(): Range { return new Range(this.source, this.start, this.start); }
|
||||
get atEnd(): Range { return new Range(this.source, this.end, this.end); }
|
||||
get atStart(): Range {
|
||||
return new Range(this.source, this.start, this.start);
|
||||
}
|
||||
get atEnd(): Range {
|
||||
return new Range(this.source, this.end, this.end);
|
||||
}
|
||||
|
||||
get line(): i32 {
|
||||
var text = this.source.text;
|
||||
var pos = this.start;
|
||||
var line = 1;
|
||||
while (pos-- > 0)
|
||||
if (text.charCodeAt(pos) == CharCode.LINEFEED)
|
||||
while (pos-- > 0) {
|
||||
if (text.charCodeAt(pos) == CharCode.LINEFEED) {
|
||||
line++;
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
@ -308,8 +316,7 @@ export class Range {
|
||||
var pos = this.start;
|
||||
var column = 0;
|
||||
while (pos-- > 0) {
|
||||
if (text.charCodeAt(pos) == CharCode.LINEFEED)
|
||||
break;
|
||||
if (text.charCodeAt(pos) == CharCode.LINEFEED) break;
|
||||
column++;
|
||||
}
|
||||
return column;
|
||||
@ -350,14 +357,26 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var text = source.text;
|
||||
|
||||
// skip bom
|
||||
if (this.pos < this.end && text.charCodeAt(this.pos) == CharCode.BYTEORDERMARK)
|
||||
if (
|
||||
this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.BYTEORDERMARK
|
||||
) {
|
||||
++this.pos;
|
||||
}
|
||||
|
||||
// skip shebang
|
||||
if (this.pos + 1 < this.end && text.charCodeAt(this.pos) == CharCode.HASH && text.charCodeAt(this.pos + 1) == CharCode.EXCLAMATION) {
|
||||
if (
|
||||
this.pos + 1 < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.HASH &&
|
||||
text.charCodeAt(this.pos + 1) == CharCode.EXCLAMATION
|
||||
) {
|
||||
this.pos += 2;
|
||||
while (this.pos < this.end && text.charCodeAt(this.pos) != CharCode.LINEFEED)
|
||||
while (
|
||||
this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) != CharCode.LINEFEED
|
||||
) {
|
||||
++this.pos;
|
||||
}
|
||||
// 'next' now starts at lf or eof
|
||||
}
|
||||
}
|
||||
@ -367,19 +386,20 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
return this.token = this.unsafeNext(preferIdentifier);
|
||||
}
|
||||
|
||||
private unsafeNext(preferIdentifier: bool = false, maxCompoundLength: i32 = i32.MAX_VALUE): Token {
|
||||
private unsafeNext(preferIdentifier: bool = false, maxTokenLength: i32 = i32.MAX_VALUE): Token {
|
||||
var text = this.source.text;
|
||||
while (true) {
|
||||
if (this.pos >= this.end)
|
||||
return Token.ENDOFFILE;
|
||||
|
||||
while (this.pos < this.end) {
|
||||
this.tokenPos = this.pos;
|
||||
var c = text.charCodeAt(this.pos);
|
||||
switch (c) {
|
||||
|
||||
case CharCode.CARRIAGERETURN:
|
||||
if (++this.pos < this.end && text.charCodeAt(this.pos) == CharCode.LINEFEED)
|
||||
if (
|
||||
++this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.LINEFEED
|
||||
) {
|
||||
++this.pos;
|
||||
}
|
||||
break;
|
||||
|
||||
case CharCode.LINEFEED:
|
||||
@ -392,9 +412,15 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.EXCLAMATION:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 1 && this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 2 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 2 && this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.EXCLAMATION_EQUALS_EQUALS;
|
||||
}
|
||||
@ -409,7 +435,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.PERCENT:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 1 && this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.PERCENT_EQUALS;
|
||||
}
|
||||
@ -417,7 +446,7 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.AMPERSAND:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.AMPERSAND) {
|
||||
++this.pos;
|
||||
return Token.AMPERSAND_AMPERSAND;
|
||||
@ -439,14 +468,17 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.ASTERISK:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
++this.pos;
|
||||
return Token.ASTERISK_EQUALS;
|
||||
}
|
||||
if (text.charCodeAt(this.pos) == CharCode.ASTERISK) {
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 2 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 2 && this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.ASTERISK_ASTERISK_EQUALS;
|
||||
}
|
||||
@ -457,7 +489,7 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.PLUS:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.PLUS) {
|
||||
++this.pos;
|
||||
return Token.PLUS_PLUS;
|
||||
@ -475,7 +507,7 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.MINUS:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.MINUS) {
|
||||
++this.pos;
|
||||
return Token.MINUS_MINUS;
|
||||
@ -489,12 +521,16 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.DOT:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (isDecimalDigit(text.charCodeAt(this.pos))) {
|
||||
--this.pos;
|
||||
return Token.FLOATLITERAL; // expects a call to readFloat
|
||||
}
|
||||
if (maxCompoundLength > 2 && text.charCodeAt(this.pos) == CharCode.DOT && this.pos + 1 < this.end && text.charCodeAt(this.pos + 1) == CharCode.DOT) {
|
||||
if (
|
||||
maxTokenLength > 2 && this.pos + 1 < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.DOT &&
|
||||
text.charCodeAt(this.pos + 1) == CharCode.DOT
|
||||
) {
|
||||
this.pos += 2;
|
||||
return Token.DOT_DOT_DOT;
|
||||
}
|
||||
@ -503,29 +539,39 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.SLASH:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.SLASH) { // single-line comment
|
||||
if (this.pos + 1 < this.end && text.charCodeAt(this.pos + 1) == CharCode.SLASH) {
|
||||
// TODO: triple-slash directives, i.e. '/// <reference path="some.d.ts" />'
|
||||
}
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.SLASH) { // single-line
|
||||
// TODO: triple-slash?
|
||||
// if (
|
||||
// this.pos + 1 < this.end &&
|
||||
// text.charCodeAt(this.pos + 1) == CharCode.SLASH
|
||||
// ) {
|
||||
// }
|
||||
while (++this.pos < this.end) {
|
||||
if (isLineBreak(text.charCodeAt(this.pos)))
|
||||
break;
|
||||
if (isLineBreak(text.charCodeAt(this.pos))) break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (text.charCodeAt(this.pos) == CharCode.ASTERISK) { // multi-line comment
|
||||
if (text.charCodeAt(this.pos) == CharCode.ASTERISK) { // multi-line
|
||||
var closed = false;
|
||||
while (++this.pos < this.end) {
|
||||
c = text.charCodeAt(this.pos);
|
||||
if (c == CharCode.ASTERISK && this.pos + 1 < this.end && text.charCodeAt(this.pos + 1) == CharCode.SLASH) {
|
||||
if (
|
||||
c == CharCode.ASTERISK &&
|
||||
this.pos + 1 < this.end &&
|
||||
text.charCodeAt(this.pos + 1) == CharCode.SLASH
|
||||
) {
|
||||
this.pos += 2;
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!closed)
|
||||
this.error(DiagnosticCode._0_expected, this.range(this.pos), "*/");
|
||||
if (!closed) {
|
||||
this.error(
|
||||
DiagnosticCode._0_expected,
|
||||
this.range(this.pos), "*/"
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
@ -559,10 +605,14 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.LESSTHAN:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.LESSTHAN) {
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 2 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 2 &&
|
||||
this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.LESSTHAN_LESSTHAN_EQUALS;
|
||||
}
|
||||
@ -577,10 +627,14 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.EQUALS:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 2 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 2 &&
|
||||
this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.EQUALS_EQUALS_EQUALS;
|
||||
}
|
||||
@ -595,13 +649,16 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.GREATERTHAN:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.GREATERTHAN) {
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 2 && this.pos < this.end) {
|
||||
if (maxTokenLength > 2 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.GREATERTHAN) {
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 3 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 3 && this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS;
|
||||
}
|
||||
@ -635,7 +692,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.CARET:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end && text.charCodeAt(this.pos) == CharCode.EQUALS) {
|
||||
if (
|
||||
maxTokenLength > 1 && this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.EQUALS
|
||||
) {
|
||||
++this.pos;
|
||||
return Token.CARET_EQUALS;
|
||||
}
|
||||
@ -647,7 +707,7 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
case CharCode.BAR:
|
||||
++this.pos;
|
||||
if (maxCompoundLength > 1 && this.pos < this.end) {
|
||||
if (maxTokenLength > 1 && this.pos < this.end) {
|
||||
if (text.charCodeAt(this.pos) == CharCode.BAR) {
|
||||
++this.pos;
|
||||
return Token.BAR_BAR;
|
||||
@ -675,7 +735,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
if (isIdentifierStart(c)) {
|
||||
if (isKeywordCharacter(c)) {
|
||||
var posBefore = this.pos;
|
||||
while (++this.pos < this.end && isIdentifierPart(c = text.charCodeAt(this.pos))) {
|
||||
while (
|
||||
++this.pos < this.end &&
|
||||
isIdentifierPart(c = text.charCodeAt(this.pos))
|
||||
) {
|
||||
if (!isKeywordCharacter(c)) {
|
||||
this.pos = posBefore;
|
||||
return Token.IDENTIFIER;
|
||||
@ -683,8 +746,12 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
}
|
||||
var keywordText = text.substring(posBefore, this.pos);
|
||||
var keywordToken = Token.fromKeyword(keywordText);
|
||||
if (keywordToken != Token.INVALID && !(preferIdentifier && Token.isAlsoIdentifier(keywordToken)))
|
||||
if (
|
||||
keywordToken != Token.INVALID &&
|
||||
!(preferIdentifier && Token.isAlsoIdentifier(keywordToken))
|
||||
) {
|
||||
return keywordToken;
|
||||
}
|
||||
this.pos = posBefore;
|
||||
}
|
||||
return Token.IDENTIFIER; // expects a call to readIdentifier
|
||||
@ -692,14 +759,22 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
++this.pos;
|
||||
break;
|
||||
}
|
||||
this.error(DiagnosticCode.Invalid_character, this.range(this.pos, this.pos + 1));
|
||||
this.error(
|
||||
DiagnosticCode.Invalid_character,
|
||||
this.range(this.pos, this.pos + 1)
|
||||
);
|
||||
++this.pos;
|
||||
return Token.INVALID;
|
||||
}
|
||||
}
|
||||
return Token.ENDOFFILE;
|
||||
}
|
||||
|
||||
peek(checkOnNewLine: bool = false, preferIdentifier: bool = false, maxCompoundLength: i32 = i32.MAX_VALUE): Token {
|
||||
peek(
|
||||
checkOnNewLine: bool = false,
|
||||
preferIdentifier: bool = false,
|
||||
maxCompoundLength: i32 = i32.MAX_VALUE
|
||||
): Token {
|
||||
var text = this.source.text;
|
||||
if (this.nextToken < 0) {
|
||||
var posBefore = this.pos;
|
||||
@ -732,7 +807,8 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
maxCompoundLength = 1;
|
||||
break;
|
||||
}
|
||||
if ((this.token = this.unsafeNext(token == Token.IDENTIFIER, maxCompoundLength)) == token) {
|
||||
this.token = this.unsafeNext(token == Token.IDENTIFIER, maxCompoundLength);
|
||||
if (this.token == token) {
|
||||
this.nextToken = -1;
|
||||
return true;
|
||||
} else {
|
||||
@ -771,15 +847,19 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
if (start < 0) {
|
||||
start = this.tokenPos;
|
||||
end = this.pos;
|
||||
} else if (end < 0)
|
||||
} else if (end < 0) {
|
||||
end = start;
|
||||
}
|
||||
return new Range(this.source, start, end);
|
||||
}
|
||||
|
||||
readIdentifier(): string {
|
||||
var text = this.source.text;
|
||||
var start = this.pos;
|
||||
while (++this.pos < this.end && isIdentifierPart(text.charCodeAt(this.pos)));
|
||||
while (
|
||||
++this.pos < this.end &&
|
||||
isIdentifierPart(text.charCodeAt(this.pos))
|
||||
);
|
||||
return text.substring(start, this.pos);
|
||||
}
|
||||
|
||||
@ -791,7 +871,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
while (true) {
|
||||
if (this.pos >= this.end) {
|
||||
result += text.substring(start, this.pos);
|
||||
this.error(DiagnosticCode.Unterminated_string_literal, this.range(start - 1, this.end));
|
||||
this.error(
|
||||
DiagnosticCode.Unterminated_string_literal,
|
||||
this.range(start - 1, this.end)
|
||||
);
|
||||
break;
|
||||
}
|
||||
var c = text.charCodeAt(this.pos);
|
||||
@ -807,7 +890,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
}
|
||||
if (isLineBreak(c)) {
|
||||
result += text.substring(start, this.pos);
|
||||
this.error(DiagnosticCode.Unterminated_string_literal, this.range(start - 1, this.pos));
|
||||
this.error(
|
||||
DiagnosticCode.Unterminated_string_literal,
|
||||
this.range(start - 1, this.pos)
|
||||
);
|
||||
break;
|
||||
}
|
||||
++this.pos;
|
||||
@ -817,7 +903,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
readEscapeSequence(): string {
|
||||
if (++this.pos >= this.end) {
|
||||
this.error(DiagnosticCode.Unexpected_end_of_text, this.range(this.end));
|
||||
this.error(
|
||||
DiagnosticCode.Unexpected_end_of_text,
|
||||
this.range(this.end)
|
||||
);
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -853,7 +942,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
return "\"";
|
||||
|
||||
case CharCode.u: {
|
||||
if (this.pos < this.end && text.charCodeAt(this.pos) == CharCode.OPENBRACE) {
|
||||
if (
|
||||
this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.OPENBRACE
|
||||
) {
|
||||
++this.pos;
|
||||
return this.readExtendedUnicodeEscape(); // \u{DDDDDDDD}
|
||||
}
|
||||
@ -861,8 +953,12 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
}
|
||||
|
||||
case CharCode.CARRIAGERETURN:
|
||||
if (this.pos < this.end && text.charCodeAt(this.pos) == CharCode.LINEFEED)
|
||||
if (
|
||||
this.pos < this.end &&
|
||||
text.charCodeAt(this.pos) == CharCode.LINEFEED
|
||||
) {
|
||||
++this.pos;
|
||||
}
|
||||
// fall through
|
||||
|
||||
case CharCode.LINEFEED:
|
||||
@ -880,7 +976,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var escaped = false;
|
||||
while (true) {
|
||||
if (this.pos >= this.end) {
|
||||
this.error(DiagnosticCode.Unterminated_regular_expression_literal, this.range(start, this.end));
|
||||
this.error(
|
||||
DiagnosticCode.Unterminated_regular_expression_literal,
|
||||
this.range(start, this.end)
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (text.charCodeAt(this.pos) == CharCode.BACKSLASH) {
|
||||
@ -889,10 +988,12 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
continue;
|
||||
}
|
||||
var c = text.charCodeAt(this.pos);
|
||||
if (c == CharCode.SLASH && !escaped)
|
||||
break;
|
||||
if (c == CharCode.SLASH && !escaped) break;
|
||||
if (isLineBreak(c)) {
|
||||
this.error(DiagnosticCode.Unterminated_regular_expression_literal, this.range(start, this.pos));
|
||||
this.error(
|
||||
DiagnosticCode.Unterminated_regular_expression_literal,
|
||||
this.range(start, this.pos)
|
||||
);
|
||||
break;
|
||||
}
|
||||
++this.pos;
|
||||
@ -907,18 +1008,20 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var flags = 0;
|
||||
while (this.pos < this.end) {
|
||||
var c: i32 = text.charCodeAt(this.pos);
|
||||
if (!isIdentifierPart(c))
|
||||
break;
|
||||
if (!isIdentifierPart(c)) break;
|
||||
++this.pos;
|
||||
|
||||
// make sure each supported flag is unique
|
||||
switch (c) {
|
||||
|
||||
// make sure each supported flag is unique
|
||||
case CharCode.g:
|
||||
flags |= flags & 1 ? -1 : 1;
|
||||
break;
|
||||
|
||||
case CharCode.i:
|
||||
flags |= flags & 2 ? -1 : 2;
|
||||
break;
|
||||
|
||||
case CharCode.m:
|
||||
flags |= flags & 4 ? -1 : 4;
|
||||
break;
|
||||
@ -928,8 +1031,12 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flags == -1)
|
||||
this.error(DiagnosticCode.Invalid_regular_expression_flags, this.range(start, this.pos));
|
||||
if (flags == -1) {
|
||||
this.error(
|
||||
DiagnosticCode.Invalid_regular_expression_flags,
|
||||
this.range(start, this.pos)
|
||||
);
|
||||
}
|
||||
return text.substring(start, this.pos);
|
||||
}
|
||||
|
||||
@ -949,10 +1056,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var pos = this.pos;
|
||||
while (pos < this.end) {
|
||||
var c = text.charCodeAt(pos);
|
||||
if (c == CharCode.DOT || c == CharCode.E || c == CharCode.e)
|
||||
if (c == CharCode.DOT || c == CharCode.E || c == CharCode.e) {
|
||||
return false;
|
||||
if (c < CharCode._0 || c > CharCode._9)
|
||||
break;
|
||||
}
|
||||
if (c < CharCode._0 || c > CharCode._9) break;
|
||||
pos++;
|
||||
}
|
||||
return true;
|
||||
@ -962,14 +1069,17 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var text = this.source.text;
|
||||
if (text.charCodeAt(this.pos) == CharCode._0 && this.pos + 2 < this.end) {
|
||||
switch (text.charCodeAt(this.pos + 1)) {
|
||||
|
||||
case CharCode.X:
|
||||
case CharCode.x:
|
||||
this.pos += 2;
|
||||
return this.readHexInteger();
|
||||
|
||||
case CharCode.B:
|
||||
case CharCode.b:
|
||||
this.pos += 2;
|
||||
return this.readBinaryInteger();
|
||||
|
||||
case CharCode.O:
|
||||
case CharCode.o:
|
||||
this.pos += 2;
|
||||
@ -979,7 +1089,10 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var start = this.pos;
|
||||
++this.pos;
|
||||
var value = this.readOctalInteger();
|
||||
this.error(DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode, this.range(start, this.pos));
|
||||
this.error(
|
||||
DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode,
|
||||
this.range(start, this.pos)
|
||||
);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@ -995,19 +1108,33 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var c = text.charCodeAt(this.pos);
|
||||
if (c >= CharCode._0 && c <= CharCode._9) {
|
||||
// value = value * 16 + c - CharCode._0;
|
||||
value = i64_add(i64_mul(value, i64_16), i64_new(c - CharCode._0, 0));
|
||||
value = i64_add(
|
||||
i64_mul(value, i64_16),
|
||||
i64_new(c - CharCode._0, 0)
|
||||
);
|
||||
} else if (c >= CharCode.A && c <= CharCode.F) {
|
||||
// value = value * 16 + 10 + c - CharCode.A;
|
||||
value = i64_add(i64_mul(value, i64_16), i64_new(10 + c - CharCode.A, 0));
|
||||
value = i64_add(
|
||||
i64_mul(value, i64_16),
|
||||
i64_new(10 + c - CharCode.A, 0)
|
||||
);
|
||||
} else if (c >= CharCode.a && c <= CharCode.f) {
|
||||
// value = value * 16 + 10 + c - CharCode.a;
|
||||
value = i64_add(i64_mul(value, i64_16), i64_new(10 + c - CharCode.a, 0));
|
||||
} else
|
||||
value = i64_add(
|
||||
i64_mul(value, i64_16),
|
||||
i64_new(10 + c - CharCode.a, 0)
|
||||
);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
++this.pos;
|
||||
}
|
||||
if (this.pos == start)
|
||||
this.error(DiagnosticCode.Hexadecimal_digit_expected, this.range(start));
|
||||
if (this.pos == start) {
|
||||
this.error(
|
||||
DiagnosticCode.Hexadecimal_digit_expected,
|
||||
this.range(start)
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -1020,13 +1147,21 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var c = text.charCodeAt(this.pos);
|
||||
if (c >= CharCode._0 && c <= CharCode._9) {
|
||||
// value = value * 10 + c - CharCode._0;
|
||||
value = i64_add(i64_mul(value, i64_10), i64_new(c - CharCode._0, 0));
|
||||
} else
|
||||
value = i64_add(
|
||||
i64_mul(value, i64_10),
|
||||
i64_new(c - CharCode._0, 0)
|
||||
);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
++this.pos;
|
||||
}
|
||||
if (this.pos == start)
|
||||
this.error(DiagnosticCode.Digit_expected, this.range(start));
|
||||
if (this.pos == start) {
|
||||
this.error(
|
||||
DiagnosticCode.Digit_expected,
|
||||
this.range(start)
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -1039,13 +1174,21 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var c = text.charCodeAt(this.pos);
|
||||
if (c >= CharCode._0 && c <= CharCode._7) {
|
||||
// value = value * 8 + c - CharCode._0;
|
||||
value = i64_add(i64_mul(value, i64_8), i64_new(c - CharCode._0, 0));
|
||||
} else
|
||||
value = i64_add(
|
||||
i64_mul(value, i64_8),
|
||||
i64_new(c - CharCode._0, 0)
|
||||
);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
++this.pos;
|
||||
}
|
||||
if (this.pos == start)
|
||||
this.error(DiagnosticCode.Octal_digit_expected, this.range(start));
|
||||
if (this.pos == start) {
|
||||
this.error(
|
||||
DiagnosticCode.Octal_digit_expected,
|
||||
this.range(start)
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -1059,36 +1202,57 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var c = text.charCodeAt(this.pos);
|
||||
if (c == CharCode._0) {
|
||||
// value = value * 2;
|
||||
value = i64_mul(value, i64_2);
|
||||
value = i64_mul(
|
||||
value,
|
||||
i64_2
|
||||
);
|
||||
} else if (c == CharCode._1) {
|
||||
// value = value * 2 + 1;
|
||||
value = i64_add(i64_mul(value, i64_2), i64_1);
|
||||
} else
|
||||
value = i64_add(
|
||||
i64_mul(value, i64_2),
|
||||
i64_1
|
||||
);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
++this.pos;
|
||||
}
|
||||
if (this.pos == start)
|
||||
this.error(DiagnosticCode.Binary_digit_expected, this.range(start));
|
||||
if (this.pos == start) {
|
||||
this.error(
|
||||
DiagnosticCode.Binary_digit_expected,
|
||||
this.range(start)
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
readFloat(): f64 {
|
||||
var start = this.pos;
|
||||
var text = this.source.text;
|
||||
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos)))
|
||||
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos))) {
|
||||
++this.pos;
|
||||
}
|
||||
if (this.pos < this.end && text.charCodeAt(this.pos) == CharCode.DOT) {
|
||||
++this.pos;
|
||||
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos)))
|
||||
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos))) {
|
||||
++this.pos;
|
||||
}
|
||||
}
|
||||
if (this.pos < this.end) {
|
||||
var c = text.charCodeAt(this.pos);
|
||||
if (c == CharCode.E || c == CharCode.e) {
|
||||
if (++this.pos < this.end && (text.charCodeAt(this.pos) == CharCode.MINUS || text.charCodeAt(this.pos) == CharCode.PLUS) && isDecimalDigit(text.charCodeAt(this.pos + 1)))
|
||||
if (
|
||||
++this.pos < this.end && (
|
||||
text.charCodeAt(this.pos) == CharCode.MINUS ||
|
||||
text.charCodeAt(this.pos) == CharCode.PLUS
|
||||
) &&
|
||||
isDecimalDigit(text.charCodeAt(this.pos + 1))
|
||||
) {
|
||||
++this.pos;
|
||||
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos)))
|
||||
}
|
||||
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos))) {
|
||||
++this.pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return parseFloat(text.substring(start, this.pos));
|
||||
@ -1100,21 +1264,26 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
var text = this.source.text;
|
||||
while (this.pos < this.end) {
|
||||
var c = text.charCodeAt(this.pos++);
|
||||
if (c >= CharCode._0 && c <= CharCode._9)
|
||||
if (c >= CharCode._0 && c <= CharCode._9) {
|
||||
value = value * 16 + c - CharCode._0;
|
||||
else if (c >= CharCode.A && c <= CharCode.F)
|
||||
} else if (c >= CharCode.A && c <= CharCode.F) {
|
||||
value = value * 16 + 10 + c - CharCode.A;
|
||||
else if (c >= CharCode.a && c <= CharCode.f)
|
||||
} else if (c >= CharCode.a && c <= CharCode.f) {
|
||||
value = value * 16 + 10 + c - CharCode.a;
|
||||
else {
|
||||
this.error(DiagnosticCode.Hexadecimal_digit_expected, this.range(this.pos - 1, this.pos));
|
||||
} else {
|
||||
this.error(
|
||||
DiagnosticCode.Hexadecimal_digit_expected,
|
||||
this.range(this.pos - 1, this.pos)
|
||||
);
|
||||
return "";
|
||||
}
|
||||
if (--remain == 0)
|
||||
break;
|
||||
if (--remain == 0) break;
|
||||
}
|
||||
if (remain) {
|
||||
this.error(DiagnosticCode.Unexpected_end_of_text, this.range(this.pos));
|
||||
this.error(
|
||||
DiagnosticCode.Unexpected_end_of_text,
|
||||
this.range(this.pos)
|
||||
);
|
||||
return "";
|
||||
}
|
||||
return String.fromCharCode(value);
|
||||
@ -1128,25 +1297,39 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
|
||||
assert(!i64_high(value));
|
||||
if (value32 > 0x10FFFF) {
|
||||
this.error(DiagnosticCode.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, this.range(start, this.pos));
|
||||
this.error(
|
||||
DiagnosticCode.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive,
|
||||
this.range(start, this.pos)
|
||||
);
|
||||
invalid = true;
|
||||
}
|
||||
|
||||
var text = this.source.text;
|
||||
if (this.pos >= this.end) {
|
||||
this.error(DiagnosticCode.Unexpected_end_of_text, this.range(start, this.end));
|
||||
this.error(
|
||||
DiagnosticCode.Unexpected_end_of_text,
|
||||
this.range(start, this.end)
|
||||
);
|
||||
invalid = true;
|
||||
} else if (text.charCodeAt(this.pos) == CharCode.CLOSEBRACE) {
|
||||
++this.pos;
|
||||
} else {
|
||||
this.error(DiagnosticCode.Unterminated_Unicode_escape_sequence, this.range(start, this.pos));
|
||||
this.error(
|
||||
DiagnosticCode.Unterminated_Unicode_escape_sequence,
|
||||
this.range(start, this.pos)
|
||||
);
|
||||
invalid = true;
|
||||
}
|
||||
|
||||
if (invalid)
|
||||
return "";
|
||||
if (invalid) return "";
|
||||
return value32 < 65536
|
||||
? String.fromCharCode(value32)
|
||||
: String.fromCharCode((((value32 - 65536) / 1024 | 0) + 0xD800) as i32, ((value32 - 65536) % 1024 + 0xDC00) as i32);
|
||||
: String.fromCharCode(
|
||||
(((value32 - 65536) / 1024 | 0) + 0xD800) as i32,
|
||||
( (value32 - 65536) % 1024 + 0xDC00) as i32
|
||||
);
|
||||
}
|
||||
|
||||
finish(): void {
|
||||
}
|
||||
}
|
||||
|
30
src/types.ts
30
src/types.ts
@ -1,7 +1,3 @@
|
||||
import {
|
||||
Target
|
||||
} from "./compiler";
|
||||
|
||||
import {
|
||||
Class,
|
||||
Function
|
||||
@ -158,9 +154,11 @@ export class Type {
|
||||
case TypeKind.U64: return "u64";
|
||||
case TypeKind.USIZE:
|
||||
if (kindOnly) return "usize";
|
||||
return this.classType ? this.classType.toString()
|
||||
: this.functionType ? this.functionType.toTypeString()
|
||||
: "usize";
|
||||
return this.classType
|
||||
? this.classType.toString()
|
||||
: this.functionType
|
||||
? this.functionType.toTypeString()
|
||||
: "usize";
|
||||
case TypeKind.BOOL: return "bool";
|
||||
case TypeKind.F32: return "f32";
|
||||
case TypeKind.F64: return "f64";
|
||||
@ -209,8 +207,7 @@ export class Type {
|
||||
|
||||
case TypeKind.ISIZE:
|
||||
case TypeKind.USIZE:
|
||||
if (this.size != 64)
|
||||
return module.createI32(0);
|
||||
if (this.size != 64) return module.createI32(0);
|
||||
// fall-through
|
||||
|
||||
case TypeKind.I64:
|
||||
@ -237,8 +234,7 @@ export class Type {
|
||||
|
||||
case TypeKind.ISIZE:
|
||||
case TypeKind.USIZE:
|
||||
if (this.size != 64)
|
||||
return module.createI32(1);
|
||||
if (this.size != 64) return module.createI32(1);
|
||||
// fall-through
|
||||
|
||||
case TypeKind.I64:
|
||||
@ -265,8 +261,7 @@ export class Type {
|
||||
|
||||
case TypeKind.ISIZE:
|
||||
case TypeKind.USIZE:
|
||||
if (this.size != 64)
|
||||
return module.createI32(-1);
|
||||
if (this.size != 64) return module.createI32(-1);
|
||||
// fall-through
|
||||
|
||||
case TypeKind.I64:
|
||||
@ -436,18 +431,19 @@ export class Type {
|
||||
export function typesToNativeTypes(types: Type[]): NativeType[] {
|
||||
var k = types.length;
|
||||
var ret = new Array<NativeType>(k);
|
||||
for (var i = 0; i < k; ++i)
|
||||
for (var i = 0; i < k; ++i) {
|
||||
ret[i] = types[i].toNativeType();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Converts an array of types to its combined string representation. */
|
||||
export function typesToString(types: Type[]): string {
|
||||
var k = types.length;
|
||||
if (!k)
|
||||
return "";
|
||||
if (!k) return "";
|
||||
var sb = new Array<string>(k);
|
||||
for (var i = 0; i < k; ++i)
|
||||
for (var i = 0; i < k; ++i) {
|
||||
sb[i] = types[i].toString();
|
||||
}
|
||||
return sb.join(", ");
|
||||
}
|
||||
|
@ -338,8 +338,7 @@ const unicodeIdentifierPart: u16[] = [
|
||||
];
|
||||
|
||||
function lookupInUnicodeMap(code: u16, map: u16[]): bool {
|
||||
if (code < map[0])
|
||||
return false;
|
||||
if (code < map[0]) return false;
|
||||
|
||||
var lo = 0;
|
||||
var hi = map.length;
|
||||
@ -348,12 +347,14 @@ function lookupInUnicodeMap(code: u16, map: u16[]): bool {
|
||||
while (lo + 1 < hi) {
|
||||
mid = lo + (hi - lo) / 2;
|
||||
mid -= mid % 2;
|
||||
if (map[mid] <= code && code <= map[mid + 1])
|
||||
if (map[mid] <= code && code <= map[mid + 1]) {
|
||||
return true;
|
||||
if (code < map[mid])
|
||||
}
|
||||
if (code < map[mid]) {
|
||||
hi = mid;
|
||||
else
|
||||
} else {
|
||||
lo = mid + 2;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -93,8 +93,9 @@ export function normalize(path: string): string {
|
||||
|
||||
/** Resolves the specified path relative to the specified origin. */
|
||||
export function resolve(normalizedPath: string, origin: string): string {
|
||||
if (normalizedPath.startsWith("std/"))
|
||||
if (normalizedPath.startsWith("std/")) {
|
||||
return normalizedPath;
|
||||
}
|
||||
return normalize(
|
||||
dirname(origin) + String.fromCharCode(separator) + normalizedPath
|
||||
);
|
||||
@ -103,8 +104,10 @@ export function resolve(normalizedPath: string, origin: string): string {
|
||||
/** Obtains the directory portion of a normalized path. */
|
||||
export function dirname(normalizedPath: string): string {
|
||||
var pos = normalizedPath.length;
|
||||
while (--pos > 0)
|
||||
if (normalizedPath.charCodeAt(pos) == separator)
|
||||
while (--pos > 0) {
|
||||
if (normalizedPath.charCodeAt(pos) == separator) {
|
||||
return normalizedPath.substring(0, pos);
|
||||
}
|
||||
}
|
||||
return ".";
|
||||
}
|
||||
|
@ -459,9 +459,11 @@ export function allocate_memory(size: usize): usize {
|
||||
|
||||
// request more memory
|
||||
var pagesBefore = current_memory();
|
||||
var pagesWanted = max(pagesBefore, ((size + 0xffff) & ~0xffff) >>> 16);
|
||||
var pagesNeeded = ((size + 0xffff) & ~0xffff) >>> 16;
|
||||
var pagesWanted = max(pagesBefore, pagesNeeded); // double memory
|
||||
if (grow_memory(pagesWanted) < 0)
|
||||
unreachable(); // out of memory
|
||||
if (grow_memory(pagesNeeded) < 0)
|
||||
unreachable(); // out of memory
|
||||
var pagesAfter = current_memory();
|
||||
root.addMemory(<usize>pagesBefore << 16, <usize>pagesAfter << 16);
|
||||
block = assert(root.search(size)); // must be found now
|
||||
|
@ -6,42 +6,49 @@ Object.defineProperties(
|
||||
"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 }
|
||||
});
|
||||
|
||||
Object.defineProperties(
|
||||
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 }
|
||||
});
|
||||
|
||||
Object.defineProperties(
|
||||
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 }
|
||||
});
|
||||
|
||||
Object.defineProperties(
|
||||
globalScope["bool"] = function bool(value) { return !!value; }
|
||||
, {
|
||||
"MIN_VALUE": { value: 0, writable: false },
|
||||
"MAX_VALUE": { value: 1, writable: false }
|
||||
});
|
||||
|
||||
Object.defineProperties(
|
||||
globalScope["f32"] = function f32(value) { return Math.fround(value); }
|
||||
, {
|
||||
@ -51,6 +58,7 @@ Object.defineProperties(
|
||||
"MAX_SAFE_INTEGER": { value: 16777215, writable: false },
|
||||
"EPSILON": { value: Math.fround(1.19209290e-07), writable: false }
|
||||
});
|
||||
|
||||
Object.defineProperties(
|
||||
globalScope["f64"] = function f64(value) { return +value; }
|
||||
, {
|
||||
@ -62,13 +70,23 @@ Object.defineProperties(
|
||||
});
|
||||
|
||||
globalScope["clz"] = Math.clz32;
|
||||
|
||||
globalScope["abs"] = Math.abs;
|
||||
|
||||
globalScope["max"] = Math.max;
|
||||
|
||||
globalScope["min"] = Math.min;
|
||||
|
||||
globalScope["ceil"] = Math.ceil;
|
||||
|
||||
globalScope["floor"] = Math.floor;
|
||||
globalScope["select"] = function select(ifTrue, ifFalse, condition) { return condition ? ifTrue : ifFalse; };
|
||||
|
||||
globalScope["select"] = function select(ifTrue, ifFalse, condition) {
|
||||
return condition ? ifTrue : ifFalse;
|
||||
};
|
||||
|
||||
globalScope["sqrt"] = Math.sqrt;
|
||||
|
||||
globalScope["trunc"] = Math.trunc;
|
||||
|
||||
globalScope["bswap"] = function bswap(value) {
|
||||
@ -78,40 +96,54 @@ globalScope["bswap"] = function bswap(value) {
|
||||
a = value >> 16 & 0x0000FFFF;
|
||||
b = (value & 0x0000FFFF) << 16;
|
||||
return a | b;
|
||||
}
|
||||
};
|
||||
|
||||
globalScope["bswap16"] = function bswap16(value) {
|
||||
return ((value << 8) & 0xFF00) | ((value >> 8) & 0x00FF) | (value & 0xFFFF0000);
|
||||
}
|
||||
};
|
||||
|
||||
function UnreachableError() {
|
||||
if (Error.captureStackTrace)
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, UnreachableError);
|
||||
else
|
||||
} else {
|
||||
this.stack = this.name + ": " + this.message + "\n" + new Error().stack;
|
||||
}
|
||||
}
|
||||
UnreachableError.prototype = Object.create(Error.prototype);
|
||||
UnreachableError.prototype.name = "UnreachableError";
|
||||
UnreachableError.prototype.message = "unreachable";
|
||||
|
||||
globalScope["unreachable"] = function unreachable() { throw new UnreachableError(); };
|
||||
globalScope["unreachable"] = function unreachable() {
|
||||
throw new UnreachableError();
|
||||
};
|
||||
|
||||
function AssertionError(message) {
|
||||
this.message = message || "assertion failed";
|
||||
if (Error.captureStackTrace)
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, AssertionError);
|
||||
else
|
||||
} else {
|
||||
this.stack = this.name + ": " + this.message + "\n" + new Error().stack;
|
||||
}
|
||||
}
|
||||
AssertionError.prototype = Object.create(Error.prototype);
|
||||
AssertionError.prototype.name = "AssertionError";
|
||||
|
||||
globalScope["assert"] = function assert(isTrueish, message) { if (isTrueish) return isTrueish; throw new AssertionError(message); };
|
||||
globalScope["changetype"] = function changetype(value) { return value; }
|
||||
globalScope["assert"] = function assert(isTrueish, message) {
|
||||
if (isTrueish) return isTrueish;
|
||||
throw new AssertionError(message);
|
||||
};
|
||||
|
||||
String["fromCharCodes"] = function fromCharCodes(arr) { return String.fromCharCode.apply(String, arr); }
|
||||
String["fromCodePoints"] = function fromCodePoints(arr) { return String.fromCodePoint.apply(String, arr); }
|
||||
globalScope["changetype"] = function changetype(value) {
|
||||
return value;
|
||||
};
|
||||
|
||||
globalScope["parseI32"] = function parseI32(str, radix) {
|
||||
return parseInt(str) | 0;
|
||||
return parseInt(str, undefined) | 0;
|
||||
};
|
||||
|
||||
String["fromCharCodes"] = function fromCharCodes(arr) {
|
||||
return String.fromCharCode.apply(String, arr);
|
||||
};
|
||||
String["fromCodePoints"] = function fromCodePoints(arr) {
|
||||
return String.fromCodePoint.apply(String, arr);
|
||||
};
|
||||
|
@ -1,3 +1,3 @@
|
||||
import "./buddy";
|
||||
export { allocate_memory, free_memory };
|
||||
export { set_memory };
|
||||
// export { set_memory };
|
||||
|
@ -3,7 +3,6 @@
|
||||
(type $iv (func (param i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(global $assembly/buddy/BUCKETS_START (mut i32) (i32.const 0))
|
||||
(global $assembly/buddy/BUCKETS_END (mut i32) (i32.const 0))
|
||||
@ -16,7 +15,6 @@
|
||||
(memory $0 1)
|
||||
(export "allocate_memory" (func $assembly/buddy/allocate_memory))
|
||||
(export "free_memory" (func $assembly/buddy/free_memory))
|
||||
(export "set_memory" (func "$(lib)/memory/set_memory"))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $assembly/buddy/update_max_ptr (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -1084,505 +1082,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func "$(lib)/memory/set_memory" (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i64)
|
||||
(local $4 i32)
|
||||
;;@ (lib)/memory.ts:196:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:196:6
|
||||
(i32.eqz
|
||||
;;@ (lib)/memory.ts:196:7
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:197:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:198:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:198:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:198:18
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:199:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:199:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:23
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:200:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:200:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:200:11
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:201:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:203:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:203:19
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:204:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:204:19
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:205:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:205:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:23
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:206:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:206:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:23
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:207:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:207:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:207:11
|
||||
(i32.const 6)
|
||||
)
|
||||
;;@ (lib)/memory.ts:208:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:209:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:209:19
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:210:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:210:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:23
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:211:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:211:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:211:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:212:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:223:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:216:2
|
||||
(tee_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:215:2
|
||||
(tee_local $4
|
||||
;;@ (lib)/memory.ts:215:17
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(i32.const 0)
|
||||
;;@ (lib)/memory.ts:215:18
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ (lib)/memory.ts:215:25
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:220:2
|
||||
(tee_local $1
|
||||
;;@ (lib)/memory.ts:220:17
|
||||
(i32.mul
|
||||
;;@ (lib)/memory.ts:220:33
|
||||
(get_local $1)
|
||||
(i32.const 16843009)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:224:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:218:2
|
||||
(tee_local $2
|
||||
(i32.and
|
||||
(i32.sub
|
||||
;;@ (lib)/memory.ts:217:2
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:217:7
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:218:7
|
||||
(i32.const -4)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:24
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:27
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:225:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:225:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:225:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:226:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:227:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:227:20
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:23
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:228:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:228:20
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:23
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:229:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:229:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:24
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:230:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:230:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:24
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:27
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:231:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:231:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:231:11
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:232:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:233:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:233:20
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:234:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:234:20
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:235:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:235:20
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:236:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:236:20
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:237:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:237:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:24
|
||||
(i32.const 28)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:238:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:238:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:24
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:239:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:239:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:24
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:240:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:240:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:24
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:244:2
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:243:2
|
||||
(tee_local $4
|
||||
;;@ (lib)/memory.ts:243:6
|
||||
(i32.add
|
||||
;;@ (lib)/memory.ts:243:11
|
||||
(i32.and
|
||||
;;@ (lib)/memory.ts:243:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:243:19
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:243:6
|
||||
(i32.const 24)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:245:2
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:245:7
|
||||
(get_local $4)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:2
|
||||
(set_local $3
|
||||
;;@ (lib)/memory.ts:248:17
|
||||
(i64.or
|
||||
(i64.extend_u/i32
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:28
|
||||
(i64.shl
|
||||
;;@ (lib)/memory.ts:248:29
|
||||
(i64.extend_u/i32
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:41
|
||||
(i64.const 32)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ (lib)/memory.ts:249:9
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:249:14
|
||||
(i32.const 32)
|
||||
)
|
||||
(block
|
||||
;;@ (lib)/memory.ts:250:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:250:15
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:250:21
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:251:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:251:22
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:25
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:252:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:252:22
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:26
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:253:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:253:22
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:26
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:254:4
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:254:9
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:255:4
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:255:12
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 16 ;) (type $v)
|
||||
(func $start (; 15 ;) (type $v)
|
||||
(set_global $assembly/buddy/BUCKETS_START
|
||||
;;@ assembly/buddy.ts:92:27
|
||||
(get_global $HEAP_BASE)
|
||||
|
@ -5,7 +5,6 @@
|
||||
(type $iv (func (param i32)))
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
|
||||
(global $assembly/buddy/HEADER_SIZE i32 (i32.const 8))
|
||||
@ -27,7 +26,6 @@
|
||||
(data (i32.const 4) "\11\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00b\00u\00d\00d\00y\00.\00t\00s\00")
|
||||
(export "allocate_memory" (func $assembly/buddy/allocate_memory))
|
||||
(export "free_memory" (func $assembly/buddy/free_memory))
|
||||
(export "set_memory" (func "$(lib)/memory/set_memory"))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $assembly/buddy/update_max_ptr (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
@ -1334,527 +1332,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func "$(lib)/memory/set_memory" (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
;;@ (lib)/memory.ts:196:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:196:6
|
||||
(i32.eqz
|
||||
;;@ (lib)/memory.ts:196:7
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:197:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:198:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:198:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:198:18
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:199:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:199:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:23
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:200:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:200:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:200:11
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:201:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:203:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:203:19
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:204:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:204:19
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:205:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:205:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:23
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:206:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:206:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:23
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:207:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:207:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:207:11
|
||||
(i32.const 6)
|
||||
)
|
||||
;;@ (lib)/memory.ts:208:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:209:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:209:19
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:210:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:210:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:23
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:211:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:211:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:211:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:212:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:215:2
|
||||
(set_local $3
|
||||
;;@ (lib)/memory.ts:215:17
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(i32.const 0)
|
||||
;;@ (lib)/memory.ts:215:18
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ (lib)/memory.ts:215:25
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:216:2
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:216:10
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:217:2
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:217:7
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:218:2
|
||||
(set_local $2
|
||||
(i32.and
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:218:7
|
||||
(i32.const -4)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:220:2
|
||||
(set_local $4
|
||||
;;@ (lib)/memory.ts:220:17
|
||||
(i32.mul
|
||||
(i32.div_u
|
||||
(i32.const -1)
|
||||
;;@ (lib)/memory.ts:220:27
|
||||
(i32.const 255)
|
||||
)
|
||||
;;@ (lib)/memory.ts:220:33
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:223:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:223:13
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:223:19
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:224:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:224:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:24
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:27
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:225:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:225:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:225:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:226:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:227:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:227:20
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:23
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:228:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:228:20
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:23
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:229:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:229:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:24
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:230:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:230:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:24
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:27
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:231:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:231:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:231:11
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:232:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:233:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:233:20
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:234:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:234:20
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:235:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:235:20
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:236:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:236:20
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:237:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:237:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:24
|
||||
(i32.const 28)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:238:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:238:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:24
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:239:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:239:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:24
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:240:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:240:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:24
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:243:2
|
||||
(set_local $3
|
||||
;;@ (lib)/memory.ts:243:6
|
||||
(i32.add
|
||||
(i32.const 24)
|
||||
;;@ (lib)/memory.ts:243:11
|
||||
(i32.and
|
||||
;;@ (lib)/memory.ts:243:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:243:19
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:244:2
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:244:10
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:245:2
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:245:7
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:2
|
||||
(set_local $5
|
||||
;;@ (lib)/memory.ts:248:17
|
||||
(i64.or
|
||||
(i64.extend_u/i32
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:28
|
||||
(i64.shl
|
||||
;;@ (lib)/memory.ts:248:29
|
||||
(i64.extend_u/i32
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:41
|
||||
(i64.const 32)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:249:2
|
||||
(block $break|0
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ (lib)/memory.ts:249:9
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:249:14
|
||||
(i32.const 32)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
;;@ (lib)/memory.ts:250:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:250:15
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:250:21
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:251:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:251:22
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:25
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:252:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:252:22
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:26
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:253:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:253:22
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:26
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:254:4
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:254:9
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:255:4
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:255:12
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 18 ;) (type $v)
|
||||
(func $start (; 17 ;) (type $v)
|
||||
(set_global $assembly/buddy/BUCKETS_START
|
||||
;;@ assembly/buddy.ts:92:27
|
||||
(get_global $HEAP_BASE)
|
||||
|
@ -38,11 +38,20 @@ function runner(allocator, runs, allocs) {
|
||||
var currentMem = allocator.memory.buffer.byteLength;
|
||||
console.log("mem initial: " + currentMem);
|
||||
|
||||
function testMemChanged() {
|
||||
var actualMem = allocator.memory.buffer.byteLength;
|
||||
if (actualMem > currentMem) {
|
||||
console.log("mem changed: " + currentMem + " -> " + actualMem);
|
||||
currentMem = actualMem;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
for (var j = 0; j < runs; ++j) {
|
||||
console.log("run " + (j + 1) + " (" + allocs + " allocations) ...");
|
||||
for (var i = 0; i < allocs; ++i) {
|
||||
var ptr = randomAlloc();
|
||||
testMemChanged();
|
||||
|
||||
// immediately free every 4th
|
||||
if (!(i % 4)) preciseFree(ptr);
|
||||
@ -65,10 +74,7 @@ function runner(allocator, runs, allocs) {
|
||||
if (ptr !== base)
|
||||
throw Error("expected " + base + " but got " + ptr);
|
||||
allocator.free_memory(ptr);
|
||||
if (allocator.memory.buffer.byteLength > currentMem) {
|
||||
currentMem = allocator.memory.buffer.byteLength;
|
||||
console.log("mem changed: " + currentMem);
|
||||
}
|
||||
testMemChanged();
|
||||
}
|
||||
} finally {
|
||||
// mem(allocator.memory, 0, 0x10000);
|
||||
|
@ -1,3 +1,3 @@
|
||||
import "allocator/tlsf";
|
||||
export { allocate_memory, free_memory };
|
||||
export { set_memory };
|
||||
// export { set_memory };
|
||||
|
@ -12,7 +12,6 @@
|
||||
(memory $0 1)
|
||||
(export "allocate_memory" (func "$(lib)/allocator/tlsf/allocate_memory"))
|
||||
(export "free_memory" (func "$(lib)/allocator/tlsf/free_memory"))
|
||||
(export "set_memory" (func "$(lib)/memory/set_memory"))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func "$(lib)/allocator/tlsf/Root#set:tailRef" (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
@ -31,10 +30,10 @@
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:139:41
|
||||
(i32.mul
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:139:46
|
||||
(i32.const 4)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:139:49
|
||||
@ -48,19 +47,19 @@
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:164:32
|
||||
(i32.mul
|
||||
(i32.shl
|
||||
(i32.add
|
||||
;;@ (lib)/allocator/tlsf.ts:164:33
|
||||
(i32.mul
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:164:38
|
||||
(i32.const 32)
|
||||
(i32.const 5)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:164:48
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:164:61
|
||||
(i32.const 4)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:165:6
|
||||
@ -104,19 +103,19 @@
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:155:32
|
||||
(i32.mul
|
||||
(i32.shl
|
||||
(i32.add
|
||||
;;@ (lib)/allocator/tlsf.ts:155:33
|
||||
(i32.mul
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:155:38
|
||||
(i32.const 32)
|
||||
(i32.const 5)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:155:48
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:155:61
|
||||
(i32.const 4)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -128,10 +127,10 @@
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:133:47
|
||||
(i32.mul
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:133:52
|
||||
(i32.const 4)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -1094,6 +1093,7 @@
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
;;@ (lib)/allocator/tlsf.ts:439:2
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:439:6
|
||||
@ -1286,12 +1286,12 @@
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:458:16
|
||||
(block
|
||||
;;@ (lib)/allocator/tlsf.ts:463:6
|
||||
;;@ (lib)/allocator/tlsf.ts:464:6
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:463:10
|
||||
;;@ (lib)/allocator/tlsf.ts:464:10
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
;;@ (lib)/allocator/tlsf.ts:462:24
|
||||
;;@ (lib)/allocator/tlsf.ts:463:24
|
||||
(select
|
||||
(tee_local $1
|
||||
;;@ (lib)/allocator/tlsf.ts:461:6
|
||||
@ -1301,20 +1301,23 @@
|
||||
)
|
||||
)
|
||||
(tee_local $3
|
||||
;;@ (lib)/allocator/tlsf.ts:462:41
|
||||
(i32.shr_u
|
||||
(i32.and
|
||||
;;@ (lib)/allocator/tlsf.ts:462:42
|
||||
(i32.add
|
||||
;;@ (lib)/allocator/tlsf.ts:462:43
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:50
|
||||
(i32.const 65535)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:6
|
||||
(tee_local $5
|
||||
;;@ (lib)/allocator/tlsf.ts:462:24
|
||||
(i32.shr_u
|
||||
(i32.and
|
||||
;;@ (lib)/allocator/tlsf.ts:462:25
|
||||
(i32.add
|
||||
;;@ (lib)/allocator/tlsf.ts:462:26
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:33
|
||||
(i32.const 65535)
|
||||
)
|
||||
(i32.const -65536)
|
||||
)
|
||||
(i32.const -65536)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:56
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:73
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
(i32.gt_s
|
||||
@ -1323,108 +1326,120 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:463:37
|
||||
;;@ (lib)/allocator/tlsf.ts:464:37
|
||||
(i32.const 0)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:464:8
|
||||
(unreachable)
|
||||
;;@ (lib)/allocator/tlsf.ts:465:8
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:465:12
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
;;@ (lib)/allocator/tlsf.ts:465:24
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:465:39
|
||||
(i32.const 0)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:10
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:11
|
||||
;;@ (lib)/allocator/tlsf.ts:468:11
|
||||
(drop
|
||||
(call "$(lib)/allocator/tlsf/Root#addMemory"
|
||||
;;@ (lib)/allocator/tlsf.ts:466:6
|
||||
;;@ (lib)/allocator/tlsf.ts:468:6
|
||||
(get_local $2)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:21
|
||||
;;@ (lib)/allocator/tlsf.ts:468:21
|
||||
(i32.shl
|
||||
(get_local $4)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:43
|
||||
;;@ (lib)/allocator/tlsf.ts:468:43
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:47
|
||||
;;@ (lib)/allocator/tlsf.ts:468:47
|
||||
(i32.shl
|
||||
;;@ (lib)/allocator/tlsf.ts:465:23
|
||||
;;@ (lib)/allocator/tlsf.ts:467:23
|
||||
(current_memory)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:68
|
||||
;;@ (lib)/allocator/tlsf.ts:468:68
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:467:6
|
||||
;;@ (lib)/allocator/tlsf.ts:469:6
|
||||
(set_local $1
|
||||
;;@ (lib)/allocator/tlsf.ts:467:14
|
||||
;;@ (lib)/allocator/tlsf.ts:469:14
|
||||
(call "$(lib)/allocator/tlsf/Root#search"
|
||||
;;@ (lib)/allocator/tlsf.ts:467:21
|
||||
;;@ (lib)/allocator/tlsf.ts:469:21
|
||||
(get_local $2)
|
||||
;;@ (lib)/allocator/tlsf.ts:467:33
|
||||
;;@ (lib)/allocator/tlsf.ts:469:33
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:471:4
|
||||
;;@ (lib)/allocator/tlsf.ts:473:4
|
||||
(set_local $1
|
||||
;;@ (lib)/allocator/tlsf.ts:471:16
|
||||
;;@ (lib)/allocator/tlsf.ts:473:16
|
||||
(call "$(lib)/allocator/tlsf/Root#use"
|
||||
;;@ (lib)/allocator/tlsf.ts:471:11
|
||||
;;@ (lib)/allocator/tlsf.ts:473:11
|
||||
(get_local $2)
|
||||
;;@ (lib)/allocator/tlsf.ts:471:20
|
||||
;;@ (lib)/allocator/tlsf.ts:473:20
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:471:27
|
||||
;;@ (lib)/allocator/tlsf.ts:473:27
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:474:9
|
||||
;;@ (lib)/allocator/tlsf.ts:476:9
|
||||
(get_local $1)
|
||||
)
|
||||
(func "$(lib)/allocator/tlsf/free_memory" (; 13 ;) (type $iv) (param $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
;;@ (lib)/allocator/tlsf.ts:480:2
|
||||
;;@ (lib)/allocator/tlsf.ts:482:2
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:480:6
|
||||
;;@ (lib)/allocator/tlsf.ts:482:6
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:482:4
|
||||
;;@ (lib)/allocator/tlsf.ts:484:4
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:481:4
|
||||
;;@ (lib)/allocator/tlsf.ts:483:4
|
||||
(tee_local $1
|
||||
;;@ (lib)/allocator/tlsf.ts:481:15
|
||||
;;@ (lib)/allocator/tlsf.ts:483:15
|
||||
(get_global "$(lib)/allocator/tlsf/ROOT")
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:482:14
|
||||
;;@ (lib)/allocator/tlsf.ts:484:14
|
||||
(block
|
||||
;;@ (lib)/allocator/tlsf.ts:486:6
|
||||
;;@ (lib)/allocator/tlsf.ts:488:6
|
||||
(i32.store
|
||||
;;@ (lib)/allocator/tlsf.ts:483:6
|
||||
;;@ (lib)/allocator/tlsf.ts:485:6
|
||||
(tee_local $2
|
||||
;;@ (lib)/allocator/tlsf.ts:483:18
|
||||
;;@ (lib)/allocator/tlsf.ts:485:18
|
||||
(i32.sub
|
||||
;;@ (lib)/allocator/tlsf.ts:483:36
|
||||
;;@ (lib)/allocator/tlsf.ts:485:36
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:483:43
|
||||
;;@ (lib)/allocator/tlsf.ts:485:43
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:486:19
|
||||
;;@ (lib)/allocator/tlsf.ts:488:19
|
||||
(i32.or
|
||||
;;@ (lib)/allocator/tlsf.ts:484:22
|
||||
;;@ (lib)/allocator/tlsf.ts:486:22
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:486:31
|
||||
;;@ (lib)/allocator/tlsf.ts:488:31
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:487:11
|
||||
;;@ (lib)/allocator/tlsf.ts:489:11
|
||||
(call "$(lib)/allocator/tlsf/Root#insert"
|
||||
;;@ (lib)/allocator/tlsf.ts:487:6
|
||||
;;@ (lib)/allocator/tlsf.ts:489:6
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:487:18
|
||||
;;@ (lib)/allocator/tlsf.ts:489:18
|
||||
(i32.sub
|
||||
;;@ (lib)/allocator/tlsf.ts:487:36
|
||||
;;@ (lib)/allocator/tlsf.ts:489:36
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:487:43
|
||||
;;@ (lib)/allocator/tlsf.ts:489:43
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -1432,505 +1447,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func "$(lib)/memory/set_memory" (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i64)
|
||||
(local $4 i32)
|
||||
;;@ (lib)/memory.ts:196:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:196:6
|
||||
(i32.eqz
|
||||
;;@ (lib)/memory.ts:196:7
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:197:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:198:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:198:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:198:18
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:199:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:199:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:23
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:200:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:200:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:200:11
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:201:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:203:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:203:19
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:204:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:204:19
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:205:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:205:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:23
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:206:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:206:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:23
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:207:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:207:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:207:11
|
||||
(i32.const 6)
|
||||
)
|
||||
;;@ (lib)/memory.ts:208:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:209:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:209:19
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:210:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:210:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:23
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:211:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:211:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:211:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:212:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:223:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:216:2
|
||||
(tee_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:215:2
|
||||
(tee_local $4
|
||||
;;@ (lib)/memory.ts:215:17
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(i32.const 0)
|
||||
;;@ (lib)/memory.ts:215:18
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ (lib)/memory.ts:215:25
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:220:2
|
||||
(tee_local $1
|
||||
;;@ (lib)/memory.ts:220:17
|
||||
(i32.mul
|
||||
;;@ (lib)/memory.ts:220:33
|
||||
(get_local $1)
|
||||
(i32.const 16843009)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:224:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:218:2
|
||||
(tee_local $2
|
||||
(i32.and
|
||||
(i32.sub
|
||||
;;@ (lib)/memory.ts:217:2
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:217:7
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:218:7
|
||||
(i32.const -4)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:24
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:27
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:225:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:225:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:225:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:226:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:227:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:227:20
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:23
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:228:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:228:20
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:23
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:229:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:229:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:24
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:230:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:230:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:24
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:27
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:231:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:231:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:231:11
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:232:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:233:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:233:20
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:234:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:234:20
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:235:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:235:20
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:236:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:236:20
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:24
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:237:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:237:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:24
|
||||
(i32.const 28)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:238:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:238:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:24
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:239:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:239:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:24
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:240:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:240:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:24
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:28
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:244:2
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:243:2
|
||||
(tee_local $4
|
||||
;;@ (lib)/memory.ts:243:6
|
||||
(i32.add
|
||||
;;@ (lib)/memory.ts:243:11
|
||||
(i32.and
|
||||
;;@ (lib)/memory.ts:243:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:243:19
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:243:6
|
||||
(i32.const 24)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:245:2
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:245:7
|
||||
(get_local $4)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:2
|
||||
(set_local $3
|
||||
;;@ (lib)/memory.ts:248:17
|
||||
(i64.or
|
||||
(i64.extend_u/i32
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:28
|
||||
(i64.shl
|
||||
;;@ (lib)/memory.ts:248:29
|
||||
(i64.extend_u/i32
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:41
|
||||
(i64.const 32)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ (lib)/memory.ts:249:9
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:249:14
|
||||
(i32.const 32)
|
||||
)
|
||||
(block
|
||||
;;@ (lib)/memory.ts:250:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:250:15
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:250:21
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:251:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:251:22
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:25
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:252:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:252:22
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:26
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:253:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:253:22
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:26
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:254:4
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:254:9
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:255:4
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:255:12
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 15 ;) (type $v)
|
||||
(func $start (; 14 ;) (type $v)
|
||||
(nop)
|
||||
)
|
||||
)
|
||||
|
@ -27,7 +27,6 @@
|
||||
(data (i32.const 4) "\17\00\00\00(\00l\00i\00b\00)\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00")
|
||||
(export "allocate_memory" (func "$(lib)/allocator/tlsf/allocate_memory"))
|
||||
(export "free_memory" (func "$(lib)/allocator/tlsf/free_memory"))
|
||||
(export "set_memory" (func "$(lib)/memory/set_memory"))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func "$(lib)/allocator/tlsf/Root#set:tailRef" (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
@ -2259,6 +2258,7 @@
|
||||
(local $9 i32)
|
||||
(local $10 i32)
|
||||
(local $11 i32)
|
||||
(local $12 i32)
|
||||
;;@ (lib)/allocator/tlsf.ts:438:2
|
||||
(set_local $1
|
||||
;;@ (lib)/allocator/tlsf.ts:438:13
|
||||
@ -2493,32 +2493,37 @@
|
||||
;;@ (lib)/allocator/tlsf.ts:462:6
|
||||
(set_local $10
|
||||
;;@ (lib)/allocator/tlsf.ts:462:24
|
||||
(i32.shr_u
|
||||
(i32.and
|
||||
;;@ (lib)/allocator/tlsf.ts:462:25
|
||||
(i32.add
|
||||
;;@ (lib)/allocator/tlsf.ts:462:26
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:33
|
||||
(i32.const 65535)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:43
|
||||
(i32.xor
|
||||
;;@ (lib)/allocator/tlsf.ts:462:44
|
||||
(i32.const 65535)
|
||||
(i32.const -1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:56
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:463:6
|
||||
(set_local $11
|
||||
;;@ (lib)/allocator/tlsf.ts:463:24
|
||||
(select
|
||||
(tee_local $6
|
||||
;;@ (lib)/allocator/tlsf.ts:462:28
|
||||
;;@ (lib)/allocator/tlsf.ts:463:28
|
||||
(get_local $9)
|
||||
)
|
||||
(tee_local $7
|
||||
;;@ (lib)/allocator/tlsf.ts:462:41
|
||||
(i32.shr_u
|
||||
(i32.and
|
||||
;;@ (lib)/allocator/tlsf.ts:462:42
|
||||
(i32.add
|
||||
;;@ (lib)/allocator/tlsf.ts:462:43
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:50
|
||||
(i32.const 65535)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:60
|
||||
(i32.xor
|
||||
;;@ (lib)/allocator/tlsf.ts:462:61
|
||||
(i32.const 65535)
|
||||
(i32.const -1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:462:73
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:463:41
|
||||
(get_local $10)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $6)
|
||||
@ -2526,55 +2531,67 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:463:6
|
||||
;;@ (lib)/allocator/tlsf.ts:464:6
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:463:10
|
||||
;;@ (lib)/allocator/tlsf.ts:464:10
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
;;@ (lib)/allocator/tlsf.ts:463:22
|
||||
(get_local $10)
|
||||
;;@ (lib)/allocator/tlsf.ts:464:22
|
||||
(get_local $11)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:463:37
|
||||
;;@ (lib)/allocator/tlsf.ts:464:37
|
||||
(i32.const 0)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:464:8
|
||||
(unreachable)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:465:6
|
||||
(set_local $11
|
||||
;;@ (lib)/allocator/tlsf.ts:465:23
|
||||
(current_memory)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:11
|
||||
(drop
|
||||
(call "$(lib)/allocator/tlsf/Root#addMemory"
|
||||
;;@ (lib)/allocator/tlsf.ts:466:6
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:21
|
||||
(i32.shl
|
||||
(get_local $9)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:43
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:47
|
||||
(i32.shl
|
||||
(get_local $11)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:68
|
||||
(i32.const 16)
|
||||
;;@ (lib)/allocator/tlsf.ts:465:8
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:465:12
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
;;@ (lib)/allocator/tlsf.ts:465:24
|
||||
(get_local $10)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:465:39
|
||||
(i32.const 0)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:466:10
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:467:6
|
||||
(set_local $12
|
||||
;;@ (lib)/allocator/tlsf.ts:467:23
|
||||
(current_memory)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:468:11
|
||||
(drop
|
||||
(call "$(lib)/allocator/tlsf/Root#addMemory"
|
||||
;;@ (lib)/allocator/tlsf.ts:468:6
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:468:21
|
||||
(i32.shl
|
||||
(get_local $9)
|
||||
;;@ (lib)/allocator/tlsf.ts:468:43
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:468:47
|
||||
(i32.shl
|
||||
(get_local $12)
|
||||
;;@ (lib)/allocator/tlsf.ts:468:68
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:469:6
|
||||
(set_local $8
|
||||
;;@ (lib)/allocator/tlsf.ts:467:14
|
||||
;;@ (lib)/allocator/tlsf.ts:469:14
|
||||
(if (result i32)
|
||||
(i32.eqz
|
||||
(tee_local $6
|
||||
;;@ (lib)/allocator/tlsf.ts:467:26
|
||||
;;@ (lib)/allocator/tlsf.ts:469:26
|
||||
(call "$(lib)/allocator/tlsf/Root#search"
|
||||
;;@ (lib)/allocator/tlsf.ts:467:21
|
||||
;;@ (lib)/allocator/tlsf.ts:469:21
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:467:33
|
||||
;;@ (lib)/allocator/tlsf.ts:469:33
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
@ -2583,7 +2600,7 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 467)
|
||||
(i32.const 469)
|
||||
(i32.const 14)
|
||||
)
|
||||
(unreachable)
|
||||
@ -2593,24 +2610,24 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:470:4
|
||||
;;@ (lib)/allocator/tlsf.ts:472:4
|
||||
(if
|
||||
(i32.eqz
|
||||
;;@ (lib)/allocator/tlsf.ts:470:11
|
||||
;;@ (lib)/allocator/tlsf.ts:472:11
|
||||
(i32.ge_u
|
||||
(i32.and
|
||||
;;@ (lib)/allocator/tlsf.ts:470:12
|
||||
;;@ (lib)/allocator/tlsf.ts:472:12
|
||||
(i32.load
|
||||
(get_local $8)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:470:25
|
||||
;;@ (lib)/allocator/tlsf.ts:472:25
|
||||
(i32.xor
|
||||
;;@ (lib)/allocator/tlsf.ts:470:26
|
||||
;;@ (lib)/allocator/tlsf.ts:472:26
|
||||
(i32.const 3)
|
||||
(i32.const -1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:470:35
|
||||
;;@ (lib)/allocator/tlsf.ts:472:35
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
@ -2618,27 +2635,27 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 470)
|
||||
(i32.const 472)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:471:4
|
||||
;;@ (lib)/allocator/tlsf.ts:473:4
|
||||
(set_local $5
|
||||
;;@ (lib)/allocator/tlsf.ts:471:16
|
||||
;;@ (lib)/allocator/tlsf.ts:473:16
|
||||
(call "$(lib)/allocator/tlsf/Root#use"
|
||||
;;@ (lib)/allocator/tlsf.ts:471:11
|
||||
;;@ (lib)/allocator/tlsf.ts:473:11
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:471:20
|
||||
;;@ (lib)/allocator/tlsf.ts:473:20
|
||||
(get_local $8)
|
||||
;;@ (lib)/allocator/tlsf.ts:471:27
|
||||
;;@ (lib)/allocator/tlsf.ts:473:27
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:474:9
|
||||
;;@ (lib)/allocator/tlsf.ts:476:9
|
||||
(return
|
||||
(get_local $5)
|
||||
)
|
||||
@ -2647,50 +2664,50 @@
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
;;@ (lib)/allocator/tlsf.ts:480:2
|
||||
;;@ (lib)/allocator/tlsf.ts:482:2
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:480:6
|
||||
;;@ (lib)/allocator/tlsf.ts:482:6
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:480:12
|
||||
;;@ (lib)/allocator/tlsf.ts:482:12
|
||||
(block
|
||||
;;@ (lib)/allocator/tlsf.ts:481:4
|
||||
;;@ (lib)/allocator/tlsf.ts:483:4
|
||||
(set_local $1
|
||||
;;@ (lib)/allocator/tlsf.ts:481:15
|
||||
;;@ (lib)/allocator/tlsf.ts:483:15
|
||||
(get_global "$(lib)/allocator/tlsf/ROOT")
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:482:4
|
||||
;;@ (lib)/allocator/tlsf.ts:484:4
|
||||
(if
|
||||
;;@ (lib)/allocator/tlsf.ts:482:8
|
||||
;;@ (lib)/allocator/tlsf.ts:484:8
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:482:14
|
||||
;;@ (lib)/allocator/tlsf.ts:484:14
|
||||
(block
|
||||
;;@ (lib)/allocator/tlsf.ts:483:6
|
||||
;;@ (lib)/allocator/tlsf.ts:485:6
|
||||
(set_local $2
|
||||
;;@ (lib)/allocator/tlsf.ts:483:18
|
||||
;;@ (lib)/allocator/tlsf.ts:485:18
|
||||
(i32.sub
|
||||
;;@ (lib)/allocator/tlsf.ts:483:36
|
||||
;;@ (lib)/allocator/tlsf.ts:485:36
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:483:43
|
||||
;;@ (lib)/allocator/tlsf.ts:485:43
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:484:6
|
||||
;;@ (lib)/allocator/tlsf.ts:486:6
|
||||
(set_local $3
|
||||
;;@ (lib)/allocator/tlsf.ts:484:22
|
||||
;;@ (lib)/allocator/tlsf.ts:486:22
|
||||
(i32.load
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:485:6
|
||||
;;@ (lib)/allocator/tlsf.ts:487:6
|
||||
(if
|
||||
(i32.eqz
|
||||
;;@ (lib)/allocator/tlsf.ts:485:13
|
||||
;;@ (lib)/allocator/tlsf.ts:487:13
|
||||
(i32.eqz
|
||||
;;@ (lib)/allocator/tlsf.ts:485:14
|
||||
;;@ (lib)/allocator/tlsf.ts:487:14
|
||||
(i32.and
|
||||
;;@ (lib)/allocator/tlsf.ts:485:15
|
||||
;;@ (lib)/allocator/tlsf.ts:487:15
|
||||
(get_local $3)
|
||||
;;@ (lib)/allocator/tlsf.ts:485:27
|
||||
;;@ (lib)/allocator/tlsf.ts:487:27
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -2699,31 +2716,31 @@
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 485)
|
||||
(i32.const 487)
|
||||
(i32.const 6)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:486:6
|
||||
;;@ (lib)/allocator/tlsf.ts:488:6
|
||||
(i32.store
|
||||
(get_local $2)
|
||||
;;@ (lib)/allocator/tlsf.ts:486:19
|
||||
;;@ (lib)/allocator/tlsf.ts:488:19
|
||||
(i32.or
|
||||
(get_local $3)
|
||||
;;@ (lib)/allocator/tlsf.ts:486:31
|
||||
;;@ (lib)/allocator/tlsf.ts:488:31
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/allocator/tlsf.ts:487:11
|
||||
;;@ (lib)/allocator/tlsf.ts:489:11
|
||||
(call "$(lib)/allocator/tlsf/Root#insert"
|
||||
;;@ (lib)/allocator/tlsf.ts:487:6
|
||||
;;@ (lib)/allocator/tlsf.ts:489:6
|
||||
(get_local $1)
|
||||
;;@ (lib)/allocator/tlsf.ts:487:18
|
||||
;;@ (lib)/allocator/tlsf.ts:489:18
|
||||
(i32.sub
|
||||
;;@ (lib)/allocator/tlsf.ts:487:36
|
||||
;;@ (lib)/allocator/tlsf.ts:489:36
|
||||
(get_local $0)
|
||||
;;@ (lib)/allocator/tlsf.ts:487:43
|
||||
;;@ (lib)/allocator/tlsf.ts:489:43
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -2732,527 +2749,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func "$(lib)/memory/set_memory" (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
;;@ (lib)/memory.ts:196:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:196:6
|
||||
(i32.eqz
|
||||
;;@ (lib)/memory.ts:196:7
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:197:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:198:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:198:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:198:18
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:199:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:199:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:23
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:199:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:200:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:200:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:200:11
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:201:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:203:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:203:19
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:203:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:204:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:204:19
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:204:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:205:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:205:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:23
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:205:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:206:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:206:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:23
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:206:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:207:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:207:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:207:11
|
||||
(i32.const 6)
|
||||
)
|
||||
;;@ (lib)/memory.ts:208:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:209:12
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:209:19
|
||||
(i32.const 3)
|
||||
)
|
||||
;;@ (lib)/memory.ts:209:22
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:2
|
||||
(i32.store8
|
||||
;;@ (lib)/memory.ts:210:12
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:210:19
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:23
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:210:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ (lib)/memory.ts:211:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:211:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:211:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:212:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:215:2
|
||||
(set_local $3
|
||||
;;@ (lib)/memory.ts:215:17
|
||||
(i32.and
|
||||
(i32.sub
|
||||
(i32.const 0)
|
||||
;;@ (lib)/memory.ts:215:18
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ (lib)/memory.ts:215:25
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:216:2
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:216:10
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:217:2
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:217:7
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:218:2
|
||||
(set_local $2
|
||||
(i32.and
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:218:7
|
||||
(i32.const -4)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:220:2
|
||||
(set_local $4
|
||||
;;@ (lib)/memory.ts:220:17
|
||||
(i32.mul
|
||||
(i32.div_u
|
||||
(i32.const -1)
|
||||
;;@ (lib)/memory.ts:220:27
|
||||
(i32.const 255)
|
||||
)
|
||||
;;@ (lib)/memory.ts:220:33
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:223:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:223:13
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:223:19
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:224:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:224:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:24
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:224:27
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:225:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:225:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:225:11
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:226:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:227:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:227:20
|
||||
(i32.const 4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:227:23
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:228:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:228:20
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:228:23
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:229:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:229:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:24
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:229:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:230:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:230:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:24
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:230:27
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:231:2
|
||||
(if
|
||||
;;@ (lib)/memory.ts:231:6
|
||||
(i32.le_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:231:11
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:232:4
|
||||
(return)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:233:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:233:20
|
||||
(i32.const 12)
|
||||
)
|
||||
;;@ (lib)/memory.ts:233:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:234:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:234:20
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:234:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:235:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:235:20
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:235:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:236:13
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:236:20
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:236:24
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:237:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:237:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:24
|
||||
(i32.const 28)
|
||||
)
|
||||
;;@ (lib)/memory.ts:237:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:238:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:238:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:24
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:238:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:239:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:239:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:24
|
||||
(i32.const 20)
|
||||
)
|
||||
;;@ (lib)/memory.ts:239:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:2
|
||||
(i32.store
|
||||
;;@ (lib)/memory.ts:240:13
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:240:20
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:24
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:240:28
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:243:2
|
||||
(set_local $3
|
||||
;;@ (lib)/memory.ts:243:6
|
||||
(i32.add
|
||||
(i32.const 24)
|
||||
;;@ (lib)/memory.ts:243:11
|
||||
(i32.and
|
||||
;;@ (lib)/memory.ts:243:12
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:243:19
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:244:2
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:244:10
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:245:2
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:245:7
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:2
|
||||
(set_local $5
|
||||
;;@ (lib)/memory.ts:248:17
|
||||
(i64.or
|
||||
(i64.extend_u/i32
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:28
|
||||
(i64.shl
|
||||
;;@ (lib)/memory.ts:248:29
|
||||
(i64.extend_u/i32
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ (lib)/memory.ts:248:41
|
||||
(i64.const 32)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:249:2
|
||||
(block $break|0
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ (lib)/memory.ts:249:9
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:249:14
|
||||
(i32.const 32)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
;;@ (lib)/memory.ts:250:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:250:15
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:250:21
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:251:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:251:22
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ (lib)/memory.ts:251:25
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:252:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:252:22
|
||||
(i32.const 16)
|
||||
)
|
||||
;;@ (lib)/memory.ts:252:26
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:4
|
||||
(i64.store
|
||||
;;@ (lib)/memory.ts:253:15
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:253:22
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ (lib)/memory.ts:253:26
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ (lib)/memory.ts:254:4
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ (lib)/memory.ts:254:9
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
;;@ (lib)/memory.ts:255:4
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ (lib)/memory.ts:255:12
|
||||
(i32.const 32)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 21 ;) (type $v)
|
||||
(func $start (; 20 ;) (type $v)
|
||||
;;@ (lib)/allocator/tlsf.ts:50:0
|
||||
(if
|
||||
(i32.eqz
|
||||
|
@ -6,7 +6,6 @@ const aConst: i32 = 0;
|
||||
function aFunc(): void {
|
||||
}
|
||||
enum AnEnum {
|
||||
|
||||
}
|
||||
class AClass {
|
||||
}
|
||||
|
17
tslint.json
17
tslint.json
@ -1,13 +1,21 @@
|
||||
{
|
||||
"rulesDirectory": [
|
||||
"./lib/tslint",
|
||||
"./lib/tslint/internal"
|
||||
],
|
||||
"defaultSeverity": "warning",
|
||||
"rules": {
|
||||
"as-diagnostics": true,
|
||||
"as-types": { "severity": "error" },
|
||||
"adjacent-overload-signatures": true,
|
||||
"ban-types": [ true, ["Object"], ["any"], ["undefined"], ["never"] ],
|
||||
"curly": [true, "ignore-same-line"],
|
||||
"deprecation": true,
|
||||
"encoding": true,
|
||||
"eofline": true,
|
||||
"indent": [true, "spaces", 2],
|
||||
"label-position": true,
|
||||
"max-line-length": [ true, { "limit": 120, "ignore-pattern": " *DiagnosticCode\\.[^ ]+,$" } ],
|
||||
"member-access": [ true, "no-public" ],
|
||||
"new-parens": true,
|
||||
"no-any": true,
|
||||
@ -34,17 +42,22 @@
|
||||
"no-sparse-arrays": true,
|
||||
"no-string-literal": true,
|
||||
"no-string-throw": true,
|
||||
"no-this-assignment": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unbound-method": true,
|
||||
"no-unsafe-any": true,
|
||||
"no-unused-variable": true,
|
||||
"no-void-expression": true,
|
||||
"object-literal-shorthand": [true, "never"],
|
||||
"object-literal-shorthand": [ true, "never" ],
|
||||
"prefer-method-signature": true,
|
||||
"quotemark": [true, "double"],
|
||||
"radix": true,
|
||||
"restrict-plus-operands": true,
|
||||
"semicolon": [true, "always"]
|
||||
},
|
||||
"jsRules": {
|
||||
"quotemark": [true, "double"],
|
||||
"radix": true,
|
||||
"max-line-length": [ true, { "limit": 120, "ignore-pattern": " *DiagnosticCode\\.[^ ]+,$" } ],
|
||||
"semicolon": [true, "always"]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user