Skip to content

Commit 3ed2258

Browse files
authored
Merge branch 'AssemblyScript:main' into fix/resolve-typeof-type
2 parents 07f8b41 + 2ccea6b commit 3ed2258

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Diff for: cli/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ function toUpperSnakeCase(str) {
6262
return str.replace(/-/g, "_").toUpperCase();
6363
}
6464

65+
function isNonEmptyString(value) {
66+
return typeof value === "string" && value !== "";
67+
}
68+
6569
/** Ensures that an object is a wrapper class instead of just a pointer. */
6670
// function __wrap(ptrOrObj, wrapperClass) {
6771
// if (typeof ptrOrObj === "number") {
@@ -309,7 +313,9 @@ export async function main(argv, options) {
309313
assemblyscript.setSharedMemory(compilerOptions, opts.sharedMemory);
310314
assemblyscript.setImportTable(compilerOptions, opts.importTable);
311315
assemblyscript.setExportTable(compilerOptions, opts.exportTable);
312-
assemblyscript.setExportStart(compilerOptions, typeof opts.exportStart === "string" ? opts.exportStart : null);
316+
if (opts.exportStart) {
317+
assemblyscript.setExportStart(compilerOptions, isNonEmptyString(opts.exportStart) ? opts.exportStart : "_start");
318+
}
313319
assemblyscript.setMemoryBase(compilerOptions, opts.memoryBase >>> 0);
314320
assemblyscript.setTableBase(compilerOptions, opts.tableBase >>> 0);
315321
assemblyscript.setSourceMap(compilerOptions, opts.sourceMap != null);
@@ -318,7 +324,7 @@ export async function main(argv, options) {
318324
assemblyscript.setLowMemoryLimit(compilerOptions, opts.lowMemoryLimit >>> 0);
319325
assemblyscript.setExportRuntime(compilerOptions, opts.exportRuntime);
320326
assemblyscript.setBundleVersion(compilerOptions, bundleMajorVersion, bundleMinorVersion, bundlePatchVersion);
321-
if (!opts.stackSize && opts.runtime == "incremental") {
327+
if (!opts.stackSize && runtime === 2 /* incremental */) {
322328
opts.stackSize = assemblyscript.DEFAULT_STACK_SIZE;
323329
}
324330
assemblyscript.setStackSize(compilerOptions, opts.stackSize);

Diff for: tests/cli/options.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from "assert";
2-
import * as optionsUtil from "../../cli/util/options.js";
2+
import * as optionsUtil from "../../util/options.js";
33

44
const config = {
55
"enable": {
@@ -40,10 +40,15 @@ optionsUtil.addDefaults(config, merged = { other: ["y"] });
4040
assert.deepStrictEqual(merged.other, ["y"]);
4141

4242
// Complete usage test
43-
var result = optionsUtil.parse(["--enable", "a", "--disable", "b"], config, false);
43+
var result = optionsUtil.parse([
44+
"--enable", "a",
45+
"--disable", "b",
46+
], config, false);
47+
4448
merged = optionsUtil.merge(config, result.options, { enable: ["b", "c"] });
4549
merged = optionsUtil.merge(config, merged, { disable: ["a", "d"] });
4650
optionsUtil.addDefaults(config, merged);
51+
4752
assert.deepStrictEqual(merged.enable, ["a", "c"]);
4853
assert.deepStrictEqual(merged.disable, ["b", "d"]);
4954
assert.deepStrictEqual(merged.other, ["x"]);

0 commit comments

Comments
 (0)