redscript-mc 1.2.4 → 1.2.5
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.
|
@@ -1163,8 +1163,17 @@ var require_parser = __commonJS({
|
|
|
1163
1163
|
this.expect("in");
|
|
1164
1164
|
const iterable = this.parseExpr();
|
|
1165
1165
|
this.expect(")");
|
|
1166
|
+
let executeContext;
|
|
1167
|
+
const execIdentKeywords = ["positioned", "rotated", "facing", "anchored", "align"];
|
|
1168
|
+
if (this.check("at") || this.check("in") || this.check("ident") && execIdentKeywords.includes(this.peek().value)) {
|
|
1169
|
+
let context = "";
|
|
1170
|
+
while (!this.check("{") && !this.check("eof")) {
|
|
1171
|
+
context += this.advance().value + " ";
|
|
1172
|
+
}
|
|
1173
|
+
executeContext = context.trim();
|
|
1174
|
+
}
|
|
1166
1175
|
const body = this.parseBlock();
|
|
1167
|
-
return this.withLoc({ kind: "foreach", binding, iterable, body }, foreachToken);
|
|
1176
|
+
return this.withLoc({ kind: "foreach", binding, iterable, body, executeContext }, foreachToken);
|
|
1168
1177
|
}
|
|
1169
1178
|
parseMatchStmt() {
|
|
1170
1179
|
const matchToken = this.expect("match");
|
|
@@ -3799,7 +3808,8 @@ var require_lowering = __commonJS({
|
|
|
3799
3808
|
}
|
|
3800
3809
|
const subFnName = `${this.currentFn}/foreach_${this.foreachCounter++}`;
|
|
3801
3810
|
const selector = this.exprToString(stmt.iterable);
|
|
3802
|
-
|
|
3811
|
+
const execContext = stmt.executeContext ? ` ${stmt.executeContext}` : "";
|
|
3812
|
+
this.builder.emitRaw(`execute as ${selector}${execContext} run function ${this.namespace}:${subFnName}`);
|
|
3803
3813
|
const savedBuilder = this.builder;
|
|
3804
3814
|
const savedVarMap = new Map(this.varMap);
|
|
3805
3815
|
const savedContext = this.currentContext;
|
|
@@ -6122,7 +6132,8 @@ var require_passes = __commonJS({
|
|
|
6122
6132
|
...block,
|
|
6123
6133
|
instrs: block.instrs.filter((instr) => {
|
|
6124
6134
|
if (instr.op === "assign" || instr.op === "binop" || instr.op === "cmp") {
|
|
6125
|
-
const
|
|
6135
|
+
const isTemp = /^\$t\d+$/.test(instr.dst) || /^\$p\d+$/.test(instr.dst) || /^\$_\d+$/.test(instr.dst);
|
|
6136
|
+
const keep = !isTemp || readVars.has(instr.dst);
|
|
6126
6137
|
if (!keep)
|
|
6127
6138
|
removed++;
|
|
6128
6139
|
return keep;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "redscript-vscode",
|
|
3
3
|
"displayName": "RedScript for Minecraft",
|
|
4
4
|
"description": "Syntax highlighting, error diagnostics, and language support for RedScript — a compiler targeting Minecraft Java Edition",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.6",
|
|
6
6
|
"publisher": "bkmashiro",
|
|
7
7
|
"icon": "icon.png",
|
|
8
8
|
"license": "MIT",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"patterns": [
|
|
134
134
|
{
|
|
135
135
|
"name": "keyword.control.redscript",
|
|
136
|
-
"match": "\\b(if|else|while|for|foreach|return|match|in|execute|as|at|unless|run|is)\\b"
|
|
136
|
+
"match": "\\b(if|else|while|for|foreach|return|match|in|execute|as|at|unless|run|is|positioned|rotated|facing|anchored|align)\\b"
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"name": "keyword.declaration.redscript",
|