pxt-core 8.2.6 → 8.2.7
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/built/cli.js +1 -0
- package/built/pxt.js +43 -19
- package/built/pxtblockly.js +17 -1
- package/built/pxtblocks.d.ts +1 -0
- package/built/pxtblocks.js +17 -1
- package/built/pxteditor.js +5 -0
- package/built/pxtlib.js +3 -3
- package/built/pxtpy.d.ts +1 -0
- package/built/pxtpy.js +39 -16
- package/built/target.js +1 -1
- package/built/web/blockly.css +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtblockly.js +1 -1
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxteditor.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.js +1 -1
- package/built/web/pxtpy.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/react-common-authcode.css +98 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/css/main.3684f34d.chunk.css +1 -0
- package/built/web/skillmap/js/2.26325281.chunk.js +2 -0
- package/built/web/skillmap/js/main.b87a119c.chunk.js +1 -0
- package/localtypings/react.d.ts +5 -0
- package/package.json +1 -1
- package/react-common/components/controls/Checkbox.tsx +1 -1
- package/react-common/components/palette/ColorPickerField.tsx +65 -0
- package/react-common/components/palette/PaletteEditor.tsx +66 -0
- package/react-common/components/palette/PalettePicker.tsx +52 -0
- package/react-common/components/palette/PaletteSwatch.tsx +27 -0
- package/react-common/components/palette/Palettes.ts +289 -0
- package/react-common/components/profile/SignInModal.tsx +100 -0
- package/react-common/components/profile/UserPane.tsx +17 -9
- package/react-common/styles/palette/ColorPickerField.less +21 -0
- package/react-common/styles/palette/PalettePicker.less +10 -0
- package/react-common/styles/palette/PaletteSwatch.less +27 -0
- package/react-common/styles/palette/palette.less +3 -0
- package/react-common/styles/profile/profile.less +64 -1
- package/react-common/styles/react-common.less +1 -0
- package/theme/blockly-core.less +1 -1
- package/theme/common.less +13 -2
- package/theme/image-editor/bottomBar.less +1 -1
- package/theme/tutorial-sidebar.less +2 -2
- package/webapp/public/skillmap.html +2 -2
- package/built/web/skillmap/css/main.c5811548.chunk.css +0 -1
- package/built/web/skillmap/js/2.26b9a6f6.chunk.js +0 -2
- package/built/web/skillmap/js/main.98eed582.chunk.js +0 -1
package/built/cli.js
CHANGED
|
@@ -2029,6 +2029,7 @@ async function buildTargetCoreAsync(options = {}) {
|
|
|
2029
2029
|
updateTOC(cfg);
|
|
2030
2030
|
cfg.bundledpkgs = {};
|
|
2031
2031
|
pxt.setAppTarget(cfg);
|
|
2032
|
+
pxt.reloadAppTargetVariant();
|
|
2032
2033
|
dirsToWatch = cfg.bundleddirs.slice();
|
|
2033
2034
|
if (pxt.appTarget.id != "core") {
|
|
2034
2035
|
if (fs.existsSync("theme")) {
|
package/built/pxt.js
CHANGED
|
@@ -101796,7 +101796,7 @@ var pxt;
|
|
|
101796
101796
|
MATH_ADDITION_SYMBOL: pxt.Util.lf("{id:op}+"),
|
|
101797
101797
|
MATH_SUBTRACTION_SYMBOL: pxt.Util.lf("{id:op}-"),
|
|
101798
101798
|
MATH_MULTIPLICATION_SYMBOL: pxt.Util.lf("{id:op}×"),
|
|
101799
|
-
MATH_DIVISION_SYMBOL: pxt.Util.lf("{id:op}
|
|
101799
|
+
MATH_DIVISION_SYMBOL: pxt.Util.lf("{id:op}/"),
|
|
101800
101800
|
MATH_POWER_SYMBOL: pxt.Util.lf("{id:op}**")
|
|
101801
101801
|
}
|
|
101802
101802
|
},
|
|
@@ -101806,7 +101806,7 @@ var pxt;
|
|
|
101806
101806
|
url: '/blocks/math',
|
|
101807
101807
|
category: 'math',
|
|
101808
101808
|
block: {
|
|
101809
|
-
MATH_MODULO_TITLE: pxt.Util.lf("remainder of %1
|
|
101809
|
+
MATH_MODULO_TITLE: pxt.Util.lf("remainder of %1 / %2")
|
|
101810
101810
|
}
|
|
101811
101811
|
},
|
|
101812
101812
|
'math_js_op': {
|
|
@@ -101835,7 +101835,7 @@ var pxt;
|
|
|
101835
101835
|
"acos": pxt.Util.lf("{id:op}acos"),
|
|
101836
101836
|
"tan": pxt.Util.lf("{id:op}tan"),
|
|
101837
101837
|
"atan2": pxt.Util.lf("{id:op}atan2"),
|
|
101838
|
-
"idiv": pxt.Util.lf("{id:op}integer
|
|
101838
|
+
"idiv": pxt.Util.lf("{id:op}integer /"),
|
|
101839
101839
|
"imul": pxt.Util.lf("{id:op}integer ×"),
|
|
101840
101840
|
}
|
|
101841
101841
|
},
|
|
@@ -140897,6 +140897,13 @@ var pxt;
|
|
|
140897
140897
|
error(a, 9503, pxt.U.lf("No module named '{0}'", name));
|
|
140898
140898
|
return sym;
|
|
140899
140899
|
}
|
|
140900
|
+
function getHelperVariableName() {
|
|
140901
|
+
const scope = currentScope();
|
|
140902
|
+
if (scope.nextHelperVariableId === undefined) {
|
|
140903
|
+
scope.nextHelperVariableId = 0;
|
|
140904
|
+
}
|
|
140905
|
+
return "___tempvar" + scope.nextHelperVariableId++;
|
|
140906
|
+
}
|
|
140900
140907
|
function defvar(name, opts, modifier, scope) {
|
|
140901
140908
|
if (!scope)
|
|
140902
140909
|
scope = currentScope();
|
|
@@ -142203,20 +142210,7 @@ var pxt;
|
|
|
142203
142210
|
return B.mkStmt(B.mkText(pref), B.mkInfix(expr(target), "=", expr(value)));
|
|
142204
142211
|
}
|
|
142205
142212
|
if (!pref && target.kind == "Tuple") {
|
|
142206
|
-
|
|
142207
|
-
let targs = [B.mkText("let "), B.mkText("[")];
|
|
142208
|
-
let nonNames = tup.elts.filter(e => e.kind !== "Name");
|
|
142209
|
-
if (nonNames.length) {
|
|
142210
|
-
error(n, 9556, pxt.U.lf("non-trivial tuple assignment unsupported"));
|
|
142211
|
-
return stmtTODO(n);
|
|
142212
|
-
}
|
|
142213
|
-
let tupNames = tup.elts
|
|
142214
|
-
.map(e => e)
|
|
142215
|
-
.map(convertName);
|
|
142216
|
-
targs.push(B.mkCommaSep(tupNames));
|
|
142217
|
-
targs.push(B.mkText("]"));
|
|
142218
|
-
let res = B.mkStmt(B.mkInfix(B.mkGroup(targs), "=", expr(value)));
|
|
142219
|
-
return res;
|
|
142213
|
+
return convertDestructuring(n, target, value);
|
|
142220
142214
|
}
|
|
142221
142215
|
if (target.kind === "Name") {
|
|
142222
142216
|
const scopeSym = currentScope().vars[nm];
|
|
@@ -142244,12 +142238,41 @@ var pxt;
|
|
|
142244
142238
|
if (!lExp)
|
|
142245
142239
|
lExp = expr(target);
|
|
142246
142240
|
return B.mkStmt(B.mkText(pref), B.mkInfix(lExp, "=", expr(value)));
|
|
142247
|
-
|
|
142241
|
+
}
|
|
142242
|
+
function convertDestructuring(parent, targets, value) {
|
|
142243
|
+
let nonNames = targets.elts.filter(e => e.kind !== "Name");
|
|
142244
|
+
if (nonNames.length) {
|
|
142245
|
+
error(parent, 9556, pxt.U.lf("non-trivial tuple assignment unsupported"));
|
|
142246
|
+
return stmtTODO(parent);
|
|
142247
|
+
}
|
|
142248
|
+
const names = targets.elts.map(tryGetName);
|
|
142249
|
+
const symbols = names
|
|
142250
|
+
.map(nm => nm ? currentScope().vars[nm] : undefined);
|
|
142251
|
+
if (symbols.some(s => (s === null || s === void 0 ? void 0 : s.modifier) !== undefined)) {
|
|
142252
|
+
const helperVar = getHelperVariableName();
|
|
142253
|
+
const valueAssign = B.mkStmt(B.mkInfix(B.mkGroup([B.mkText("let "), B.mkText(helperVar)]), "=", expr(value)));
|
|
142254
|
+
const assignStatements = [valueAssign];
|
|
142255
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
142256
|
+
const name = convertName(targets.elts[i]);
|
|
142257
|
+
assignStatements.push(B.mkStmt(B.mkInfix(name, "=", B.mkGroup([B.mkText(helperVar), B.mkText(`[${i}]`)]))));
|
|
142258
|
+
}
|
|
142259
|
+
return B.mkGroup(assignStatements);
|
|
142260
|
+
}
|
|
142261
|
+
else {
|
|
142262
|
+
let targs = [B.mkText("let "), B.mkText("[")];
|
|
142263
|
+
let tupNames = targets.elts
|
|
142264
|
+
.map(e => e)
|
|
142265
|
+
.map(e => convertName(e, true));
|
|
142266
|
+
targs.push(B.mkCommaSep(tupNames));
|
|
142267
|
+
targs.push(B.mkText("]"));
|
|
142268
|
+
return B.mkStmt(B.mkInfix(B.mkGroup(targs), "=", expr(value)));
|
|
142269
|
+
}
|
|
142270
|
+
function convertName(n, excludeLet = false) {
|
|
142248
142271
|
// TODO resuse with Name expr
|
|
142249
142272
|
markInfoNode(n, "identifierCompletion");
|
|
142250
142273
|
typeOf(n);
|
|
142251
142274
|
let v = lookupName(n);
|
|
142252
|
-
return possibleDef(n,
|
|
142275
|
+
return possibleDef(n, excludeLet);
|
|
142253
142276
|
}
|
|
142254
142277
|
}
|
|
142255
142278
|
function possibleDef(n, excludeLet = false) {
|
|
@@ -159815,6 +159838,7 @@ async function buildTargetCoreAsync(options = {}) {
|
|
|
159815
159838
|
updateTOC(cfg);
|
|
159816
159839
|
cfg.bundledpkgs = {};
|
|
159817
159840
|
pxt.setAppTarget(cfg);
|
|
159841
|
+
pxt.reloadAppTargetVariant();
|
|
159818
159842
|
dirsToWatch = cfg.bundleddirs.slice();
|
|
159819
159843
|
if (pxt.appTarget.id != "core") {
|
|
159820
159844
|
if (fs.existsSync("theme")) {
|
package/built/pxtblockly.js
CHANGED
|
@@ -6747,6 +6747,22 @@ var pxt;
|
|
|
6747
6747
|
}
|
|
6748
6748
|
});
|
|
6749
6749
|
}
|
|
6750
|
+
function validateAllReferencedBlocksExist(xml) {
|
|
6751
|
+
pxt.U.assert(!!(Blockly === null || Blockly === void 0 ? void 0 : Blockly.Blocks), "Called validateAllReferencedBlocksExist before initializing Blockly");
|
|
6752
|
+
const dom = Blockly.Xml.textToDom(xml);
|
|
6753
|
+
const blocks = dom.querySelectorAll("block");
|
|
6754
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
6755
|
+
if (!Blockly.Blocks[blocks.item(i).getAttribute("type")])
|
|
6756
|
+
return false;
|
|
6757
|
+
}
|
|
6758
|
+
const shadows = dom.querySelectorAll("shadow");
|
|
6759
|
+
for (let i = 0; i < shadows.length; i++) {
|
|
6760
|
+
if (!Blockly.Blocks[shadows.item(i).getAttribute("type")])
|
|
6761
|
+
return false;
|
|
6762
|
+
}
|
|
6763
|
+
return true;
|
|
6764
|
+
}
|
|
6765
|
+
blocks_2.validateAllReferencedBlocksExist = validateAllReferencedBlocksExist;
|
|
6750
6766
|
})(blocks = pxt.blocks || (pxt.blocks = {}));
|
|
6751
6767
|
})(pxt || (pxt = {}));
|
|
6752
6768
|
var pxt;
|
|
@@ -6768,6 +6784,7 @@ var pxt;
|
|
|
6768
6784
|
const newDom = Blockly.Xml.workspaceToDom(newWs, true);
|
|
6769
6785
|
pxt.Util.toArray(oldDom.childNodes)
|
|
6770
6786
|
.filter((n) => n.nodeType == Node.ELEMENT_NODE && n.localName == "block" && n.getAttribute("disabled") == "true")
|
|
6787
|
+
.filter((n) => !!Blockly.Blocks[n.getAttribute("type")])
|
|
6771
6788
|
.forEach(n => newDom.appendChild(newDom.ownerDocument.importNode(n, true)));
|
|
6772
6789
|
const updatedXml = Blockly.Xml.domToText(newDom);
|
|
6773
6790
|
return updatedXml;
|
|
@@ -11951,7 +11968,6 @@ var pxtblockly;
|
|
|
11951
11968
|
this.fieldGroup_.appendChild(bg.el);
|
|
11952
11969
|
const icon = new svg.Text("\uf008")
|
|
11953
11970
|
.at(X_PADDING, 5 + (TOTAL_HEIGHT >> 1))
|
|
11954
|
-
.fill(this.sourceBlock_.getColourSecondary())
|
|
11955
11971
|
.setClass("semanticIcon");
|
|
11956
11972
|
this.fieldGroup_.appendChild(icon.el);
|
|
11957
11973
|
if (this.asset) {
|
package/built/pxtblocks.d.ts
CHANGED
|
@@ -157,6 +157,7 @@ declare namespace pxt.blocks {
|
|
|
157
157
|
*/
|
|
158
158
|
let extensionBlocklyPatch: (pkgTargetVersion: string, dom: Element) => void;
|
|
159
159
|
function importXml(pkgTargetVersion: string, xml: string, info: pxtc.BlocksInfo, skipReport?: boolean): string;
|
|
160
|
+
function validateAllReferencedBlocksExist(xml: string): boolean;
|
|
160
161
|
}
|
|
161
162
|
declare namespace pxt.blocks.layout {
|
|
162
163
|
interface FlowOptions {
|
package/built/pxtblocks.js
CHANGED
|
@@ -3185,6 +3185,22 @@ var pxt;
|
|
|
3185
3185
|
}
|
|
3186
3186
|
});
|
|
3187
3187
|
}
|
|
3188
|
+
function validateAllReferencedBlocksExist(xml) {
|
|
3189
|
+
pxt.U.assert(!!(Blockly === null || Blockly === void 0 ? void 0 : Blockly.Blocks), "Called validateAllReferencedBlocksExist before initializing Blockly");
|
|
3190
|
+
const dom = Blockly.Xml.textToDom(xml);
|
|
3191
|
+
const blocks = dom.querySelectorAll("block");
|
|
3192
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
3193
|
+
if (!Blockly.Blocks[blocks.item(i).getAttribute("type")])
|
|
3194
|
+
return false;
|
|
3195
|
+
}
|
|
3196
|
+
const shadows = dom.querySelectorAll("shadow");
|
|
3197
|
+
for (let i = 0; i < shadows.length; i++) {
|
|
3198
|
+
if (!Blockly.Blocks[shadows.item(i).getAttribute("type")])
|
|
3199
|
+
return false;
|
|
3200
|
+
}
|
|
3201
|
+
return true;
|
|
3202
|
+
}
|
|
3203
|
+
blocks_2.validateAllReferencedBlocksExist = validateAllReferencedBlocksExist;
|
|
3188
3204
|
})(blocks = pxt.blocks || (pxt.blocks = {}));
|
|
3189
3205
|
})(pxt || (pxt = {}));
|
|
3190
3206
|
var pxt;
|
|
@@ -3206,6 +3222,7 @@ var pxt;
|
|
|
3206
3222
|
const newDom = Blockly.Xml.workspaceToDom(newWs, true);
|
|
3207
3223
|
pxt.Util.toArray(oldDom.childNodes)
|
|
3208
3224
|
.filter((n) => n.nodeType == Node.ELEMENT_NODE && n.localName == "block" && n.getAttribute("disabled") == "true")
|
|
3225
|
+
.filter((n) => !!Blockly.Blocks[n.getAttribute("type")])
|
|
3209
3226
|
.forEach(n => newDom.appendChild(newDom.ownerDocument.importNode(n, true)));
|
|
3210
3227
|
const updatedXml = Blockly.Xml.domToText(newDom);
|
|
3211
3228
|
return updatedXml;
|
|
@@ -8389,7 +8406,6 @@ var pxtblockly;
|
|
|
8389
8406
|
this.fieldGroup_.appendChild(bg.el);
|
|
8390
8407
|
const icon = new svg.Text("\uf008")
|
|
8391
8408
|
.at(X_PADDING, 5 + (TOTAL_HEIGHT >> 1))
|
|
8392
|
-
.fill(this.sourceBlock_.getColourSecondary())
|
|
8393
8409
|
.setClass("semanticIcon");
|
|
8394
8410
|
this.fieldGroup_.appendChild(icon.el);
|
|
8395
8411
|
if (this.asset) {
|
package/built/pxteditor.js
CHANGED
|
@@ -558,6 +558,11 @@ var pxt;
|
|
|
558
558
|
name: lf("Blocks Error List"),
|
|
559
559
|
description: lf("Show an error list panel for Blocks")
|
|
560
560
|
},
|
|
561
|
+
{
|
|
562
|
+
id: "palettePicker",
|
|
563
|
+
name: lf("Change Color Palette"),
|
|
564
|
+
description: lf("Change the game palette in project settings")
|
|
565
|
+
},
|
|
561
566
|
].filter(experiment => ids.indexOf(experiment.id) > -1 && !(pxt.BrowserUtils.isPxtElectron() && experiment.enableOnline));
|
|
562
567
|
}
|
|
563
568
|
experiments_1.all = all;
|
package/built/pxtlib.js
CHANGED
|
@@ -4110,7 +4110,7 @@ var pxt;
|
|
|
4110
4110
|
MATH_ADDITION_SYMBOL: pxt.Util.lf("{id:op}+"),
|
|
4111
4111
|
MATH_SUBTRACTION_SYMBOL: pxt.Util.lf("{id:op}-"),
|
|
4112
4112
|
MATH_MULTIPLICATION_SYMBOL: pxt.Util.lf("{id:op}×"),
|
|
4113
|
-
MATH_DIVISION_SYMBOL: pxt.Util.lf("{id:op}
|
|
4113
|
+
MATH_DIVISION_SYMBOL: pxt.Util.lf("{id:op}/"),
|
|
4114
4114
|
MATH_POWER_SYMBOL: pxt.Util.lf("{id:op}**")
|
|
4115
4115
|
}
|
|
4116
4116
|
},
|
|
@@ -4120,7 +4120,7 @@ var pxt;
|
|
|
4120
4120
|
url: '/blocks/math',
|
|
4121
4121
|
category: 'math',
|
|
4122
4122
|
block: {
|
|
4123
|
-
MATH_MODULO_TITLE: pxt.Util.lf("remainder of %1
|
|
4123
|
+
MATH_MODULO_TITLE: pxt.Util.lf("remainder of %1 / %2")
|
|
4124
4124
|
}
|
|
4125
4125
|
},
|
|
4126
4126
|
'math_js_op': {
|
|
@@ -4149,7 +4149,7 @@ var pxt;
|
|
|
4149
4149
|
"acos": pxt.Util.lf("{id:op}acos"),
|
|
4150
4150
|
"tan": pxt.Util.lf("{id:op}tan"),
|
|
4151
4151
|
"atan2": pxt.Util.lf("{id:op}atan2"),
|
|
4152
|
-
"idiv": pxt.Util.lf("{id:op}integer
|
|
4152
|
+
"idiv": pxt.Util.lf("{id:op}integer /"),
|
|
4153
4153
|
"imul": pxt.Util.lf("{id:op}integer ×"),
|
|
4154
4154
|
}
|
|
4155
4155
|
},
|
package/built/pxtpy.d.ts
CHANGED
package/built/pxtpy.js
CHANGED
|
@@ -342,6 +342,13 @@ var pxt;
|
|
|
342
342
|
error(a, 9503, pxt.U.lf("No module named '{0}'", name));
|
|
343
343
|
return sym;
|
|
344
344
|
}
|
|
345
|
+
function getHelperVariableName() {
|
|
346
|
+
const scope = currentScope();
|
|
347
|
+
if (scope.nextHelperVariableId === undefined) {
|
|
348
|
+
scope.nextHelperVariableId = 0;
|
|
349
|
+
}
|
|
350
|
+
return "___tempvar" + scope.nextHelperVariableId++;
|
|
351
|
+
}
|
|
345
352
|
function defvar(name, opts, modifier, scope) {
|
|
346
353
|
if (!scope)
|
|
347
354
|
scope = currentScope();
|
|
@@ -1648,20 +1655,7 @@ var pxt;
|
|
|
1648
1655
|
return B.mkStmt(B.mkText(pref), B.mkInfix(expr(target), "=", expr(value)));
|
|
1649
1656
|
}
|
|
1650
1657
|
if (!pref && target.kind == "Tuple") {
|
|
1651
|
-
|
|
1652
|
-
let targs = [B.mkText("let "), B.mkText("[")];
|
|
1653
|
-
let nonNames = tup.elts.filter(e => e.kind !== "Name");
|
|
1654
|
-
if (nonNames.length) {
|
|
1655
|
-
error(n, 9556, pxt.U.lf("non-trivial tuple assignment unsupported"));
|
|
1656
|
-
return stmtTODO(n);
|
|
1657
|
-
}
|
|
1658
|
-
let tupNames = tup.elts
|
|
1659
|
-
.map(e => e)
|
|
1660
|
-
.map(convertName);
|
|
1661
|
-
targs.push(B.mkCommaSep(tupNames));
|
|
1662
|
-
targs.push(B.mkText("]"));
|
|
1663
|
-
let res = B.mkStmt(B.mkInfix(B.mkGroup(targs), "=", expr(value)));
|
|
1664
|
-
return res;
|
|
1658
|
+
return convertDestructuring(n, target, value);
|
|
1665
1659
|
}
|
|
1666
1660
|
if (target.kind === "Name") {
|
|
1667
1661
|
const scopeSym = currentScope().vars[nm];
|
|
@@ -1689,12 +1683,41 @@ var pxt;
|
|
|
1689
1683
|
if (!lExp)
|
|
1690
1684
|
lExp = expr(target);
|
|
1691
1685
|
return B.mkStmt(B.mkText(pref), B.mkInfix(lExp, "=", expr(value)));
|
|
1692
|
-
|
|
1686
|
+
}
|
|
1687
|
+
function convertDestructuring(parent, targets, value) {
|
|
1688
|
+
let nonNames = targets.elts.filter(e => e.kind !== "Name");
|
|
1689
|
+
if (nonNames.length) {
|
|
1690
|
+
error(parent, 9556, pxt.U.lf("non-trivial tuple assignment unsupported"));
|
|
1691
|
+
return stmtTODO(parent);
|
|
1692
|
+
}
|
|
1693
|
+
const names = targets.elts.map(tryGetName);
|
|
1694
|
+
const symbols = names
|
|
1695
|
+
.map(nm => nm ? currentScope().vars[nm] : undefined);
|
|
1696
|
+
if (symbols.some(s => (s === null || s === void 0 ? void 0 : s.modifier) !== undefined)) {
|
|
1697
|
+
const helperVar = getHelperVariableName();
|
|
1698
|
+
const valueAssign = B.mkStmt(B.mkInfix(B.mkGroup([B.mkText("let "), B.mkText(helperVar)]), "=", expr(value)));
|
|
1699
|
+
const assignStatements = [valueAssign];
|
|
1700
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1701
|
+
const name = convertName(targets.elts[i]);
|
|
1702
|
+
assignStatements.push(B.mkStmt(B.mkInfix(name, "=", B.mkGroup([B.mkText(helperVar), B.mkText(`[${i}]`)]))));
|
|
1703
|
+
}
|
|
1704
|
+
return B.mkGroup(assignStatements);
|
|
1705
|
+
}
|
|
1706
|
+
else {
|
|
1707
|
+
let targs = [B.mkText("let "), B.mkText("[")];
|
|
1708
|
+
let tupNames = targets.elts
|
|
1709
|
+
.map(e => e)
|
|
1710
|
+
.map(e => convertName(e, true));
|
|
1711
|
+
targs.push(B.mkCommaSep(tupNames));
|
|
1712
|
+
targs.push(B.mkText("]"));
|
|
1713
|
+
return B.mkStmt(B.mkInfix(B.mkGroup(targs), "=", expr(value)));
|
|
1714
|
+
}
|
|
1715
|
+
function convertName(n, excludeLet = false) {
|
|
1693
1716
|
// TODO resuse with Name expr
|
|
1694
1717
|
markInfoNode(n, "identifierCompletion");
|
|
1695
1718
|
typeOf(n);
|
|
1696
1719
|
let v = lookupName(n);
|
|
1697
|
-
return possibleDef(n,
|
|
1720
|
+
return possibleDef(n, excludeLet);
|
|
1698
1721
|
}
|
|
1699
1722
|
}
|
|
1700
1723
|
function possibleDef(n, excludeLet = false) {
|