pxt-core 8.2.12 → 8.2.14
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/buildengine.js +3 -3
- package/built/cli.js +5 -5
- package/built/gdb.js +4 -4
- package/built/nodeutil.d.ts +1 -0
- package/built/pxt.js +366 -364
- package/built/pxtblockly.js +35 -35
- package/built/pxtblocks.js +35 -35
- package/built/pxtcompiler.js +162 -160
- package/built/pxteditor.d.ts +15 -3
- package/built/pxteditor.js +6 -6
- package/built/pxtlib.d.ts +2 -1
- package/built/pxtlib.js +162 -161
- package/built/pxtpy.js +34 -35
- package/built/pxtsim.d.ts +5 -5
- package/built/pxtsim.js +3 -3
- package/built/server.js +5 -5
- package/built/storage.js +4 -4
- package/built/target.js +1 -1
- package/built/web/main.js +1 -1
- package/built/web/pxtapp.js +1 -1
- package/built/web/pxtasseteditor.js +1 -1
- package/built/web/pxtcompiler.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/pxtsim.js +1 -1
- package/built/web/pxtworker.js +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/built/web/skillmap/js/2.960f04a5.chunk.js +2 -0
- package/built/web/skillmap/js/main.44b2383f.chunk.js +1 -0
- package/common-docs/static/logo/social-buttons/google-classroom.png +0 -0
- package/common-docs/static/logo/social-buttons/microsoft-teams.png +0 -0
- package/docfiles/pxtweb/tsconfig.json +2 -1
- package/localtypings/dom.d.ts +3 -0
- package/localtypings/react.d.ts +1 -1
- package/package.json +6 -6
- package/react-common/components/controls/Modal.tsx +2 -2
- package/react-common/components/share/ShareInfo.tsx +1 -1
- package/react-common/tsconfig.json +3 -2
- package/theme/common.less +5 -3
- package/theme/highcontrast.less +3 -0
- package/theme/toolbox.less +25 -0
- package/theme/tutorial-sidebar.less +171 -115
- package/webapp/public/skillmap.html +1 -1
- package/built/web/skillmap/js/2.26325281.chunk.js +0 -2
- package/built/web/skillmap/js/main.d94a2bd9.chunk.js +0 -1
package/built/pxtcompiler.js
CHANGED
|
@@ -438,7 +438,7 @@ var ts;
|
|
|
438
438
|
const decl = getDecl(child);
|
|
439
439
|
if (decl && decl.getSourceFile().fileName !== pxt.MAIN_TS && decl.kind == ts.SyntaxKind.VariableDeclaration) {
|
|
440
440
|
const info = pxtc.pxtInfo(child);
|
|
441
|
-
info.flags |= 4 /* IsGlobalIdentifier */;
|
|
441
|
+
info.flags |= 4 /* PxtNodeFlags.IsGlobalIdentifier */;
|
|
442
442
|
if (!info.commentAttrs) {
|
|
443
443
|
info.commentAttrs = pxtc.parseComments(decl);
|
|
444
444
|
}
|
|
@@ -554,7 +554,7 @@ var ts;
|
|
|
554
554
|
symbol: { isBogusSymbol: true, name: namedNode.name.getText() },
|
|
555
555
|
name: namedNode.name,
|
|
556
556
|
};
|
|
557
|
-
pxtc.pxtInfo(decl).flags |= 2 /* IsBogusFunction */;
|
|
557
|
+
pxtc.pxtInfo(decl).flags |= 2 /* PxtNodeFlags.IsBogusFunction */;
|
|
558
558
|
}
|
|
559
559
|
return decl;
|
|
560
560
|
}
|
|
@@ -1072,7 +1072,7 @@ ${baseLabel}_nochk:
|
|
|
1072
1072
|
else if (inf.size == 2) {
|
|
1073
1073
|
inf.immLimit = 64;
|
|
1074
1074
|
}
|
|
1075
|
-
if (b == 1 /* Int8 */ || b == 3 /* Int16 */) {
|
|
1075
|
+
if (b == 1 /* BitSize.Int8 */ || b == 3 /* BitSize.Int16 */) {
|
|
1076
1076
|
inf.needsSignExt = true;
|
|
1077
1077
|
}
|
|
1078
1078
|
return inf;
|
|
@@ -2661,7 +2661,7 @@ function ${id}(s) {
|
|
|
2661
2661
|
text = args.length == 2 ? `(${args[0]} ${pxtc.U.lookup(jsOpMap, name)} ${args[1]})` : `(${pxtc.U.lookup(jsOpMap, name)} ${args[0]})`;
|
|
2662
2662
|
else
|
|
2663
2663
|
text = `${shimToJs(name)}(${args.join(", ")})`;
|
|
2664
|
-
if (topExpr.callingConvention == 0 /* Plain */) {
|
|
2664
|
+
if (topExpr.callingConvention == 0 /* ir.CallingConvention.Plain */) {
|
|
2665
2665
|
write(`r0 = ${text};`);
|
|
2666
2666
|
}
|
|
2667
2667
|
else {
|
|
@@ -2670,7 +2670,7 @@ function ${id}(s) {
|
|
|
2670
2670
|
if (name == "String_::stringConv") {
|
|
2671
2671
|
write(`if ((${args[0]}) && (${args[0]}).vtable) {`);
|
|
2672
2672
|
}
|
|
2673
|
-
if (topExpr.callingConvention == 2 /* Promise */) {
|
|
2673
|
+
if (topExpr.callingConvention == 2 /* ir.CallingConvention.Promise */) {
|
|
2674
2674
|
write(`(function(cb) { ${text}.then(cb) })(buildResume(s, ${loc}));`);
|
|
2675
2675
|
}
|
|
2676
2676
|
else {
|
|
@@ -2793,13 +2793,13 @@ function ${id}(s) {
|
|
|
2793
2793
|
}
|
|
2794
2794
|
function bitSizeConverter(b) {
|
|
2795
2795
|
switch (b) {
|
|
2796
|
-
case 0 /* None */: return "";
|
|
2797
|
-
case 1 /* Int8 */: return "pxtrt.toInt8";
|
|
2798
|
-
case 3 /* Int16 */: return "pxtrt.toInt16";
|
|
2799
|
-
case 5 /* Int32 */: return "pxtrt.toInt32";
|
|
2800
|
-
case 2 /* UInt8 */: return "pxtrt.toUInt8";
|
|
2801
|
-
case 4 /* UInt16 */: return "pxtrt.toUInt16";
|
|
2802
|
-
case 6 /* UInt32 */: return "pxtrt.toUInt32";
|
|
2796
|
+
case 0 /* BitSize.None */: return "";
|
|
2797
|
+
case 1 /* BitSize.Int8 */: return "pxtrt.toInt8";
|
|
2798
|
+
case 3 /* BitSize.Int16 */: return "pxtrt.toInt16";
|
|
2799
|
+
case 5 /* BitSize.Int32 */: return "pxtrt.toInt32";
|
|
2800
|
+
case 2 /* BitSize.UInt8 */: return "pxtrt.toUInt8";
|
|
2801
|
+
case 4 /* BitSize.UInt16 */: return "pxtrt.toUInt16";
|
|
2802
|
+
case 6 /* BitSize.UInt32 */: return "pxtrt.toUInt32";
|
|
2803
2803
|
default: throw pxtc.oops();
|
|
2804
2804
|
}
|
|
2805
2805
|
}
|
|
@@ -3948,7 +3948,7 @@ _start_${name}:
|
|
|
3948
3948
|
emitExpr(src);
|
|
3949
3949
|
let cell = trg.data;
|
|
3950
3950
|
let instr = "st" + cellref(cell);
|
|
3951
|
-
if (cell.isGlobal() && (cell.bitSize != 0 /* None */)) {
|
|
3951
|
+
if (cell.isGlobal() && (cell.bitSize != 0 /* BitSize.None */)) {
|
|
3952
3952
|
const enc = pxtc.sizeOfBitSize(cell.bitSize) |
|
|
3953
3953
|
(pxtc.isBitSizeSigned(cell.bitSize) ? 0x10 : 0x00);
|
|
3954
3954
|
write("bitconv " + enc);
|
|
@@ -4360,7 +4360,7 @@ ${output}</xml>`;
|
|
|
4360
4360
|
}
|
|
4361
4361
|
return {
|
|
4362
4362
|
paramDefl: {},
|
|
4363
|
-
callingConvention: 0 /* Plain */
|
|
4363
|
+
callingConvention: 0 /* ir.CallingConvention.Plain */
|
|
4364
4364
|
};
|
|
4365
4365
|
}
|
|
4366
4366
|
function compInfo(callInfo) {
|
|
@@ -6849,7 +6849,7 @@ ${output}</xml>`;
|
|
|
6849
6849
|
const parentInfo = pxtc.pxtInfo(parent).callInfo;
|
|
6850
6850
|
if (parentInfo && parentInfo.args) {
|
|
6851
6851
|
const api = env.blocks.apis.byQName[parentInfo.qName];
|
|
6852
|
-
const instance = api.kind == 1 /* Method */ || api.kind == 2 /* Property */;
|
|
6852
|
+
const instance = api.kind == 1 /* pxtc.SymbolKind.Method */ || api.kind == 2 /* pxtc.SymbolKind.Property */;
|
|
6853
6853
|
if (api) {
|
|
6854
6854
|
parentInfo.args.forEach((arg, i) => {
|
|
6855
6855
|
if (arg === child) {
|
|
@@ -6966,7 +6966,7 @@ ${output}</xml>`;
|
|
|
6966
6966
|
return node && node.kind === SK.Identifier && node.text === "undefined";
|
|
6967
6967
|
}
|
|
6968
6968
|
function isDeclaredElsewhere(node) {
|
|
6969
|
-
return !!(pxtc.pxtInfo(node).flags & 4 /* IsGlobalIdentifier */);
|
|
6969
|
+
return !!(pxtc.pxtInfo(node).flags & 4 /* PxtNodeFlags.IsGlobalIdentifier */);
|
|
6970
6970
|
}
|
|
6971
6971
|
function hasStatementInput(info, attributes) {
|
|
6972
6972
|
if (attributes.blockId === pxtc.PAUSE_UNTIL_TYPE)
|
|
@@ -7339,21 +7339,21 @@ var ts;
|
|
|
7339
7339
|
if (!sym)
|
|
7340
7340
|
return undefined;
|
|
7341
7341
|
switch (sym.kind) {
|
|
7342
|
-
case 3 /* Function */:
|
|
7343
|
-
case 1 /* Method */:
|
|
7342
|
+
case 3 /* SymbolKind.Function */:
|
|
7343
|
+
case 1 /* SymbolKind.Method */:
|
|
7344
7344
|
return displayStringForFunction(sym, python, apiInfo);
|
|
7345
|
-
case 6 /* Enum */:
|
|
7346
|
-
case 7 /* EnumMember */:
|
|
7345
|
+
case 6 /* SymbolKind.Enum */:
|
|
7346
|
+
case 7 /* SymbolKind.EnumMember */:
|
|
7347
7347
|
return displayStringForEnum(sym, python);
|
|
7348
|
-
case 5 /* Module */:
|
|
7348
|
+
case 5 /* SymbolKind.Module */:
|
|
7349
7349
|
return displayStringForNamepsace(sym, python);
|
|
7350
|
-
case 9 /* Interface */:
|
|
7350
|
+
case 9 /* SymbolKind.Interface */:
|
|
7351
7351
|
return displayStringForInterface(sym, python);
|
|
7352
|
-
case 8 /* Class */:
|
|
7352
|
+
case 8 /* SymbolKind.Class */:
|
|
7353
7353
|
return displayStringForClass(sym, python);
|
|
7354
|
-
case 4 /* Variable */:
|
|
7354
|
+
case 4 /* SymbolKind.Variable */:
|
|
7355
7355
|
return displayStringForVariable(sym, python, apiInfo);
|
|
7356
|
-
case 2 /* Property */:
|
|
7356
|
+
case 2 /* SymbolKind.Property */:
|
|
7357
7357
|
return displayStringForProperty(sym, python, apiInfo);
|
|
7358
7358
|
}
|
|
7359
7359
|
return `**${sym.qName}**`;
|
|
@@ -7365,7 +7365,7 @@ var ts;
|
|
|
7365
7365
|
service.displayStringForKeyword = displayStringForKeyword;
|
|
7366
7366
|
function displayStringForFunction(sym, python, apiInfo) {
|
|
7367
7367
|
let prefix = "";
|
|
7368
|
-
if (sym.kind === 3 /* Function */) {
|
|
7368
|
+
if (sym.kind === 3 /* SymbolKind.Function */) {
|
|
7369
7369
|
prefix += python ? "def " : "function ";
|
|
7370
7370
|
}
|
|
7371
7371
|
else {
|
|
@@ -7384,7 +7384,7 @@ var ts;
|
|
|
7384
7384
|
}
|
|
7385
7385
|
function displayStringForEnum(sym, python) {
|
|
7386
7386
|
const qName = python ? sym.pyQName : sym.qName;
|
|
7387
|
-
if (sym.kind === 6 /* Enum */) {
|
|
7387
|
+
if (sym.kind === 6 /* SymbolKind.Enum */) {
|
|
7388
7388
|
return codeBlock(`enum ${qName}`, python);
|
|
7389
7389
|
}
|
|
7390
7390
|
let memberString = `(enum member) ${qName}`;
|
|
@@ -8028,7 +8028,7 @@ var ts;
|
|
|
8028
8028
|
this.exprKind = exprKind;
|
|
8029
8029
|
this.args = args;
|
|
8030
8030
|
this.data = data;
|
|
8031
|
-
this.callingConvention = 0 /* Plain */;
|
|
8031
|
+
this.callingConvention = 0 /* CallingConvention.Plain */;
|
|
8032
8032
|
}
|
|
8033
8033
|
static clone(e) {
|
|
8034
8034
|
let copy = new Expr(e.exprKind, e.args ? e.args.slice(0) : null, e.data);
|
|
@@ -8236,7 +8236,7 @@ var ts;
|
|
|
8236
8236
|
this._isGlobal = false;
|
|
8237
8237
|
this._debugType = "?";
|
|
8238
8238
|
this.isUserVariable = false;
|
|
8239
|
-
this.bitSize = 0 /* None */;
|
|
8239
|
+
this.bitSize = 0 /* BitSize.None */;
|
|
8240
8240
|
if (def) {
|
|
8241
8241
|
if (!pxtc.isInPxtModules(def)) {
|
|
8242
8242
|
this.isUserVariable = true;
|
|
@@ -8277,8 +8277,8 @@ var ts;
|
|
|
8277
8277
|
}
|
|
8278
8278
|
load() {
|
|
8279
8279
|
let r = this.loadCore();
|
|
8280
|
-
if (pxtc.target.isNative && !pxtc.isStackMachine() && this.bitSize != 0 /* None */) {
|
|
8281
|
-
if (this.bitSize == 6 /* UInt32 */)
|
|
8280
|
+
if (pxtc.target.isNative && !pxtc.isStackMachine() && this.bitSize != 0 /* BitSize.None */) {
|
|
8281
|
+
if (this.bitSize == 6 /* BitSize.UInt32 */)
|
|
8282
8282
|
return rtcall("pxt::fromUInt", [r]);
|
|
8283
8283
|
return rtcall("pxt::fromInt", [r]);
|
|
8284
8284
|
}
|
|
@@ -8297,8 +8297,8 @@ var ts;
|
|
|
8297
8297
|
return rtcall("pxtrt::stlocRef", [this.loadCore(), src]);
|
|
8298
8298
|
}
|
|
8299
8299
|
else {
|
|
8300
|
-
if (pxtc.target.isNative && !pxtc.isStackMachine() && this.bitSize != 0 /* None */) {
|
|
8301
|
-
let cnv = this.bitSize == 6 /* UInt32 */ ? "pxt::toUInt" : "pxt::toInt";
|
|
8300
|
+
if (pxtc.target.isNative && !pxtc.isStackMachine() && this.bitSize != 0 /* BitSize.None */) {
|
|
8301
|
+
let cnv = this.bitSize == 6 /* BitSize.UInt32 */ ? "pxt::toUInt" : "pxt::toInt";
|
|
8302
8302
|
return this.storeDirect(rtcall(cnv, [src], 1));
|
|
8303
8303
|
}
|
|
8304
8304
|
return this.storeDirect(src);
|
|
@@ -8863,25 +8863,25 @@ var ts;
|
|
|
8863
8863
|
constructor(wave, id) {
|
|
8864
8864
|
this.wave = wave;
|
|
8865
8865
|
this.id = id;
|
|
8866
|
-
this.flags = 0 /* None */;
|
|
8866
|
+
this.flags = 0 /* PxtNodeFlags.None */;
|
|
8867
8867
|
this.resetAll();
|
|
8868
8868
|
}
|
|
8869
8869
|
refresh() {
|
|
8870
8870
|
// clear IsUsed flag
|
|
8871
|
-
this.flags &= ~8 /* IsUsed */;
|
|
8871
|
+
this.flags &= ~8 /* PxtNodeFlags.IsUsed */;
|
|
8872
8872
|
// this happens for top-level function expression - we just re-emit them
|
|
8873
8873
|
if (this.proc && !this.usedActions && !getEnclosingFunction(this.proc.action))
|
|
8874
8874
|
this.resetEmit();
|
|
8875
8875
|
else if (this.proc && !this.proc.cachedJS)
|
|
8876
8876
|
this.resetEmit();
|
|
8877
8877
|
else if (this.usedNodes)
|
|
8878
|
-
this.flags |= 32 /* FromPreviousCompile */;
|
|
8878
|
+
this.flags |= 32 /* PxtNodeFlags.FromPreviousCompile */;
|
|
8879
8879
|
if (this.classInfo)
|
|
8880
8880
|
this.classInfo.reset();
|
|
8881
8881
|
}
|
|
8882
8882
|
resetEmit() {
|
|
8883
8883
|
// clear IsUsed flag
|
|
8884
|
-
this.flags &= ~(8 /* IsUsed */ | 32 /* FromPreviousCompile */);
|
|
8884
|
+
this.flags &= ~(8 /* PxtNodeFlags.IsUsed */ | 32 /* PxtNodeFlags.FromPreviousCompile */);
|
|
8885
8885
|
if (this.proc && this.proc.classInfo && this.proc.classInfo.ctor == this.proc)
|
|
8886
8886
|
this.proc.classInfo.ctor = null;
|
|
8887
8887
|
this.functionInfo = null;
|
|
@@ -8896,7 +8896,7 @@ var ts;
|
|
|
8896
8896
|
}
|
|
8897
8897
|
resetTSC() {
|
|
8898
8898
|
// clear all flags except for InPxtModules
|
|
8899
|
-
this.flags &= 16 /* InPxtModules */;
|
|
8899
|
+
this.flags &= 16 /* PxtNodeFlags.InPxtModules */;
|
|
8900
8900
|
this.typeCache = null;
|
|
8901
8901
|
this.symbolCache = null;
|
|
8902
8902
|
this.commentAttrs = null;
|
|
@@ -8994,7 +8994,7 @@ var ts;
|
|
|
8994
8994
|
let currNodeWave = 1;
|
|
8995
8995
|
function isInPxtModules(node) {
|
|
8996
8996
|
if (node.pxt)
|
|
8997
|
-
return !!(node.pxt.flags & 16 /* InPxtModules */);
|
|
8997
|
+
return !!(node.pxt.flags & 16 /* PxtNodeFlags.InPxtModules */);
|
|
8998
8998
|
const src = ts.getSourceFileOfNode(node);
|
|
8999
8999
|
return src ? pxtc.isPxtModulesFilename(src.fileName) : false;
|
|
9000
9000
|
}
|
|
@@ -9003,7 +9003,7 @@ var ts;
|
|
|
9003
9003
|
if (!n.pxt) {
|
|
9004
9004
|
const info = new PxtNode(currNodeWave, ++lastNodeId);
|
|
9005
9005
|
if (isInPxtModules(n))
|
|
9006
|
-
info.flags |= 16 /* InPxtModules */;
|
|
9006
|
+
info.flags |= 16 /* PxtNodeFlags.InPxtModules */;
|
|
9007
9007
|
n.pxt = info;
|
|
9008
9008
|
return info;
|
|
9009
9009
|
}
|
|
@@ -9014,7 +9014,7 @@ var ts;
|
|
|
9014
9014
|
if (!pxtc.compileOptions || !pxtc.compileOptions.skipPxtModulesTSC)
|
|
9015
9015
|
info.resetAll();
|
|
9016
9016
|
else {
|
|
9017
|
-
if (info.flags & 16 /* InPxtModules */) {
|
|
9017
|
+
if (info.flags & 16 /* PxtNodeFlags.InPxtModules */) {
|
|
9018
9018
|
if (pxtc.compileOptions.skipPxtModulesEmit)
|
|
9019
9019
|
info.refresh();
|
|
9020
9020
|
else
|
|
@@ -9101,43 +9101,43 @@ var ts;
|
|
|
9101
9101
|
}
|
|
9102
9102
|
function getBitSize(decl) {
|
|
9103
9103
|
if (!decl || !decl.type)
|
|
9104
|
-
return 0 /* None */;
|
|
9104
|
+
return 0 /* BitSize.None */;
|
|
9105
9105
|
if (!(isNumberType(typeOf(decl))))
|
|
9106
|
-
return 0 /* None */;
|
|
9106
|
+
return 0 /* BitSize.None */;
|
|
9107
9107
|
if (decl.type.kind != pxtc.SK.TypeReference)
|
|
9108
|
-
return 0 /* None */;
|
|
9108
|
+
return 0 /* BitSize.None */;
|
|
9109
9109
|
switch (decl.type.typeName.getText()) {
|
|
9110
|
-
case "int8": return 1 /* Int8 */;
|
|
9111
|
-
case "int16": return 3 /* Int16 */;
|
|
9112
|
-
case "int32": return 5 /* Int32 */;
|
|
9113
|
-
case "uint8": return 2 /* UInt8 */;
|
|
9114
|
-
case "uint16": return 4 /* UInt16 */;
|
|
9115
|
-
case "uint32": return 6 /* UInt32 */;
|
|
9116
|
-
default: return 0 /* None */;
|
|
9110
|
+
case "int8": return 1 /* BitSize.Int8 */;
|
|
9111
|
+
case "int16": return 3 /* BitSize.Int16 */;
|
|
9112
|
+
case "int32": return 5 /* BitSize.Int32 */;
|
|
9113
|
+
case "uint8": return 2 /* BitSize.UInt8 */;
|
|
9114
|
+
case "uint16": return 4 /* BitSize.UInt16 */;
|
|
9115
|
+
case "uint32": return 6 /* BitSize.UInt32 */;
|
|
9116
|
+
default: return 0 /* BitSize.None */;
|
|
9117
9117
|
}
|
|
9118
9118
|
}
|
|
9119
9119
|
function sizeOfBitSize(b) {
|
|
9120
9120
|
switch (b) {
|
|
9121
|
-
case 0 /* None */: return pxtc.target.shortPointers ? 2 : 4;
|
|
9122
|
-
case 1 /* Int8 */: return 1;
|
|
9123
|
-
case 3 /* Int16 */: return 2;
|
|
9124
|
-
case 5 /* Int32 */: return 4;
|
|
9125
|
-
case 2 /* UInt8 */: return 1;
|
|
9126
|
-
case 4 /* UInt16 */: return 2;
|
|
9127
|
-
case 6 /* UInt32 */: return 4;
|
|
9121
|
+
case 0 /* BitSize.None */: return pxtc.target.shortPointers ? 2 : 4;
|
|
9122
|
+
case 1 /* BitSize.Int8 */: return 1;
|
|
9123
|
+
case 3 /* BitSize.Int16 */: return 2;
|
|
9124
|
+
case 5 /* BitSize.Int32 */: return 4;
|
|
9125
|
+
case 2 /* BitSize.UInt8 */: return 1;
|
|
9126
|
+
case 4 /* BitSize.UInt16 */: return 2;
|
|
9127
|
+
case 6 /* BitSize.UInt32 */: return 4;
|
|
9128
9128
|
default: throw pxtc.oops();
|
|
9129
9129
|
}
|
|
9130
9130
|
}
|
|
9131
9131
|
pxtc.sizeOfBitSize = sizeOfBitSize;
|
|
9132
9132
|
function isBitSizeSigned(b) {
|
|
9133
9133
|
switch (b) {
|
|
9134
|
-
case 1 /* Int8 */:
|
|
9135
|
-
case 3 /* Int16 */:
|
|
9136
|
-
case 5 /* Int32 */:
|
|
9134
|
+
case 1 /* BitSize.Int8 */:
|
|
9135
|
+
case 3 /* BitSize.Int16 */:
|
|
9136
|
+
case 5 /* BitSize.Int32 */:
|
|
9137
9137
|
return true;
|
|
9138
|
-
case 2 /* UInt8 */:
|
|
9139
|
-
case 4 /* UInt16 */:
|
|
9140
|
-
case 6 /* UInt32 */:
|
|
9138
|
+
case 2 /* BitSize.UInt8 */:
|
|
9139
|
+
case 4 /* BitSize.UInt16 */:
|
|
9140
|
+
case 6 /* BitSize.UInt32 */:
|
|
9141
9141
|
return false;
|
|
9142
9142
|
default: throw pxtc.oops();
|
|
9143
9143
|
}
|
|
@@ -9152,7 +9152,7 @@ var ts;
|
|
|
9152
9152
|
pxtc.oops("void-typed variable, " + l.toString());
|
|
9153
9153
|
}
|
|
9154
9154
|
l.bitSize = getBitSize(l.def);
|
|
9155
|
-
if (l.bitSize != 0 /* None */) {
|
|
9155
|
+
if (l.bitSize != 0 /* BitSize.None */) {
|
|
9156
9156
|
l._debugType = (isBitSizeSigned(l.bitSize) ? "int" : "uint") + (8 * sizeOfBitSize(l.bitSize));
|
|
9157
9157
|
}
|
|
9158
9158
|
else if (isStringType(tp)) {
|
|
@@ -9162,8 +9162,8 @@ var ts;
|
|
|
9162
9162
|
l._debugType = "number";
|
|
9163
9163
|
}
|
|
9164
9164
|
}
|
|
9165
|
-
if (l.isLocal() && l.bitSize != 0 /* None */) {
|
|
9166
|
-
l.bitSize = 0 /* None */;
|
|
9165
|
+
if (l.isLocal() && l.bitSize != 0 /* BitSize.None */) {
|
|
9166
|
+
l.bitSize = 0 /* BitSize.None */;
|
|
9167
9167
|
userError(9256, lf("bit sizes are not supported for locals and parameters"));
|
|
9168
9168
|
}
|
|
9169
9169
|
}
|
|
@@ -9315,7 +9315,7 @@ var ts;
|
|
|
9315
9315
|
this.itable = null;
|
|
9316
9316
|
}
|
|
9317
9317
|
get isUsed() {
|
|
9318
|
-
return !!(pxtInfo(this.decl).flags & 8 /* IsUsed */);
|
|
9318
|
+
return !!(pxtInfo(this.decl).flags & 8 /* PxtNodeFlags.IsUsed */);
|
|
9319
9319
|
}
|
|
9320
9320
|
allMethods() {
|
|
9321
9321
|
const r = [];
|
|
@@ -9330,7 +9330,7 @@ var ts;
|
|
|
9330
9330
|
for (let k of Object.keys(this.methods))
|
|
9331
9331
|
for (let m of this.methods[k]) {
|
|
9332
9332
|
const info = pxtInfo(m);
|
|
9333
|
-
if (info.flags & 8 /* IsUsed */)
|
|
9333
|
+
if (info.flags & 8 /* PxtNodeFlags.IsUsed */)
|
|
9334
9334
|
r.push(m);
|
|
9335
9335
|
}
|
|
9336
9336
|
return r;
|
|
@@ -9381,7 +9381,7 @@ var ts;
|
|
|
9381
9381
|
pxtc.parseCommentsOnSymbol = parseCommentsOnSymbol;
|
|
9382
9382
|
function parseComments(node) {
|
|
9383
9383
|
const pinfo = node ? pxtInfo(node) : null;
|
|
9384
|
-
if (!pinfo || pinfo.flags & 2 /* IsBogusFunction */)
|
|
9384
|
+
if (!pinfo || pinfo.flags & 2 /* PxtNodeFlags.IsBogusFunction */)
|
|
9385
9385
|
return pxtc.parseCommentString("");
|
|
9386
9386
|
if (pinfo.commentAttrs)
|
|
9387
9387
|
return pinfo.commentAttrs;
|
|
@@ -9648,7 +9648,7 @@ var ts;
|
|
|
9648
9648
|
this.capturedVars = [];
|
|
9649
9649
|
}
|
|
9650
9650
|
get isUsed() {
|
|
9651
|
-
return !!(pxtInfo(this.decl).flags & 8 /* IsUsed */);
|
|
9651
|
+
return !!(pxtInfo(this.decl).flags & 8 /* PxtNodeFlags.IsUsed */);
|
|
9652
9652
|
}
|
|
9653
9653
|
}
|
|
9654
9654
|
pxtc.FunctionAddInfo = FunctionAddInfo;
|
|
@@ -9763,7 +9763,7 @@ var ts;
|
|
|
9763
9763
|
};
|
|
9764
9764
|
_rootFunction = rootFunction;
|
|
9765
9765
|
const pinfo = pxtInfo(rootFunction);
|
|
9766
|
-
pinfo.flags |= 1 /* IsRootFunction */ | 2 /* IsBogusFunction */;
|
|
9766
|
+
pinfo.flags |= 1 /* PxtNodeFlags.IsRootFunction */ | 2 /* PxtNodeFlags.IsBogusFunction */;
|
|
9767
9767
|
markUsed(rootFunction);
|
|
9768
9768
|
usedWorkList = [];
|
|
9769
9769
|
reset();
|
|
@@ -10042,7 +10042,7 @@ var ts;
|
|
|
10042
10042
|
for (let m of ci.allMethods()) {
|
|
10043
10043
|
const pinfo = pxtInfo(m);
|
|
10044
10044
|
const info = getFunctionInfo(m);
|
|
10045
|
-
if (pinfo.flags & 8 /* IsUsed */) {
|
|
10045
|
+
if (pinfo.flags & 8 /* PxtNodeFlags.IsUsed */) {
|
|
10046
10046
|
// we need to mark the parent as used, otherwise vtable layout fails, see #3740
|
|
10047
10047
|
if (info.virtualParent)
|
|
10048
10048
|
markFunctionUsed(info.virtualParent.decl);
|
|
@@ -10180,8 +10180,8 @@ var ts;
|
|
|
10180
10180
|
}
|
|
10181
10181
|
}
|
|
10182
10182
|
function needsFullRecompileIfCached(pxtinfo) {
|
|
10183
|
-
if ((pxtinfo.flags & 32 /* FromPreviousCompile */) ||
|
|
10184
|
-
(pxtinfo.flags & 16 /* InPxtModules */ &&
|
|
10183
|
+
if ((pxtinfo.flags & 32 /* PxtNodeFlags.FromPreviousCompile */) ||
|
|
10184
|
+
(pxtinfo.flags & 16 /* PxtNodeFlags.InPxtModules */ &&
|
|
10185
10185
|
pxtc.compileOptions.skipPxtModulesEmit)) {
|
|
10186
10186
|
res.needsFullRecompile = true;
|
|
10187
10187
|
throw userError(9200, lf("full recompile required"));
|
|
@@ -10233,9 +10233,9 @@ var ts;
|
|
|
10233
10233
|
const pfield = pxtc.U.lookup(prevFields, key);
|
|
10234
10234
|
if (pfield) {
|
|
10235
10235
|
const pxtinfo = pxtInfo(pfield);
|
|
10236
|
-
if (!(pxtinfo.flags & 64 /* IsOverridden */)) {
|
|
10237
|
-
pxtinfo.flags |= 64 /* IsOverridden */;
|
|
10238
|
-
if (pxtinfo.flags & 8 /* IsUsed */)
|
|
10236
|
+
if (!(pxtinfo.flags & 64 /* PxtNodeFlags.IsOverridden */)) {
|
|
10237
|
+
pxtinfo.flags |= 64 /* PxtNodeFlags.IsOverridden */;
|
|
10238
|
+
if (pxtinfo.flags & 8 /* PxtNodeFlags.IsUsed */)
|
|
10239
10239
|
getIfaceMemberId(key, true);
|
|
10240
10240
|
needsFullRecompileIfCached(pxtinfo);
|
|
10241
10241
|
}
|
|
@@ -10435,7 +10435,7 @@ ${lbl}: .short 0xffff
|
|
|
10435
10435
|
let expr = emitExpr(e);
|
|
10436
10436
|
if (pxtc.target.isNative || isStringLiteral(e))
|
|
10437
10437
|
return irToNode(expr, isRef);
|
|
10438
|
-
expr = pxtc.ir.rtcallMask("String_::stringConv", 1, 1 /* Async */, [expr]);
|
|
10438
|
+
expr = pxtc.ir.rtcallMask("String_::stringConv", 1, 1 /* ir.CallingConvention.Async */, [expr]);
|
|
10439
10439
|
return irToNode(expr, true);
|
|
10440
10440
|
}
|
|
10441
10441
|
function emitTemplateExpression(node) {
|
|
@@ -10589,14 +10589,14 @@ ${lbl}: .short 0xffff
|
|
|
10589
10589
|
function isSlowField(decl) {
|
|
10590
10590
|
if (decl.kind == pxtc.SK.Parameter || decl.kind == pxtc.SK.PropertyDeclaration) {
|
|
10591
10591
|
const pinfo = pxtInfo(decl);
|
|
10592
|
-
return !!pxtc.target.switches.slowFields || !!(pinfo.flags & 64 /* IsOverridden */);
|
|
10592
|
+
return !!pxtc.target.switches.slowFields || !!(pinfo.flags & 64 /* PxtNodeFlags.IsOverridden */);
|
|
10593
10593
|
}
|
|
10594
10594
|
return false;
|
|
10595
10595
|
}
|
|
10596
10596
|
function emitIndexedAccess(node, assign = null) {
|
|
10597
10597
|
let t = typeOf(node.expression);
|
|
10598
10598
|
let attrs = {
|
|
10599
|
-
callingConvention: 0 /* Plain */,
|
|
10599
|
+
callingConvention: 0 /* ir.CallingConvention.Plain */,
|
|
10600
10600
|
paramDefl: {},
|
|
10601
10601
|
};
|
|
10602
10602
|
let indexer = null;
|
|
@@ -10654,7 +10654,7 @@ ${lbl}: .short 0xffff
|
|
|
10654
10654
|
return true;
|
|
10655
10655
|
const info = pxtInfo(node);
|
|
10656
10656
|
if (bin.finalPass)
|
|
10657
|
-
return !!(info.flags & 8 /* IsUsed */);
|
|
10657
|
+
return !!(info.flags & 8 /* PxtNodeFlags.IsUsed */);
|
|
10658
10658
|
else
|
|
10659
10659
|
return info == currUsingContext;
|
|
10660
10660
|
}
|
|
@@ -10671,8 +10671,8 @@ ${lbl}: .short 0xffff
|
|
|
10671
10671
|
if (isStackMachine() && isClassFunction(decl))
|
|
10672
10672
|
getIfaceMemberId(getName(decl), true);
|
|
10673
10673
|
recordUsage(decl);
|
|
10674
|
-
if (!(pinfo.flags & 8 /* IsUsed */)) {
|
|
10675
|
-
pinfo.flags |= 8 /* IsUsed */;
|
|
10674
|
+
if (!(pinfo.flags & 8 /* PxtNodeFlags.IsUsed */)) {
|
|
10675
|
+
pinfo.flags |= 8 /* PxtNodeFlags.IsUsed */;
|
|
10676
10676
|
if (isOnDemandDecl(decl))
|
|
10677
10677
|
usedWorkList.push(decl);
|
|
10678
10678
|
}
|
|
@@ -10724,7 +10724,7 @@ ${lbl}: .short 0xffff
|
|
|
10724
10724
|
symbol: { isBogusSymbol: true, name: namedNode.name.getText() },
|
|
10725
10725
|
name: namedNode.name,
|
|
10726
10726
|
};
|
|
10727
|
-
pxtInfo(decl).flags |= 2 /* IsBogusFunction */;
|
|
10727
|
+
pxtInfo(decl).flags |= 2 /* PxtNodeFlags.IsBogusFunction */;
|
|
10728
10728
|
}
|
|
10729
10729
|
pinfo.declCache = decl || null;
|
|
10730
10730
|
return decl;
|
|
@@ -11102,17 +11102,17 @@ ${lbl}: .short 0xffff
|
|
|
11102
11102
|
// smaller immediate range than plain "str" (and same for "ldr")
|
|
11103
11103
|
// All the pointers go at the end, for GC
|
|
11104
11104
|
globals.forEach((g, i) => g.index = i);
|
|
11105
|
-
const sz = (b) => b == 0 /* None */ ? 10 : sizeOfBitSize(b);
|
|
11105
|
+
const sz = (b) => b == 0 /* BitSize.None */ ? 10 : sizeOfBitSize(b);
|
|
11106
11106
|
globals.sort((a, b) => sz(a.bitSize) - sz(b.bitSize) ||
|
|
11107
11107
|
a.index - b.index);
|
|
11108
11108
|
let currOff = pxtc.numReservedGlobals * 4;
|
|
11109
11109
|
let firstPointer = 0;
|
|
11110
11110
|
for (let g of globals) {
|
|
11111
|
-
const bitSize = isStackMachine() ? 0 /* None */ : g.bitSize;
|
|
11111
|
+
const bitSize = isStackMachine() ? 0 /* BitSize.None */ : g.bitSize;
|
|
11112
11112
|
let sz = sizeOfBitSize(bitSize);
|
|
11113
11113
|
while (currOff & (sz - 1))
|
|
11114
11114
|
currOff++; // align
|
|
11115
|
-
if (!firstPointer && bitSize == 0 /* None */)
|
|
11115
|
+
if (!firstPointer && bitSize == 0 /* BitSize.None */)
|
|
11116
11116
|
firstPointer = currOff;
|
|
11117
11117
|
g.index = currOff;
|
|
11118
11118
|
currOff += sz;
|
|
@@ -11172,7 +11172,7 @@ ${lbl}: .short 0xffff
|
|
|
11172
11172
|
return;
|
|
11173
11173
|
// U.assert(!bin.finalPass)
|
|
11174
11174
|
const pinfo = pxtInfo(info.decl);
|
|
11175
|
-
pinfo.flags |= 8 /* IsUsed */;
|
|
11175
|
+
pinfo.flags |= 8 /* PxtNodeFlags.IsUsed */;
|
|
11176
11176
|
if (info.baseClassInfo)
|
|
11177
11177
|
markVTableUsed(info.baseClassInfo);
|
|
11178
11178
|
bin.usedClassInfos.push(info);
|
|
@@ -11522,7 +11522,7 @@ ${lbl}: .short 0xffff
|
|
|
11522
11522
|
pxtc.assert(!bin.finalPass, "!bin.finalPass");
|
|
11523
11523
|
const pinfo = pxtInfo(node);
|
|
11524
11524
|
const myProc = new pxtc.ir.Procedure();
|
|
11525
|
-
myProc.isRoot = !!(pinfo.flags & 1 /* IsRootFunction */);
|
|
11525
|
+
myProc.isRoot = !!(pinfo.flags & 1 /* PxtNodeFlags.IsRootFunction */);
|
|
11526
11526
|
myProc.action = node;
|
|
11527
11527
|
myProc.info = info;
|
|
11528
11528
|
pinfo.proc = myProc;
|
|
@@ -11653,7 +11653,7 @@ ${lbl}: .short 0xffff
|
|
|
11653
11653
|
function emitFunctionDeclaration(node) {
|
|
11654
11654
|
if (!shouldEmitNow(node))
|
|
11655
11655
|
return undefined;
|
|
11656
|
-
if (pxtInfo(node).flags & 32 /* FromPreviousCompile */)
|
|
11656
|
+
if (pxtInfo(node).flags & 32 /* PxtNodeFlags.FromPreviousCompile */)
|
|
11657
11657
|
return undefined;
|
|
11658
11658
|
let attrs = parseComments(node);
|
|
11659
11659
|
if (attrs.shim != null) {
|
|
@@ -12246,7 +12246,7 @@ ${lbl}: .short 0xffff
|
|
|
12246
12246
|
return isNumberLikeType(typeOf(e));
|
|
12247
12247
|
}
|
|
12248
12248
|
function rtcallMaskDirect(name, args) {
|
|
12249
|
-
return pxtc.ir.rtcallMask(name, (1 << args.length) - 1, 0 /* Plain */, args);
|
|
12249
|
+
return pxtc.ir.rtcallMask(name, (1 << args.length) - 1, 0 /* ir.CallingConvention.Plain */, args);
|
|
12250
12250
|
}
|
|
12251
12251
|
function rtcallMask(name, args, attrs, append = null) {
|
|
12252
12252
|
let fmt = [];
|
|
@@ -12334,7 +12334,7 @@ ${lbl}: .short 0xffff
|
|
|
12334
12334
|
throw pxtc.U.oops("invalid format specifier: " + f);
|
|
12335
12335
|
}
|
|
12336
12336
|
});
|
|
12337
|
-
let r = pxtc.ir.rtcallMask(name, mask, attrs ? attrs.callingConvention : 0 /* Plain */, args2);
|
|
12337
|
+
let r = pxtc.ir.rtcallMask(name, mask, attrs ? attrs.callingConvention : 0 /* ir.CallingConvention.Plain */, args2);
|
|
12338
12338
|
if (!r.mask)
|
|
12339
12339
|
r.mask = { refMask: 0 };
|
|
12340
12340
|
r.mask.conversions = convInfos;
|
|
@@ -12500,7 +12500,7 @@ ${lbl}: .short 0xffff
|
|
|
12500
12500
|
let shim = (n) => {
|
|
12501
12501
|
n = mapIntOpName(n);
|
|
12502
12502
|
let args = [node.left, node.right];
|
|
12503
|
-
return pxtc.ir.rtcallMask(n, getMask(args), 0 /* Plain */, args.map(x => emitExpr(x)));
|
|
12503
|
+
return pxtc.ir.rtcallMask(n, getMask(args), 0 /* ir.CallingConvention.Plain */, args.map(x => emitExpr(x)));
|
|
12504
12504
|
};
|
|
12505
12505
|
if (node.operatorToken.kind == pxtc.SK.CommaToken) {
|
|
12506
12506
|
if (isNoopExpr(node.left))
|
|
@@ -12833,7 +12833,7 @@ ${lbl}: .short 0xffff
|
|
|
12833
12833
|
// we assume the value we're switching over will stay alive
|
|
12834
12834
|
// so, the mask only applies to the case expression if needed
|
|
12835
12835
|
// switch_eq() will decr(expr) if result is true
|
|
12836
|
-
let cmpCall = pxtc.ir.rtcallMask(mapIntOpName("pxt::switch_eq"), mask, 0 /* Plain */, [cmpExpr, expr]);
|
|
12836
|
+
let cmpCall = pxtc.ir.rtcallMask(mapIntOpName("pxt::switch_eq"), mask, 0 /* ir.CallingConvention.Plain */, [cmpExpr, expr]);
|
|
12837
12837
|
proc.emitJmp(lbl, cmpCall, pxtc.ir.JmpMode.IfNotZero, expr);
|
|
12838
12838
|
}
|
|
12839
12839
|
else if (cl.kind == pxtc.SK.DefaultClause) {
|
|
@@ -13992,13 +13992,13 @@ var pxt;
|
|
|
13992
13992
|
addFileOff++;
|
|
13993
13993
|
let mapEnd = 0;
|
|
13994
13994
|
for (let s of progHeaders) {
|
|
13995
|
-
if (s.type == 1 /* LOAD */)
|
|
13995
|
+
if (s.type == 1 /* PHT.LOAD */)
|
|
13996
13996
|
mapEnd = Math.max(mapEnd, s.vaddr + s.memsz);
|
|
13997
13997
|
}
|
|
13998
13998
|
let addMemOff = ((mapEnd + pageSize - 1) & ~(pageSize - 1)) + (addFileOff & (pageSize - 1));
|
|
13999
13999
|
let phOffset = -1;
|
|
14000
14000
|
for (let s of progHeaders) {
|
|
14001
|
-
if (s.type == 4 /* NOTE */) {
|
|
14001
|
+
if (s.type == 4 /* PHT.NOTE */) {
|
|
14002
14002
|
phOffset = s._filepos;
|
|
14003
14003
|
}
|
|
14004
14004
|
}
|
|
@@ -14028,13 +14028,13 @@ var pxt;
|
|
|
14028
14028
|
pxt.U.memcpy(resBuf, info.imageFileStart, program);
|
|
14029
14029
|
let ph = {
|
|
14030
14030
|
_filepos: info.phOffset,
|
|
14031
|
-
type: 1 /* LOAD */,
|
|
14031
|
+
type: 1 /* PHT.LOAD */,
|
|
14032
14032
|
offset: info.imageFileStart,
|
|
14033
14033
|
vaddr: info.imageMemStart,
|
|
14034
14034
|
paddr: info.imageMemStart,
|
|
14035
14035
|
filesz: program.length,
|
|
14036
14036
|
memsz: program.length,
|
|
14037
|
-
flags: 4 /* R */ | 1 /* X */,
|
|
14037
|
+
flags: 4 /* PHF.R */ | 1 /* PHF.X */,
|
|
14038
14038
|
align: pageSize
|
|
14039
14039
|
};
|
|
14040
14040
|
savePH(resBuf, ph);
|
|
@@ -16498,10 +16498,10 @@ var ts;
|
|
|
16498
16498
|
// special case for enum members and enum members exported as constants,
|
|
16499
16499
|
// which have the return type 'EnumName.MemberName'. we want to match 'EnumName'
|
|
16500
16500
|
if (isEnum) {
|
|
16501
|
-
if (i.symbol.kind == 7 /* EnumMember */) {
|
|
16501
|
+
if (i.symbol.kind == 7 /* SymbolKind.EnumMember */) {
|
|
16502
16502
|
retType = i.symbol.namespace;
|
|
16503
16503
|
}
|
|
16504
|
-
else if (i.symbol.kind == 4 /* Variable */) {
|
|
16504
|
+
else if (i.symbol.kind == 4 /* SymbolKind.Variable */) {
|
|
16505
16505
|
const enumParts = (_b = (_a = i.symbol.attributes) === null || _a === void 0 ? void 0 : _a.enumIdentity) === null || _b === void 0 ? void 0 : _b.split(".");
|
|
16506
16506
|
if ((enumParts === null || enumParts === void 0 ? void 0 : enumParts.length) > 1)
|
|
16507
16507
|
retType = enumParts[0];
|
|
@@ -16539,20 +16539,20 @@ var ts;
|
|
|
16539
16539
|
service.getBasicKindDefault = getBasicKindDefault;
|
|
16540
16540
|
function tsSymbolToPxtSymbolKind(ts) {
|
|
16541
16541
|
if (ts.flags & ts_1.SymbolFlags.Variable)
|
|
16542
|
-
return 4 /* Variable */;
|
|
16542
|
+
return 4 /* SymbolKind.Variable */;
|
|
16543
16543
|
if (ts.flags & ts_1.SymbolFlags.Class)
|
|
16544
|
-
return 8 /* Class */;
|
|
16544
|
+
return 8 /* SymbolKind.Class */;
|
|
16545
16545
|
if (ts.flags & ts_1.SymbolFlags.Enum)
|
|
16546
|
-
return 6 /* Enum */;
|
|
16546
|
+
return 6 /* SymbolKind.Enum */;
|
|
16547
16547
|
if (ts.flags & ts_1.SymbolFlags.EnumMember)
|
|
16548
|
-
return 7 /* EnumMember */;
|
|
16548
|
+
return 7 /* SymbolKind.EnumMember */;
|
|
16549
16549
|
if (ts.flags & ts_1.SymbolFlags.Method)
|
|
16550
|
-
return 1 /* Method */;
|
|
16550
|
+
return 1 /* SymbolKind.Method */;
|
|
16551
16551
|
if (ts.flags & ts_1.SymbolFlags.Module)
|
|
16552
|
-
return 5 /* Module */;
|
|
16552
|
+
return 5 /* SymbolKind.Module */;
|
|
16553
16553
|
if (ts.flags & ts_1.SymbolFlags.Property)
|
|
16554
|
-
return 2 /* Property */;
|
|
16555
|
-
return 0 /* None */;
|
|
16554
|
+
return 2 /* SymbolKind.Property */;
|
|
16555
|
+
return 0 /* SymbolKind.None */;
|
|
16556
16556
|
}
|
|
16557
16557
|
service.tsSymbolToPxtSymbolKind = tsSymbolToPxtSymbolKind;
|
|
16558
16558
|
function makePxtSymbolFromKeyword(keyword) {
|
|
@@ -16560,14 +16560,14 @@ var ts;
|
|
|
16560
16560
|
// type than "SymbolInfo" to carry auto completion information.
|
|
16561
16561
|
// Some progress on this exists here: dazuniga/completionitem_refactor
|
|
16562
16562
|
let sym = {
|
|
16563
|
-
kind: 0 /* None */,
|
|
16563
|
+
kind: 0 /* SymbolKind.None */,
|
|
16564
16564
|
name: keyword,
|
|
16565
16565
|
pyName: keyword,
|
|
16566
16566
|
qName: keyword,
|
|
16567
16567
|
pyQName: keyword,
|
|
16568
16568
|
namespace: "",
|
|
16569
16569
|
attributes: {
|
|
16570
|
-
callingConvention: 0 /* Plain */,
|
|
16570
|
+
callingConvention: 0 /* ir.CallingConvention.Plain */,
|
|
16571
16571
|
paramDefl: {},
|
|
16572
16572
|
},
|
|
16573
16573
|
fileName: pxt.MAIN_TS,
|
|
@@ -16595,7 +16595,7 @@ var ts;
|
|
|
16595
16595
|
pyQName: qname,
|
|
16596
16596
|
namespace: ns,
|
|
16597
16597
|
attributes: {
|
|
16598
|
-
callingConvention: 0 /* Plain */,
|
|
16598
|
+
callingConvention: 0 /* ir.CallingConvention.Plain */,
|
|
16599
16599
|
paramDefl: {},
|
|
16600
16600
|
},
|
|
16601
16601
|
fileName: pxt.MAIN_TS,
|
|
@@ -16977,7 +16977,7 @@ var ts;
|
|
|
16977
16977
|
resultSymbols
|
|
16978
16978
|
.map(sym => {
|
|
16979
16979
|
// skip for enum member completions (eg "AnimalMob."" should have "Chicken", not "CHICKEN")
|
|
16980
|
-
if (sym.symbol.attributes.alias && !(isMemberCompletion && sym.symbol.kind === 7 /* EnumMember */)) {
|
|
16980
|
+
if (sym.symbol.attributes.alias && !(isMemberCompletion && sym.symbol.kind === 7 /* SymbolKind.EnumMember */)) {
|
|
16981
16981
|
return completionSymbol(service.lastApiInfo.apis.byQName[sym.symbol.attributes.alias], sym.weight);
|
|
16982
16982
|
}
|
|
16983
16983
|
else {
|
|
@@ -17246,29 +17246,29 @@ var ts;
|
|
|
17246
17246
|
switch (node.kind) {
|
|
17247
17247
|
case pxtc.SK.MethodDeclaration:
|
|
17248
17248
|
case pxtc.SK.MethodSignature:
|
|
17249
|
-
return 1 /* Method */;
|
|
17249
|
+
return 1 /* SymbolKind.Method */;
|
|
17250
17250
|
case pxtc.SK.PropertyDeclaration:
|
|
17251
17251
|
case pxtc.SK.PropertySignature:
|
|
17252
17252
|
case pxtc.SK.GetAccessor:
|
|
17253
17253
|
case pxtc.SK.SetAccessor:
|
|
17254
|
-
return 2 /* Property */;
|
|
17254
|
+
return 2 /* SymbolKind.Property */;
|
|
17255
17255
|
case pxtc.SK.Constructor:
|
|
17256
17256
|
case pxtc.SK.FunctionDeclaration:
|
|
17257
|
-
return 3 /* Function */;
|
|
17257
|
+
return 3 /* SymbolKind.Function */;
|
|
17258
17258
|
case pxtc.SK.VariableDeclaration:
|
|
17259
|
-
return 4 /* Variable */;
|
|
17259
|
+
return 4 /* SymbolKind.Variable */;
|
|
17260
17260
|
case pxtc.SK.ModuleDeclaration:
|
|
17261
|
-
return 5 /* Module */;
|
|
17261
|
+
return 5 /* SymbolKind.Module */;
|
|
17262
17262
|
case pxtc.SK.EnumDeclaration:
|
|
17263
|
-
return 6 /* Enum */;
|
|
17263
|
+
return 6 /* SymbolKind.Enum */;
|
|
17264
17264
|
case pxtc.SK.EnumMember:
|
|
17265
|
-
return 7 /* EnumMember */;
|
|
17265
|
+
return 7 /* SymbolKind.EnumMember */;
|
|
17266
17266
|
case pxtc.SK.ClassDeclaration:
|
|
17267
|
-
return 8 /* Class */;
|
|
17267
|
+
return 8 /* SymbolKind.Class */;
|
|
17268
17268
|
case pxtc.SK.InterfaceDeclaration:
|
|
17269
|
-
return 9 /* Interface */;
|
|
17269
|
+
return 9 /* SymbolKind.Interface */;
|
|
17270
17270
|
default:
|
|
17271
|
-
return 0 /* None */;
|
|
17271
|
+
return 0 /* SymbolKind.None */;
|
|
17272
17272
|
}
|
|
17273
17273
|
}
|
|
17274
17274
|
function createSymbolInfo(typechecker, qName, stmt) {
|
|
@@ -17292,13 +17292,13 @@ var ts;
|
|
|
17292
17292
|
return readableName;
|
|
17293
17293
|
}
|
|
17294
17294
|
let kind = getSymbolKind(stmt);
|
|
17295
|
-
if (kind != 0 /* None */) {
|
|
17295
|
+
if (kind != 0 /* SymbolKind.None */) {
|
|
17296
17296
|
let decl = stmt;
|
|
17297
17297
|
let attributes = pxtc.parseComments(decl);
|
|
17298
17298
|
if (attributes.weight < 0)
|
|
17299
17299
|
return null;
|
|
17300
17300
|
let m = /^(.*)\.(.*)/.exec(qName);
|
|
17301
|
-
let hasParams = kind == 3 /* Function */ || kind == 1 /* Method */;
|
|
17301
|
+
let hasParams = kind == 3 /* SymbolKind.Function */ || kind == 1 /* SymbolKind.Method */;
|
|
17302
17302
|
let pkg = null;
|
|
17303
17303
|
let pkgs = null;
|
|
17304
17304
|
let src = ts.getSourceFileOfNode(stmt);
|
|
@@ -17308,7 +17308,7 @@ var ts;
|
|
|
17308
17308
|
pkg = m[1];
|
|
17309
17309
|
}
|
|
17310
17310
|
let extendsTypes = undefined;
|
|
17311
|
-
if (kind == 8 /* Class */ || kind == 9 /* Interface */) {
|
|
17311
|
+
if (kind == 8 /* SymbolKind.Class */ || kind == 9 /* SymbolKind.Interface */) {
|
|
17312
17312
|
let cl = stmt;
|
|
17313
17313
|
extendsTypes = [];
|
|
17314
17314
|
if (cl.heritageClauses)
|
|
@@ -17320,7 +17320,7 @@ var ts;
|
|
|
17320
17320
|
}
|
|
17321
17321
|
}
|
|
17322
17322
|
}
|
|
17323
|
-
if (kind == 6 /* Enum */ || kind === 7 /* EnumMember */) {
|
|
17323
|
+
if (kind == 6 /* SymbolKind.Enum */ || kind === 7 /* SymbolKind.EnumMember */) {
|
|
17324
17324
|
(extendsTypes || (extendsTypes = [])).push("Number");
|
|
17325
17325
|
}
|
|
17326
17326
|
let r = {
|
|
@@ -17334,7 +17334,7 @@ var ts;
|
|
|
17334
17334
|
pkgs,
|
|
17335
17335
|
extendsTypes,
|
|
17336
17336
|
retType: stmt.kind == ts.SyntaxKind.Constructor ? "void" :
|
|
17337
|
-
kind == 5 /* Module */ ? "" :
|
|
17337
|
+
kind == 5 /* SymbolKind.Module */ ? "" :
|
|
17338
17338
|
typeOf(decl.type, decl, hasParams),
|
|
17339
17339
|
parameters: !hasParams ? null : pxtc.Util.toArray(decl.parameters).map((p, i) => {
|
|
17340
17340
|
let n = pxtc.getName(p);
|
|
@@ -17401,19 +17401,19 @@ var ts;
|
|
|
17401
17401
|
snippet: ts.isFunctionLike(stmt) ? null : undefined
|
|
17402
17402
|
};
|
|
17403
17403
|
switch (r.kind) {
|
|
17404
|
-
case 7 /* EnumMember */:
|
|
17404
|
+
case 7 /* SymbolKind.EnumMember */:
|
|
17405
17405
|
r.pyName = pxtc.U.snakify(r.name).toUpperCase();
|
|
17406
17406
|
break;
|
|
17407
|
-
case 4 /* Variable */:
|
|
17408
|
-
case 1 /* Method */:
|
|
17409
|
-
case 2 /* Property */:
|
|
17410
|
-
case 3 /* Function */:
|
|
17407
|
+
case 4 /* SymbolKind.Variable */:
|
|
17408
|
+
case 1 /* SymbolKind.Method */:
|
|
17409
|
+
case 2 /* SymbolKind.Property */:
|
|
17410
|
+
case 3 /* SymbolKind.Function */:
|
|
17411
17411
|
r.pyName = pxtc.U.snakify(r.name);
|
|
17412
17412
|
break;
|
|
17413
|
-
case 6 /* Enum */:
|
|
17414
|
-
case 8 /* Class */:
|
|
17415
|
-
case 9 /* Interface */:
|
|
17416
|
-
case 5 /* Module */:
|
|
17413
|
+
case 6 /* SymbolKind.Enum */:
|
|
17414
|
+
case 8 /* SymbolKind.Class */:
|
|
17415
|
+
case 9 /* SymbolKind.Interface */:
|
|
17416
|
+
case 5 /* SymbolKind.Module */:
|
|
17417
17417
|
default:
|
|
17418
17418
|
r.pyName = r.name;
|
|
17419
17419
|
break;
|
|
@@ -17431,7 +17431,7 @@ var ts;
|
|
|
17431
17431
|
pxt.debug(JSON.stringify(Object.keys(apiInfo.byQName), null, 2));
|
|
17432
17432
|
const files = {};
|
|
17433
17433
|
const infos = pxtc.Util.values(apiInfo.byQName);
|
|
17434
|
-
const enumMembers = infos.filter(si => si.kind == 7 /* EnumMember */)
|
|
17434
|
+
const enumMembers = infos.filter(si => si.kind == 7 /* SymbolKind.EnumMember */)
|
|
17435
17435
|
.sort(compareSymbols);
|
|
17436
17436
|
const snippetStrings = {};
|
|
17437
17437
|
const locStrings = {};
|
|
@@ -17444,7 +17444,7 @@ var ts;
|
|
|
17444
17444
|
return; // skip functions starting with __
|
|
17445
17445
|
pxt.debug(`loc: ${si.qName}`);
|
|
17446
17446
|
// must match blockly loader
|
|
17447
|
-
if (si.kind != 7 /* EnumMember */) {
|
|
17447
|
+
if (si.kind != 7 /* SymbolKind.EnumMember */) {
|
|
17448
17448
|
const ns = ts.pxtc.blocksCategory(si);
|
|
17449
17449
|
if (ns)
|
|
17450
17450
|
locStrings[`{id:category}${ns}`] = ns;
|
|
@@ -17470,7 +17470,7 @@ var ts;
|
|
|
17470
17470
|
files[pkg + name + "-strings.json"] = JSON.stringify(locs, null, 2);
|
|
17471
17471
|
};
|
|
17472
17472
|
for (const info of infos) {
|
|
17473
|
-
const isNamespace = info.kind == 5 /* Module */;
|
|
17473
|
+
const isNamespace = info.kind == 5 /* SymbolKind.Module */;
|
|
17474
17474
|
if (isNamespace) {
|
|
17475
17475
|
if (!infos.filter(si => si.namespace == info.name && !!si.attributes.jsDoc)[0])
|
|
17476
17476
|
continue; // nothing in namespace
|
|
@@ -17528,14 +17528,14 @@ var ts;
|
|
|
17528
17528
|
// sort by symbol kind
|
|
17529
17529
|
if (!symbolKindWeight) {
|
|
17530
17530
|
symbolKindWeight = {};
|
|
17531
|
-
symbolKindWeight[4 /* Variable */] = 100;
|
|
17532
|
-
symbolKindWeight[5 /* Module */] = 101;
|
|
17533
|
-
symbolKindWeight[3 /* Function */] = 99;
|
|
17534
|
-
symbolKindWeight[2 /* Property */] = 98;
|
|
17535
|
-
symbolKindWeight[1 /* Method */] = 97;
|
|
17536
|
-
symbolKindWeight[8 /* Class */] = 89;
|
|
17537
|
-
symbolKindWeight[6 /* Enum */] = 81;
|
|
17538
|
-
symbolKindWeight[7 /* EnumMember */] = 80;
|
|
17531
|
+
symbolKindWeight[4 /* SymbolKind.Variable */] = 100;
|
|
17532
|
+
symbolKindWeight[5 /* SymbolKind.Module */] = 101;
|
|
17533
|
+
symbolKindWeight[3 /* SymbolKind.Function */] = 99;
|
|
17534
|
+
symbolKindWeight[2 /* SymbolKind.Property */] = 98;
|
|
17535
|
+
symbolKindWeight[1 /* SymbolKind.Method */] = 97;
|
|
17536
|
+
symbolKindWeight[8 /* SymbolKind.Class */] = 89;
|
|
17537
|
+
symbolKindWeight[6 /* SymbolKind.Enum */] = 81;
|
|
17538
|
+
symbolKindWeight[7 /* SymbolKind.EnumMember */] = 80;
|
|
17539
17539
|
}
|
|
17540
17540
|
c = cmpr(s => symbolKindWeight[s.kind] || 0);
|
|
17541
17541
|
if (c)
|
|
@@ -17579,11 +17579,11 @@ var ts;
|
|
|
17579
17579
|
let existing = pxtc.U.lookup(res.byQName, qName);
|
|
17580
17580
|
if (existing) {
|
|
17581
17581
|
// we can have a function and an interface of the same name
|
|
17582
|
-
if (existing.kind == 9 /* Interface */ && si.kind != 9 /* Interface */) {
|
|
17582
|
+
if (existing.kind == 9 /* SymbolKind.Interface */ && si.kind != 9 /* SymbolKind.Interface */) {
|
|
17583
17583
|
// save existing entry
|
|
17584
17584
|
res.byQName[qName + "@type"] = existing;
|
|
17585
17585
|
}
|
|
17586
|
-
else if (existing.kind != 9 /* Interface */ && si.kind == 9 /* Interface */) {
|
|
17586
|
+
else if (existing.kind != 9 /* SymbolKind.Interface */ && si.kind == 9 /* SymbolKind.Interface */) {
|
|
17587
17587
|
res.byQName[qName + "@type"] = si;
|
|
17588
17588
|
si = existing;
|
|
17589
17589
|
}
|
|
@@ -17602,7 +17602,7 @@ var ts;
|
|
|
17602
17602
|
// Check if the colliding symbols are namespace definitions. The same namespace can be
|
|
17603
17603
|
// defined in different packages/extensions, so we want to keep track of that information.
|
|
17604
17604
|
// That way, we can make sure each cached extension has a copy of the namespace
|
|
17605
|
-
if (existing.kind === 5 /* Module */) {
|
|
17605
|
+
if (existing.kind === 5 /* SymbolKind.Module */) {
|
|
17606
17606
|
// Reference the existing array of packages where this namespace has been defined
|
|
17607
17607
|
si.pkgs = existing.pkgs || [];
|
|
17608
17608
|
if (existing.pkg !== si.pkg) {
|
|
@@ -18430,14 +18430,13 @@ var ts;
|
|
|
18430
18430
|
}
|
|
18431
18431
|
service.snippetAddsDefinitions = snippetAddsDefinitions;
|
|
18432
18432
|
function getSnippet(context, fn, decl, python, recursionDepth = 0) {
|
|
18433
|
-
var _a;
|
|
18433
|
+
var _a, _b;
|
|
18434
18434
|
// TODO: a lot of this is duplicate logic with blocklyloader.ts:buildBlockFromDef; we should
|
|
18435
18435
|
// unify these approaches
|
|
18436
18436
|
let { apis, takenNames, blocksInfo, screenSize, checker } = context;
|
|
18437
18437
|
const PY_INDENT = pxt.py.INDENT;
|
|
18438
18438
|
const fileType = python ? "python" : "typescript";
|
|
18439
18439
|
let snippetPrefix = fn.namespace;
|
|
18440
|
-
let isInstance = false;
|
|
18441
18440
|
let addNamespace = false;
|
|
18442
18441
|
let namespaceToUse = "";
|
|
18443
18442
|
let functionCount = 0;
|
|
@@ -18487,6 +18486,11 @@ var ts;
|
|
|
18487
18486
|
if (python && snippetPrefix)
|
|
18488
18487
|
snippetPrefix = pxtc.U.snakify(snippetPrefix);
|
|
18489
18488
|
}
|
|
18489
|
+
else if (((_b = params.thisParameter) === null || _b === void 0 ? void 0 : _b.shadowBlockId) === "variables_get") {
|
|
18490
|
+
snippetPrefix = params.thisParameter.defaultValue || params.thisParameter.definitionName;
|
|
18491
|
+
if (python && snippetPrefix)
|
|
18492
|
+
snippetPrefix = pxtc.U.snakify(snippetPrefix);
|
|
18493
|
+
}
|
|
18490
18494
|
else if (element.namespace) { // some blocks don't have a namespace such as parseInt
|
|
18491
18495
|
const nsInfo = apis.byQName[element.namespace];
|
|
18492
18496
|
if (nsInfo.attributes.fixedInstances) {
|
|
@@ -18498,7 +18502,7 @@ var ts;
|
|
|
18498
18502
|
.reduce((x, y) => x.concat(y.extendsTypes), []);
|
|
18499
18503
|
};
|
|
18500
18504
|
// all fixed instances for this namespace
|
|
18501
|
-
let fixedInstances = instances.filter(value => value.kind === 4 /* Variable */ &&
|
|
18505
|
+
let fixedInstances = instances.filter(value => value.kind === 4 /* pxtc.SymbolKind.Variable */ &&
|
|
18502
18506
|
value.attributes.fixedInstance);
|
|
18503
18507
|
let instanceToUse;
|
|
18504
18508
|
// first try to get fixed instances whose retType matches nsInfo.name
|
|
@@ -18525,9 +18529,8 @@ var ts;
|
|
|
18525
18529
|
if (namespaceToUse) {
|
|
18526
18530
|
addNamespace = true;
|
|
18527
18531
|
}
|
|
18528
|
-
isInstance = true;
|
|
18529
18532
|
}
|
|
18530
|
-
else if (element.kind == 1 /* Method */ || element.kind == 2 /* Property */) {
|
|
18533
|
+
else if (element.kind == 1 /* pxtc.SymbolKind.Method */ || element.kind == 2 /* pxtc.SymbolKind.Property */) {
|
|
18531
18534
|
if (params.thisParameter) {
|
|
18532
18535
|
let varName = undefined;
|
|
18533
18536
|
if (params.thisParameter.definitionName) {
|
|
@@ -18539,9 +18542,8 @@ var ts;
|
|
|
18539
18542
|
if (python && snippetPrefix)
|
|
18540
18543
|
snippetPrefix = pxtc.U.snakify(snippetPrefix);
|
|
18541
18544
|
}
|
|
18542
|
-
isInstance = true;
|
|
18543
18545
|
}
|
|
18544
|
-
else if (nsInfo.kind === 8 /* Class */) {
|
|
18546
|
+
else if (nsInfo.kind === 8 /* pxtc.SymbolKind.Class */) {
|
|
18545
18547
|
return undefined;
|
|
18546
18548
|
}
|
|
18547
18549
|
}
|
|
@@ -18554,7 +18556,7 @@ var ts;
|
|
|
18554
18556
|
}
|
|
18555
18557
|
else {
|
|
18556
18558
|
snippet = [fnName];
|
|
18557
|
-
if ((args === null || args === void 0 ? void 0 : args.length) || element.kind == 1 /* Method */ || element.kind == 3 /* Function */ || element.kind == 8 /* Class */) {
|
|
18559
|
+
if ((args === null || args === void 0 ? void 0 : args.length) || element.kind == 1 /* pxtc.SymbolKind.Method */ || element.kind == 3 /* pxtc.SymbolKind.Function */ || element.kind == 8 /* pxtc.SymbolKind.Class */) {
|
|
18558
18560
|
const argsWithCommas = args.reduce((p, n) => [...p, p.length ? ", " : "", n], []);
|
|
18559
18561
|
snippet = snippet.concat(["(", ...argsWithCommas, ")"]);
|
|
18560
18562
|
}
|
|
@@ -18720,7 +18722,7 @@ var ts;
|
|
|
18720
18722
|
return undefined;
|
|
18721
18723
|
}
|
|
18722
18724
|
function getFixedInstancesOf(type) {
|
|
18723
|
-
return pxt.Util.values(apis.byQName).filter(sym => sym.kind === 4 /* Variable */
|
|
18725
|
+
return pxt.Util.values(apis.byQName).filter(sym => sym.kind === 4 /* pxtc.SymbolKind.Variable */
|
|
18724
18726
|
&& sym.attributes.fixedInstance
|
|
18725
18727
|
&& isSubtype(apis, sym.retType, type.qName));
|
|
18726
18728
|
}
|