rip-lang 3.13.113 → 3.13.115
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/README.md +1 -1
- package/docs/dist/rip.js +10 -6
- package/docs/dist/rip.min.js +51 -51
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +3 -1
package/docs/dist/rip.min.js.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/compiler.js
CHANGED
|
@@ -1116,10 +1116,12 @@ export class CodeGenerator {
|
|
|
1116
1116
|
let isAsync = this.containsAwait(body);
|
|
1117
1117
|
let prefix = isAsync ? 'async ' : '';
|
|
1118
1118
|
|
|
1119
|
+
let stmtOnly = new Set(['def', 'class', 'if', 'for-in', 'for-of', 'for-as', 'while', 'until', 'loop', 'switch', 'try', 'unless']);
|
|
1119
1120
|
if (!sideEffectOnly) {
|
|
1120
1121
|
if (this.is(body, 'block') && body.length === 2) {
|
|
1121
1122
|
let expr = body[1];
|
|
1122
|
-
|
|
1123
|
+
let exprHead = Array.isArray(expr) ? expr[0] : null;
|
|
1124
|
+
if (exprHead !== 'return' && !stmtOnly.has(exprHead)) {
|
|
1123
1125
|
let code = this.generate(expr, 'value');
|
|
1124
1126
|
if (code[0] === '{') code = `(${code})`;
|
|
1125
1127
|
return `${prefix}${paramSyntax} => ${code}`;
|