Skip to content

Commit 87d361b

Browse files
authored
Fix handling of boolean sourceMap option in asconfig (#1402)
1 parent 2f9673b commit 87d361b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

cli/util/options.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ function sanitizeValue(value, type) {
149149
case "b": return Boolean(value);
150150
case "i": return Math.trunc(value) || 0;
151151
case "f": return Number(value) || 0;
152-
case "s": return String(value);
152+
case "s": {
153+
if (value === true) return "";
154+
return String(value);
155+
}
153156
case "I": {
154157
if (!Array.isArray(value)) value = [ value ];
155158
return value.map(v => Math.trunc(v) || 0);

tests/asconfig/complicated/asconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"initialMemory": 30,
77
"explicitStart": true,
88
"measure": true,
9-
"pedantic": true
9+
"pedantic": true,
10+
"sourceMap": true
1011
}
1112
},
1213
"options": {

tests/asconfig/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ..
88
writeFile(name, contents) {
99
if (name === "output.wasm") {
1010
binary = contents;
11+
} else if (name !== "output.wasm.map") {
12+
throw Error("Unexpected output file: " + name);
1113
}
1214
}
1315
}, (err) => {

0 commit comments

Comments
 (0)