porffor 0.16.0-a2e115b05 → 0.16.0-ab08df866
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/codegen.js +4 -4
- package/package.json +1 -1
package/compiler/codegen.js
CHANGED
@@ -2563,7 +2563,7 @@ const generateUnary = (scope, decl) => {
|
|
2563
2563
|
// * -1
|
2564
2564
|
|
2565
2565
|
if (decl.prefix && decl.argument.type === 'Literal' && typeof decl.argument.value === 'number') {
|
2566
|
-
// if
|
2566
|
+
// if -n, just return that as a const
|
2567
2567
|
return number(-1 * decl.argument.value);
|
2568
2568
|
}
|
2569
2569
|
|
@@ -2575,14 +2575,14 @@ const generateUnary = (scope, decl) => {
|
|
2575
2575
|
case '!':
|
2576
2576
|
const arg = decl.argument;
|
2577
2577
|
if (arg.type === 'UnaryExpression' && arg.operator === '!') {
|
2578
|
-
// !!x -> is x truthy
|
2578
|
+
// opt: !!x -> is x truthy
|
2579
2579
|
return truthy(scope, generate(scope, arg.argument), getNodeType(scope, arg.argument), false, false);
|
2580
2580
|
}
|
2581
|
+
|
2581
2582
|
// !=
|
2582
|
-
return falsy(scope, generate(scope,
|
2583
|
+
return falsy(scope, generate(scope, arg), getNodeType(scope, arg), false, false);
|
2583
2584
|
|
2584
2585
|
case '~':
|
2585
|
-
// todo: does not handle Infinity properly (should convert to 0) (but opt const converting saves us sometimes)
|
2586
2586
|
return [
|
2587
2587
|
...generate(scope, decl.argument),
|
2588
2588
|
Opcodes.i32_to,
|
package/package.json
CHANGED