rip-lang 3.8.8 → 3.8.10
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/CHANGELOG.md +21 -0
- package/README.md +7 -7
- package/docs/dist/rip-ui.min.js +77 -79
- package/docs/dist/rip-ui.min.js.br +0 -0
- package/docs/dist/rip.browser.js +44 -76
- package/docs/dist/rip.browser.min.js +78 -80
- package/docs/dist/rip.browser.min.js.br +0 -0
- package/docs/dist/ui.js +9 -3
- package/docs/dist/ui.min.js +2 -2
- package/docs/dist/ui.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +43 -72
- package/src/grammar/grammar.rip +5 -5
- package/src/parser-rd.js +4 -4
- package/src/parser.js +4 -4
|
Binary file
|
package/docs/dist/rip.browser.js
CHANGED
|
@@ -3184,7 +3184,7 @@ var parserInstance = {
|
|
|
3184
3184
|
case 229:
|
|
3185
3185
|
return $[$0 - 4].length === 3 ? ["if", $[$0 - 4][1], $[$0 - 4][2], ["if", $[$0 - 1], $[$0]]] : [...$[$0 - 4], ["if", $[$0 - 1], $[$0]]];
|
|
3186
3186
|
case 230:
|
|
3187
|
-
return ["
|
|
3187
|
+
return ["if", ["!", $[$0 - 1]], $[$0]];
|
|
3188
3188
|
case 231:
|
|
3189
3189
|
return ["if", ["!", $[$0 - 3]], $[$0 - 2], $[$0]];
|
|
3190
3190
|
case 233:
|
|
@@ -3196,7 +3196,7 @@ var parserInstance = {
|
|
|
3196
3196
|
return ["?:", $[$0 - 4], $[$0 - 6], $[$0 - 1]];
|
|
3197
3197
|
case 238:
|
|
3198
3198
|
case 239:
|
|
3199
|
-
return ["
|
|
3199
|
+
return ["if", ["!", $[$0]], [$[$0 - 2]]];
|
|
3200
3200
|
case 240:
|
|
3201
3201
|
return ["try", $[$0]];
|
|
3202
3202
|
case 241:
|
|
@@ -3230,9 +3230,9 @@ var parserInstance = {
|
|
|
3230
3230
|
case 256:
|
|
3231
3231
|
return ["while", $[$0 - 2], $[$0]];
|
|
3232
3232
|
case 257:
|
|
3233
|
-
return ["
|
|
3233
|
+
return ["while", ["!", $[$0]]];
|
|
3234
3234
|
case 258:
|
|
3235
|
-
return ["
|
|
3235
|
+
return ["while", ["!", $[$0 - 2]], $[$0]];
|
|
3236
3236
|
case 259:
|
|
3237
3237
|
return $[$0 - 1].length === 2 ? [$[$0 - 1][0], $[$0 - 1][1], $[$0]] : [$[$0 - 1][0], $[$0 - 1][1], $[$0 - 1][2], $[$0]];
|
|
3238
3238
|
case 260:
|
|
@@ -4742,6 +4742,7 @@ class CodeGenerator {
|
|
|
4742
4742
|
">>": "generateBinaryOp",
|
|
4743
4743
|
">>>": "generateBinaryOp",
|
|
4744
4744
|
"%%": "generateModulo",
|
|
4745
|
+
"%%=": "generateModuloAssign",
|
|
4745
4746
|
"//": "generateFloorDiv",
|
|
4746
4747
|
"//=": "generateFloorDivAssign",
|
|
4747
4748
|
"..": "generateRange",
|
|
@@ -4802,12 +4803,10 @@ class CodeGenerator {
|
|
|
4802
4803
|
yield: "generateYield",
|
|
4803
4804
|
"yield-from": "generateYieldFrom",
|
|
4804
4805
|
if: "generateIf",
|
|
4805
|
-
unless: "generateIf",
|
|
4806
4806
|
"for-in": "generateForIn",
|
|
4807
4807
|
"for-of": "generateForOf",
|
|
4808
4808
|
"for-as": "generateForAs",
|
|
4809
4809
|
while: "generateWhile",
|
|
4810
|
-
until: "generateUntil",
|
|
4811
4810
|
try: "generateTry",
|
|
4812
4811
|
throw: "generateThrow",
|
|
4813
4812
|
control: "generateControl",
|
|
@@ -4883,7 +4882,7 @@ class CodeGenerator {
|
|
|
4883
4882
|
continue;
|
|
4884
4883
|
if (trimmed.startsWith("let ") || trimmed.startsWith("var "))
|
|
4885
4884
|
continue;
|
|
4886
|
-
if (trimmed.startsWith("const slice") || trimmed.startsWith("const modulo") || trimmed.startsWith("const
|
|
4885
|
+
if (trimmed.startsWith("const slice") || trimmed.startsWith("const modulo") || trimmed.startsWith("const toMatchable"))
|
|
4887
4886
|
continue;
|
|
4888
4887
|
if (trimmed.startsWith("const {") && trimmed.includes("__"))
|
|
4889
4888
|
continue;
|
|
@@ -4945,12 +4944,6 @@ class CodeGenerator {
|
|
|
4945
4944
|
this.collectProgramVariables(elseBranch);
|
|
4946
4945
|
return;
|
|
4947
4946
|
}
|
|
4948
|
-
if (head === "unless") {
|
|
4949
|
-
let [condition, body] = rest;
|
|
4950
|
-
this.collectProgramVariables(condition);
|
|
4951
|
-
this.collectProgramVariables(body);
|
|
4952
|
-
return;
|
|
4953
|
-
}
|
|
4954
4947
|
if (head === "try") {
|
|
4955
4948
|
this.collectProgramVariables(rest[0]);
|
|
4956
4949
|
if (rest.length >= 2 && Array.isArray(rest[1]) && rest[1].length === 2 && rest[1][0] !== "block") {
|
|
@@ -5107,7 +5100,7 @@ class CodeGenerator {
|
|
|
5107
5100
|
let condCode = this.generate(cond.condition, "value");
|
|
5108
5101
|
let valCode = this.generate(argWithout, "value");
|
|
5109
5102
|
let callStr2 = `${callee}(${valCode})`;
|
|
5110
|
-
return
|
|
5103
|
+
return `if (${condCode}) ${callStr2}`;
|
|
5111
5104
|
}
|
|
5112
5105
|
}
|
|
5113
5106
|
let needsAwait = headAwaitMeta === true;
|
|
@@ -5117,7 +5110,7 @@ class CodeGenerator {
|
|
|
5117
5110
|
return needsAwait ? `await ${callStr}` : callStr;
|
|
5118
5111
|
}
|
|
5119
5112
|
if (Array.isArray(head) && typeof head[0] === "string") {
|
|
5120
|
-
let stmtOps = ["=", "+=", "-=", "*=", "/=", "%=", "**=", "&&=", "||=", "??=", "if", "
|
|
5113
|
+
let stmtOps = ["=", "+=", "-=", "*=", "/=", "%=", "**=", "&&=", "||=", "??=", "if", "return", "throw"];
|
|
5121
5114
|
if (stmtOps.includes(head[0])) {
|
|
5122
5115
|
let exprs = sexpr.map((stmt) => this.generate(stmt, "value"));
|
|
5123
5116
|
return `(${exprs.join(", ")})`;
|
|
@@ -5139,7 +5132,7 @@ class CodeGenerator {
|
|
|
5139
5132
|
let condCode = this.generate(cond.condition, "value");
|
|
5140
5133
|
let valCode = this.generate(argWithout, "value");
|
|
5141
5134
|
let callStr2 = `${calleeCode2}(${valCode})`;
|
|
5142
|
-
return
|
|
5135
|
+
return `if (${condCode}) ${callStr2}`;
|
|
5143
5136
|
}
|
|
5144
5137
|
}
|
|
5145
5138
|
let needsAwait = false;
|
|
@@ -5176,7 +5169,7 @@ class CodeGenerator {
|
|
|
5176
5169
|
else
|
|
5177
5170
|
other.push(stmt);
|
|
5178
5171
|
}
|
|
5179
|
-
let blockStmts = ["def", "class", "if", "
|
|
5172
|
+
let blockStmts = ["def", "class", "if", "for-in", "for-of", "for-as", "while", "loop", "switch", "try"];
|
|
5180
5173
|
let statementsCode = other.map((stmt, index) => {
|
|
5181
5174
|
let isSingle = other.length === 1 && imports.length === 0 && exports.length === 0;
|
|
5182
5175
|
let isObj = this.is(stmt, "object");
|
|
@@ -5228,8 +5221,8 @@ class CodeGenerator {
|
|
|
5228
5221
|
`;
|
|
5229
5222
|
needsBlank = true;
|
|
5230
5223
|
}
|
|
5231
|
-
if (this.helpers.has("
|
|
5232
|
-
code += `const
|
|
5224
|
+
if (this.helpers.has("toMatchable")) {
|
|
5225
|
+
code += `const toMatchable = (v, allowNewlines) => {
|
|
5233
5226
|
`;
|
|
5234
5227
|
code += ` if (typeof v === "string") return !allowNewlines && /[\\n\\r]/.test(v) ? null : v;
|
|
5235
5228
|
`;
|
|
@@ -5340,6 +5333,12 @@ function _setDataSection() {
|
|
|
5340
5333
|
this.helpers.add("modulo");
|
|
5341
5334
|
return `modulo(${this.generate(left, "value")}, ${this.generate(right, "value")})`;
|
|
5342
5335
|
}
|
|
5336
|
+
generateModuloAssign(head, rest) {
|
|
5337
|
+
let [target, value] = rest;
|
|
5338
|
+
this.helpers.add("modulo");
|
|
5339
|
+
let t = this.generate(target, "value"), v = this.generate(value, "value");
|
|
5340
|
+
return `${t} = modulo(${t}, ${v})`;
|
|
5341
|
+
}
|
|
5343
5342
|
generateFloorDiv(head, rest) {
|
|
5344
5343
|
let [left, right] = rest;
|
|
5345
5344
|
return `Math.floor(${this.generate(left, "value")} / ${this.generate(right, "value")})`;
|
|
@@ -5371,8 +5370,6 @@ function _setDataSection() {
|
|
|
5371
5370
|
let ctrlOp = str(rawCtrlOp);
|
|
5372
5371
|
let isReturn = ctrlSexpr[0] === "return";
|
|
5373
5372
|
let targetCode2 = this.generate(target, "value");
|
|
5374
|
-
if (typeof target === "string")
|
|
5375
|
-
this.programVars.add(target);
|
|
5376
5373
|
let exprCode = this.generate(expr, "value");
|
|
5377
5374
|
let ctrlValue = ctrlSexpr.length > 1 ? ctrlSexpr[1] : null;
|
|
5378
5375
|
let ctrlCode = isReturn ? ctrlValue ? `return ${this.generate(ctrlValue, "value")}` : "return" : ctrlValue ? `throw ${this.generate(ctrlValue, "value")}` : "throw new Error()";
|
|
@@ -5423,27 +5420,22 @@ function _setDataSection() {
|
|
|
5423
5420
|
}
|
|
5424
5421
|
if (context === "statement" && head === "=" && Array.isArray(value) && (value[0] === "||" || value[0] === "&&") && value.length === 3) {
|
|
5425
5422
|
let [binOp, left, right] = value;
|
|
5426
|
-
if (
|
|
5427
|
-
let [
|
|
5423
|
+
if (this.is(right, "if") && right.length === 3) {
|
|
5424
|
+
let [, condition, wrappedValue] = right;
|
|
5428
5425
|
let unwrapped = Array.isArray(wrappedValue) && wrappedValue.length === 1 ? wrappedValue[0] : wrappedValue;
|
|
5429
5426
|
let fullValue = [binOp, left, unwrapped];
|
|
5430
5427
|
let t = this.generate(target, "value"), c = this.generate(condition, "value"), v = this.generate(fullValue, "value");
|
|
5431
|
-
return
|
|
5428
|
+
return `if (${c}) ${t} = ${v}`;
|
|
5432
5429
|
}
|
|
5433
5430
|
}
|
|
5434
5431
|
if (context === "statement" && head === "=" && Array.isArray(value) && value.length === 3) {
|
|
5435
5432
|
let [valHead, condition, actualValue] = value;
|
|
5436
5433
|
let isPostfix = Array.isArray(actualValue) && actualValue.length === 1 && (!Array.isArray(actualValue[0]) || actualValue[0][0] !== "block");
|
|
5437
|
-
if (
|
|
5434
|
+
if (valHead === "if" && isPostfix) {
|
|
5438
5435
|
let unwrapped = Array.isArray(actualValue) && actualValue.length === 1 ? actualValue[0] : actualValue;
|
|
5439
5436
|
let t = this.generate(target, "value");
|
|
5440
5437
|
let condCode = this.unwrapLogical(this.generate(condition, "value"));
|
|
5441
5438
|
let v = this.generate(unwrapped, "value");
|
|
5442
|
-
if (valHead === "unless") {
|
|
5443
|
-
if (condCode.includes(" ") || /[<>=&|]/.test(condCode))
|
|
5444
|
-
condCode = `(${condCode})`;
|
|
5445
|
-
return `if (!${condCode}) ${t} = ${v}`;
|
|
5446
|
-
}
|
|
5447
5439
|
return `if (${condCode}) ${t} = ${v}`;
|
|
5448
5440
|
}
|
|
5449
5441
|
}
|
|
@@ -5491,12 +5483,12 @@ function _setDataSection() {
|
|
|
5491
5483
|
}
|
|
5492
5484
|
generateRegexIndex(head, rest) {
|
|
5493
5485
|
let [value, regex, captureIndex] = rest;
|
|
5494
|
-
this.helpers.add("
|
|
5486
|
+
this.helpers.add("toMatchable");
|
|
5495
5487
|
this.programVars.add("_");
|
|
5496
5488
|
let v = this.generate(value, "value"), r = this.generate(regex, "value");
|
|
5497
5489
|
let idx = captureIndex !== null ? this.generate(captureIndex, "value") : "0";
|
|
5498
5490
|
let allowNL = r.includes("/m") ? ", true" : "";
|
|
5499
|
-
return `(_ =
|
|
5491
|
+
return `(_ = toMatchable(${v}${allowNL}).match(${r})) && _[${idx}]`;
|
|
5500
5492
|
}
|
|
5501
5493
|
generateIndexAccess(head, rest) {
|
|
5502
5494
|
let [arr, index] = rest;
|
|
@@ -5596,11 +5588,6 @@ function _setDataSection() {
|
|
|
5596
5588
|
let [expr] = rest;
|
|
5597
5589
|
if (this.sideEffectOnly)
|
|
5598
5590
|
return "return";
|
|
5599
|
-
if (this.is(expr, "unless")) {
|
|
5600
|
-
let [, condition, body] = expr;
|
|
5601
|
-
let val = Array.isArray(body) && body.length === 1 ? body[0] : body;
|
|
5602
|
-
return `if (!${this.generate(condition, "value")}) return ${this.generate(val, "value")}`;
|
|
5603
|
-
}
|
|
5604
5591
|
if (this.is(expr, "if")) {
|
|
5605
5592
|
let [, condition, body, ...elseParts] = expr;
|
|
5606
5593
|
if (elseParts.length === 0) {
|
|
@@ -5608,11 +5595,10 @@ function _setDataSection() {
|
|
|
5608
5595
|
return `if (${this.generate(condition, "value")}) return ${this.generate(val, "value")}`;
|
|
5609
5596
|
}
|
|
5610
5597
|
}
|
|
5611
|
-
if (this.is(expr, "new") && Array.isArray(expr[1]) && expr[1][0] === "
|
|
5612
|
-
let [,
|
|
5613
|
-
let [, condition, body] = unlessNode;
|
|
5598
|
+
if (this.is(expr, "new") && Array.isArray(expr[1]) && expr[1][0] === "if") {
|
|
5599
|
+
let [, condition, body] = expr[1];
|
|
5614
5600
|
let val = Array.isArray(body) && body.length === 1 ? body[0] : body;
|
|
5615
|
-
return `if (
|
|
5601
|
+
return `if (${this.generate(condition, "value")}) return ${this.generate(["new", val], "value")}`;
|
|
5616
5602
|
}
|
|
5617
5603
|
return `return ${this.generate(expr, "value")}`;
|
|
5618
5604
|
}
|
|
@@ -5713,18 +5699,6 @@ ${this.indent()}}`;
|
|
|
5713
5699
|
return `yield* ${this.generate(rest[0], "value")}`;
|
|
5714
5700
|
}
|
|
5715
5701
|
generateIf(head, rest, context, sexpr) {
|
|
5716
|
-
if (head === "unless") {
|
|
5717
|
-
let [condition2, body] = rest;
|
|
5718
|
-
if (Array.isArray(body) && body.length === 1 && (!Array.isArray(body[0]) || body[0][0] !== "block"))
|
|
5719
|
-
body = body[0];
|
|
5720
|
-
if (context === "value") {
|
|
5721
|
-
return `(!${this.generate(condition2, "value")} ? ${this.extractExpression(body)} : undefined)`;
|
|
5722
|
-
}
|
|
5723
|
-
let condCode = this.unwrap(this.generate(condition2, "value"));
|
|
5724
|
-
if (/[ <>=&|]/.test(condCode))
|
|
5725
|
-
condCode = `(${condCode})`;
|
|
5726
|
-
return `if (!${condCode}) ` + this.generate(body, "statement");
|
|
5727
|
-
}
|
|
5728
5702
|
let [condition, thenBranch, ...elseBranches] = rest;
|
|
5729
5703
|
return context === "value" ? this.generateIfAsExpression(condition, thenBranch, elseBranches) : this.generateIfAsStatement(condition, thenBranch, elseBranches);
|
|
5730
5704
|
}
|
|
@@ -5943,10 +5917,6 @@ ${this.indent()}}`;
|
|
|
5943
5917
|
let code = `while (${this.unwrap(this.generate(cond, "value"))}) `;
|
|
5944
5918
|
return code + (guard ? this.generateLoopBodyWithGuard(body, guard) : this.generateLoopBody(body));
|
|
5945
5919
|
}
|
|
5946
|
-
generateUntil(head, rest) {
|
|
5947
|
-
let [cond, body] = rest;
|
|
5948
|
-
return `while (!(${this.unwrap(this.generate(cond, "value"))})) ` + this.generateLoopBody(body);
|
|
5949
|
-
}
|
|
5950
5920
|
generateRange(head, rest) {
|
|
5951
5921
|
if (head === "...") {
|
|
5952
5922
|
if (rest.length === 1)
|
|
@@ -6012,11 +5982,11 @@ ${this.indent()}}`;
|
|
|
6012
5982
|
}
|
|
6013
5983
|
generateRegexMatch(head, rest) {
|
|
6014
5984
|
let [left, right] = rest;
|
|
6015
|
-
this.helpers.add("
|
|
5985
|
+
this.helpers.add("toMatchable");
|
|
6016
5986
|
this.programVars.add("_");
|
|
6017
5987
|
let r = this.generate(right, "value");
|
|
6018
5988
|
let allowNL = r.includes("/m") ? ", true" : "";
|
|
6019
|
-
return `(_ =
|
|
5989
|
+
return `(_ = toMatchable(${this.generate(left, "value")}${allowNL}).match(${r}))`;
|
|
6020
5990
|
}
|
|
6021
5991
|
generateNew(head, rest) {
|
|
6022
5992
|
let [call] = rest;
|
|
@@ -6147,21 +6117,19 @@ ${this.indent()}}`;
|
|
|
6147
6117
|
let [expr] = rest;
|
|
6148
6118
|
if (Array.isArray(expr)) {
|
|
6149
6119
|
let checkExpr = expr, wrapperType = null;
|
|
6150
|
-
if (expr[0] === "new" && Array.isArray(expr[1]) &&
|
|
6120
|
+
if (expr[0] === "new" && Array.isArray(expr[1]) && expr[1][0] === "if") {
|
|
6151
6121
|
wrapperType = "new";
|
|
6152
6122
|
checkExpr = expr[1];
|
|
6153
|
-
} else if (expr[0] === "if"
|
|
6123
|
+
} else if (expr[0] === "if") {
|
|
6154
6124
|
checkExpr = expr;
|
|
6155
6125
|
}
|
|
6156
|
-
if (checkExpr[0] === "if"
|
|
6157
|
-
let [
|
|
6126
|
+
if (checkExpr[0] === "if") {
|
|
6127
|
+
let [, condition, body] = checkExpr;
|
|
6158
6128
|
let unwrapped = Array.isArray(body) && body.length === 1 ? body[0] : body;
|
|
6159
6129
|
expr = wrapperType === "new" ? ["new", unwrapped] : unwrapped;
|
|
6160
6130
|
let condCode = this.generate(condition, "value");
|
|
6161
6131
|
let throwCode = `throw ${this.generate(expr, "value")}`;
|
|
6162
|
-
return
|
|
6163
|
-
${this.indent()} ${throwCode};
|
|
6164
|
-
${this.indent()}}` : `if (${condCode}) {
|
|
6132
|
+
return `if (${condCode}) {
|
|
6165
6133
|
${this.indent()} ${throwCode};
|
|
6166
6134
|
${this.indent()}}`;
|
|
6167
6135
|
}
|
|
@@ -6332,11 +6300,11 @@ ${this.indent()}}`;
|
|
|
6332
6300
|
return false;
|
|
6333
6301
|
if (["break", "continue", "return", "throw"].includes(node[0]))
|
|
6334
6302
|
return true;
|
|
6335
|
-
if (node[0] === "if"
|
|
6303
|
+
if (node[0] === "if")
|
|
6336
6304
|
return node.slice(1).some(hasCtrl);
|
|
6337
6305
|
return node.some(hasCtrl);
|
|
6338
6306
|
};
|
|
6339
|
-
let loopStmts = ["for-in", "for-of", "for-as", "while", "
|
|
6307
|
+
let loopStmts = ["for-in", "for-of", "for-as", "while", "loop"];
|
|
6340
6308
|
if (this.is(expr, "block")) {
|
|
6341
6309
|
for (let i = 0;i < expr.length - 1; i++) {
|
|
6342
6310
|
let s = expr[i + 1], isLast = i === expr.length - 2;
|
|
@@ -6668,7 +6636,7 @@ export default ${expr[1]}`;
|
|
|
6668
6636
|
if (!Array.isArray(expr))
|
|
6669
6637
|
return null;
|
|
6670
6638
|
let h = expr[0];
|
|
6671
|
-
if (
|
|
6639
|
+
if (h === "if" && expr.length === 3)
|
|
6672
6640
|
return { type: h, condition: expr[1], value: expr[2] };
|
|
6673
6641
|
if (h === "+" || h === "-" || h === "*" || h === "/") {
|
|
6674
6642
|
for (let i = 1;i < expr.length; i++) {
|
|
@@ -6777,7 +6745,7 @@ export default ${expr[1]}`;
|
|
|
6777
6745
|
let bodyVars = this.collectFunctionVariables(body);
|
|
6778
6746
|
let newVars = new Set([...bodyVars].filter((v) => !this.programVars.has(v) && !this.reactiveVars?.has(v) && !paramNames.has(v) && !this.scopeStack.some((s) => s.has(v))));
|
|
6779
6747
|
let noRetStmts = ["return", "throw", "break", "continue"];
|
|
6780
|
-
let loopStmts = ["for-in", "for-of", "for-as", "while", "
|
|
6748
|
+
let loopStmts = ["for-in", "for-of", "for-as", "while", "loop"];
|
|
6781
6749
|
this.scopeStack.push(new Set([...newVars, ...paramNames]));
|
|
6782
6750
|
if (this.is(body, "block")) {
|
|
6783
6751
|
let statements = this.unwrapBlock(body);
|
|
@@ -6819,7 +6787,7 @@ export default ${expr[1]}`;
|
|
|
6819
6787
|
`;
|
|
6820
6788
|
return;
|
|
6821
6789
|
}
|
|
6822
|
-
if (!isConstructor && !sideEffectOnly && isLast &&
|
|
6790
|
+
if (!isConstructor && !sideEffectOnly && isLast && h === "if") {
|
|
6823
6791
|
let [cond, thenB, ...elseB] = stmt.slice(1);
|
|
6824
6792
|
let hasMulti = (b) => this.is(b, "block") && b.length > 2;
|
|
6825
6793
|
if (hasMulti(thenB) || elseB.some(hasMulti)) {
|
|
@@ -7066,7 +7034,7 @@ ${this.indent()}}`;
|
|
|
7066
7034
|
generateIfElseWithEarlyReturns(ifStmt) {
|
|
7067
7035
|
let [head, condition, thenBranch, ...elseBranches] = ifStmt;
|
|
7068
7036
|
let code = "";
|
|
7069
|
-
let condCode =
|
|
7037
|
+
let condCode = this.generate(condition, "value");
|
|
7070
7038
|
code += this.indent() + `if (${condCode}) {
|
|
7071
7039
|
`;
|
|
7072
7040
|
code += this.withIndent(() => this.generateBranchWithReturn(thenBranch));
|
|
@@ -7246,7 +7214,7 @@ ${this.indent()}}`;
|
|
|
7246
7214
|
if (!generated.endsWith("}"))
|
|
7247
7215
|
return true;
|
|
7248
7216
|
let h = Array.isArray(stmt) ? stmt[0] : null;
|
|
7249
|
-
return !["def", "class", "if", "
|
|
7217
|
+
return !["def", "class", "if", "for-in", "for-of", "for-as", "while", "loop", "switch", "try"].includes(h);
|
|
7250
7218
|
}
|
|
7251
7219
|
addSemicolon(stmt, generated) {
|
|
7252
7220
|
return generated + (this.needsSemicolon(stmt, generated) ? ";" : "");
|
|
@@ -7276,7 +7244,7 @@ ${this.indent()}}`;
|
|
|
7276
7244
|
return stmts.some((s) => Array.isArray(s) && ["return", "throw", "break", "continue"].includes(s[0]));
|
|
7277
7245
|
});
|
|
7278
7246
|
}
|
|
7279
|
-
if (t === "if"
|
|
7247
|
+
if (t === "if") {
|
|
7280
7248
|
let [, , thenB, elseB] = body;
|
|
7281
7249
|
return this.branchHasControlFlow(thenB) && elseB && this.branchHasControlFlow(elseB);
|
|
7282
7250
|
}
|
|
@@ -7940,8 +7908,8 @@ function getComponentRuntime() {
|
|
|
7940
7908
|
return new CodeGenerator({}).getComponentRuntime();
|
|
7941
7909
|
}
|
|
7942
7910
|
// src/browser.js
|
|
7943
|
-
var VERSION = "3.8.
|
|
7944
|
-
var BUILD_DATE = "2026-02-
|
|
7911
|
+
var VERSION = "3.8.10";
|
|
7912
|
+
var BUILD_DATE = "2026-02-17@02:53:39GMT";
|
|
7945
7913
|
if (typeof globalThis !== "undefined" && !globalThis.__rip) {
|
|
7946
7914
|
new Function(getReactiveRuntime())();
|
|
7947
7915
|
}
|