pxt-core 8.2.4 → 8.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.
- package/built/backendutils.js +19 -1
- package/built/pxt-common.json +1 -1
- package/built/pxt.js +148 -14
- package/built/pxtblockly.js +0 -3
- package/built/pxtblocks.js +0 -3
- package/built/pxtcompiler.d.ts +1 -0
- package/built/pxtcompiler.js +34 -8
- package/built/pxteditor.d.ts +1 -0
- package/built/pxtlib.d.ts +14 -0
- package/built/pxtlib.js +114 -6
- 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/pxtblockly.js +1 -1
- package/built/web/pxtblocks.js +1 -1
- package/built/web/pxtcompiler.js +1 -1
- package/built/web/pxtembed.js +2 -2
- package/built/web/pxtlib.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/package.json +1 -1
- package/theme/asset-editor.less +5 -0
- package/theme/greenscreen.less +4 -1
- package/theme/home.less +0 -5
- package/theme/tutorial-sidebar.less +42 -1
package/built/pxt.js
CHANGED
|
@@ -106399,6 +106399,7 @@ var pxt;
|
|
|
106399
106399
|
docs.prepTemplate = prepTemplate;
|
|
106400
106400
|
function setupRenderer(renderer) {
|
|
106401
106401
|
renderer.image = function (href, title, text) {
|
|
106402
|
+
var _a, _b;
|
|
106402
106403
|
const endpointName = "makecodeprodmediaeastus-usea";
|
|
106403
106404
|
if (href.startsWith("youtube:")) {
|
|
106404
106405
|
let out = '<div class="tutorial-video-embed"><iframe class="yt-embed" src="https://www.youtube.com/embed/' + href.split(":").pop()
|
|
@@ -106406,7 +106407,24 @@ var pxt;
|
|
|
106406
106407
|
return out;
|
|
106407
106408
|
}
|
|
106408
106409
|
else if (href.startsWith("azuremedia:")) {
|
|
106409
|
-
let
|
|
106410
|
+
let videoID = href.split(":")[1];
|
|
106411
|
+
const flagsSplit = videoID.split("?");
|
|
106412
|
+
let startTime;
|
|
106413
|
+
let endTime;
|
|
106414
|
+
if (flagsSplit[1]) {
|
|
106415
|
+
videoID = flagsSplit[0];
|
|
106416
|
+
const passedParameters = flagsSplit[1];
|
|
106417
|
+
startTime = (_a = /start(?:time)?=(\d+)/i.exec(passedParameters)) === null || _a === void 0 ? void 0 : _a[1];
|
|
106418
|
+
endTime = (_b = /end(?:time)?=(\d+)/i.exec(passedParameters)) === null || _b === void 0 ? void 0 : _b[1];
|
|
106419
|
+
}
|
|
106420
|
+
const url = new URL(`https://${endpointName}.streaming.media.azure.net/${videoID}/manifest(format=mpd-time-csf).mpd`);
|
|
106421
|
+
if (startTime) {
|
|
106422
|
+
url.hash = `t=${startTime}`;
|
|
106423
|
+
}
|
|
106424
|
+
if (endTime) {
|
|
106425
|
+
url.searchParams.append("endTime", endTime);
|
|
106426
|
+
}
|
|
106427
|
+
let out = `<div class="tutorial-video-embed"><video class="ams-embed" controls src="${url.toString()}" /></div>`;
|
|
106410
106428
|
return out;
|
|
106411
106429
|
}
|
|
106412
106430
|
else {
|
|
@@ -111961,7 +111979,7 @@ var pxt;
|
|
|
111961
111979
|
// and pulls from master
|
|
111962
111980
|
const modtag = (modid === null || modid === void 0 ? void 0 : modid.tag) || ((_a = mod.config) === null || _a === void 0 ? void 0 : _a.version);
|
|
111963
111981
|
const vertag = verid.tag;
|
|
111964
|
-
// if there is no tag on the current dependency,
|
|
111982
|
+
// if there is no tag on the current dependency,
|
|
111965
111983
|
// assume same as existing module version if any
|
|
111966
111984
|
if (modtag && !vertag) {
|
|
111967
111985
|
pxt.debug(`unversioned ${ver}, using ${modtag}`);
|
|
@@ -112420,6 +112438,8 @@ var pxt;
|
|
|
112420
112438
|
opts.otherMultiVariants.push(etarget);
|
|
112421
112439
|
}
|
|
112422
112440
|
else {
|
|
112441
|
+
etarget.target.isNative = opts.target.isNative;
|
|
112442
|
+
opts.target = etarget.target;
|
|
112423
112443
|
ext = einfo;
|
|
112424
112444
|
opts.otherMultiVariants = [];
|
|
112425
112445
|
}
|
|
@@ -113375,7 +113395,12 @@ var ts;
|
|
|
113375
113395
|
const left = param.substr(0, dotIdx);
|
|
113376
113396
|
let right = param.substr(dotIdx + 1);
|
|
113377
113397
|
right = pxtc.U.snakify(right).toUpperCase();
|
|
113378
|
-
|
|
113398
|
+
if (left) {
|
|
113399
|
+
return `${left}.${right}`;
|
|
113400
|
+
}
|
|
113401
|
+
else {
|
|
113402
|
+
return right;
|
|
113403
|
+
}
|
|
113379
113404
|
}
|
|
113380
113405
|
return param;
|
|
113381
113406
|
}
|
|
@@ -119289,6 +119314,18 @@ var ts;
|
|
|
119289
119314
|
}
|
|
119290
119315
|
}
|
|
119291
119316
|
assembler.Line = Line;
|
|
119317
|
+
const MAX_OBJ_USERS = 5;
|
|
119318
|
+
class AsmObject {
|
|
119319
|
+
constructor(id, description) {
|
|
119320
|
+
this.id = id;
|
|
119321
|
+
this.description = description;
|
|
119322
|
+
this.sizeAdj = 0;
|
|
119323
|
+
this.users = [];
|
|
119324
|
+
}
|
|
119325
|
+
get size() {
|
|
119326
|
+
return (this.endLocation - this.startLocation) - this.sizeAdj;
|
|
119327
|
+
}
|
|
119328
|
+
}
|
|
119292
119329
|
// File is the center of the action: parsing a file into a sequence of Lines
|
|
119293
119330
|
// and also emitting the binary (buf)
|
|
119294
119331
|
class File {
|
|
@@ -119313,6 +119350,11 @@ var ts;
|
|
|
119313
119350
|
this.throwOnError = false;
|
|
119314
119351
|
this.disablePeepHole = false;
|
|
119315
119352
|
this.stackAtLabel = {};
|
|
119353
|
+
this.codeSizeStats = false;
|
|
119354
|
+
this.labelToObject = {};
|
|
119355
|
+
this.idToObject = {};
|
|
119356
|
+
this.objSuspendStart = 0;
|
|
119357
|
+
this.labelsToObjectDone = false;
|
|
119316
119358
|
this.currLine = new Line(this, "<start>");
|
|
119317
119359
|
this.currLine.lineNo = 0;
|
|
119318
119360
|
this.ei = ei;
|
|
@@ -119332,6 +119374,15 @@ var ts;
|
|
|
119332
119374
|
pc() {
|
|
119333
119375
|
return this.location() + this.baseOffset;
|
|
119334
119376
|
}
|
|
119377
|
+
useLabel(name) {
|
|
119378
|
+
if (!this.currObject || name[0] == '.' || this.objSuspendStart)
|
|
119379
|
+
return;
|
|
119380
|
+
const obj = pxtc.U.lookup(this.labelToObject, name);
|
|
119381
|
+
if (!obj || obj == this.currObject)
|
|
119382
|
+
return;
|
|
119383
|
+
if (obj.users.length < MAX_OBJ_USERS && obj.users.indexOf(this.currObject) < 0)
|
|
119384
|
+
obj.users.push(this.currObject);
|
|
119385
|
+
}
|
|
119335
119386
|
// parsing of an "integer", well actually much more than
|
|
119336
119387
|
// just that
|
|
119337
119388
|
parseOneInt(s) {
|
|
@@ -119461,6 +119512,7 @@ var ts;
|
|
|
119461
119512
|
return name;
|
|
119462
119513
|
}
|
|
119463
119514
|
lookupLabel(name, direct = false) {
|
|
119515
|
+
this.useLabel(name);
|
|
119464
119516
|
let v = null;
|
|
119465
119517
|
let scoped = this.scopedName(name);
|
|
119466
119518
|
if (this.labels.hasOwnProperty(scoped)) {
|
|
@@ -119619,6 +119671,37 @@ var ts;
|
|
|
119619
119671
|
};
|
|
119620
119672
|
let num0;
|
|
119621
119673
|
switch (words[0]) {
|
|
119674
|
+
case ".object":
|
|
119675
|
+
if (!this.codeSizeStats) {
|
|
119676
|
+
// do nothing
|
|
119677
|
+
}
|
|
119678
|
+
else if (words[1] == "PUSH") {
|
|
119679
|
+
this.objSuspendStart = this.location();
|
|
119680
|
+
}
|
|
119681
|
+
else if (words[1] == "POP") {
|
|
119682
|
+
if (this.objSuspendStart)
|
|
119683
|
+
this.currObject.sizeAdj += this.location() - this.objSuspendStart;
|
|
119684
|
+
this.objSuspendStart = 0;
|
|
119685
|
+
}
|
|
119686
|
+
else {
|
|
119687
|
+
if (this.currObject)
|
|
119688
|
+
this.currObject.endLocation = this.location();
|
|
119689
|
+
this.currObject = pxtc.U.lookup(this.idToObject, words[1]);
|
|
119690
|
+
if (!this.currObject) {
|
|
119691
|
+
const str = l.text.replace(/^[^"]*/, "");
|
|
119692
|
+
let parsed = words[1];
|
|
119693
|
+
if (words.length > 2) {
|
|
119694
|
+
parsed = parseString(str.trim());
|
|
119695
|
+
if (parsed == null)
|
|
119696
|
+
this.directiveError(lf("expecting string in .object"));
|
|
119697
|
+
}
|
|
119698
|
+
this.currObject = new AsmObject(words[1], parsed);
|
|
119699
|
+
this.idToObject[words[1]] = this.currObject;
|
|
119700
|
+
}
|
|
119701
|
+
this.currObject.sizeAdj = 0;
|
|
119702
|
+
this.currObject.startLocation = this.location();
|
|
119703
|
+
}
|
|
119704
|
+
break;
|
|
119622
119705
|
case ".ascii":
|
|
119623
119706
|
case ".asciz":
|
|
119624
119707
|
case ".string":
|
|
@@ -119813,6 +119896,8 @@ var ts;
|
|
|
119813
119896
|
}
|
|
119814
119897
|
}
|
|
119815
119898
|
handleOneInstruction(ln, instr) {
|
|
119899
|
+
if (this.codeSizeStats && ln.ldlitLabel)
|
|
119900
|
+
this.useLabel(ln.ldlitLabel);
|
|
119816
119901
|
let op = instr.emit(ln);
|
|
119817
119902
|
if (!op.error) {
|
|
119818
119903
|
this.stack += op.stack;
|
|
@@ -119921,6 +120006,8 @@ var ts;
|
|
|
119921
120006
|
if (l.words.length == 0)
|
|
119922
120007
|
return;
|
|
119923
120008
|
if (l.type == "label") {
|
|
120009
|
+
if (this.currObject && !this.labelsToObjectDone && l.words[0][0] != '.')
|
|
120010
|
+
this.labelToObject[l.words[0]] = this.currObject;
|
|
119924
120011
|
let lblname = this.scopedName(l.words[0]);
|
|
119925
120012
|
this.prevLabel = lblname;
|
|
119926
120013
|
if (this.finalEmit) {
|
|
@@ -119961,6 +120048,8 @@ var ts;
|
|
|
119961
120048
|
pxtc.oops();
|
|
119962
120049
|
}
|
|
119963
120050
|
});
|
|
120051
|
+
this.labelsToObjectDone = true;
|
|
120052
|
+
this.currObject = null;
|
|
119964
120053
|
}
|
|
119965
120054
|
getSourceMap() {
|
|
119966
120055
|
const sourceMap = {};
|
|
@@ -119993,6 +120082,22 @@ var ts;
|
|
|
119993
120082
|
}
|
|
119994
120083
|
return sourceMap;
|
|
119995
120084
|
}
|
|
120085
|
+
getCodeSizeStats() {
|
|
120086
|
+
if (!this.codeSizeStats)
|
|
120087
|
+
return "";
|
|
120088
|
+
const objs = pxtc.U.values(this.idToObject);
|
|
120089
|
+
objs.sort((a, b) => b.size - a.size);
|
|
120090
|
+
let r = ";\n; Code size:\n;\n";
|
|
120091
|
+
for (const obj of objs) {
|
|
120092
|
+
r += `; ${(" " + obj.size).slice(-6)} ${obj.description} [${obj.id}]\n`;
|
|
120093
|
+
if (obj.users.length >= MAX_OBJ_USERS)
|
|
120094
|
+
r += `; by many, including ${obj.users[0].description}\n`;
|
|
120095
|
+
else
|
|
120096
|
+
for (const x of obj.users)
|
|
120097
|
+
r += `; by ${x.description} [${x.id}]\n`;
|
|
120098
|
+
}
|
|
120099
|
+
return r;
|
|
120100
|
+
}
|
|
119996
120101
|
getSource(clean, numStmts = 1, flashSize = 0) {
|
|
119997
120102
|
let lenPrev = 0;
|
|
119998
120103
|
let size = (lbl) => {
|
|
@@ -120008,8 +120113,11 @@ var ts;
|
|
|
120008
120113
|
let lenLiterals = size("_literals_end");
|
|
120009
120114
|
let lenAllCode = lenPrev;
|
|
120010
120115
|
let totalSize = (lenTotal + this.baseOffset) & 0xffffff;
|
|
120011
|
-
if (flashSize && totalSize > flashSize)
|
|
120012
|
-
|
|
120116
|
+
if (flashSize && totalSize > flashSize) {
|
|
120117
|
+
const e = new Error(lf("program too big by {0} bytes!", totalSize - flashSize));
|
|
120118
|
+
e.ksErrorCode = 9283;
|
|
120119
|
+
throw e;
|
|
120120
|
+
}
|
|
120013
120121
|
flashSize = flashSize || 128 * 1024;
|
|
120014
120122
|
let totalInfo = lf("; total bytes: {0} ({1}% of {2}k flash with {3} free)", totalSize, (100 * totalSize / flashSize).toFixed(1), (flashSize / 1024).toFixed(1), flashSize - totalSize);
|
|
120015
120123
|
let res =
|
|
@@ -120017,7 +120125,7 @@ var ts;
|
|
|
120017
120125
|
lf("; generated code sizes (bytes): {0} (incl. {1} user, {2} helpers, {3} vtables, {4} lits); src size {5}\n", lenAllCode, lenCode, lenHelpers, lenVtables, lenLiterals, lenTotal - lenAllCode) +
|
|
120018
120126
|
lf("; assembly: {0} lines; density: {1} bytes/stmt; ({2} stmts)\n", this.lines.length, Math.round(100 * lenCode / numStmts) / 100, numStmts) +
|
|
120019
120127
|
totalInfo + "\n" +
|
|
120020
|
-
this.stats + "\n\n";
|
|
120128
|
+
this.stats + this.getCodeSizeStats() + "\n\n";
|
|
120021
120129
|
let skipOne = false;
|
|
120022
120130
|
this.lines.forEach((ln, i) => {
|
|
120023
120131
|
if (ln.words[0] == "_stored_program") {
|
|
@@ -121818,6 +121926,7 @@ var ts;
|
|
|
121818
121926
|
const info = utf8AsmStringLiteral(strLit);
|
|
121819
121927
|
return `
|
|
121820
121928
|
.balign 4
|
|
121929
|
+
.object ${lbl}
|
|
121821
121930
|
${lbl}: ${this.obj_header(info.vt)}
|
|
121822
121931
|
${info.asm}
|
|
121823
121932
|
`;
|
|
@@ -121828,6 +121937,7 @@ var ts;
|
|
|
121828
121937
|
const align = /f{16}/i.test(data) ? 8 : 4;
|
|
121829
121938
|
return `
|
|
121830
121939
|
.balign ${align}
|
|
121940
|
+
.object ${lbl}
|
|
121831
121941
|
${lbl}: ${this.obj_header("pxt::buffer_vt")}
|
|
121832
121942
|
${hexLiteralAsm(data)}
|
|
121833
121943
|
`;
|
|
@@ -121937,6 +122047,7 @@ ${hexLiteralAsm(data)}
|
|
|
121937
122047
|
;
|
|
121938
122048
|
`);
|
|
121939
122049
|
let baseLabel = this.proc.label();
|
|
122050
|
+
this.write(`.object ${baseLabel} ${JSON.stringify(this.proc.getFullName())}`);
|
|
121940
122051
|
let preLabel = baseLabel + "_pre";
|
|
121941
122052
|
let bkptLabel = baseLabel + "_bkpt";
|
|
121942
122053
|
let locLabel = baseLabel + "_locals";
|
|
@@ -122301,9 +122412,13 @@ ${baseLabel}_nochk:
|
|
|
122301
122412
|
this.writeFailBranch();
|
|
122302
122413
|
});
|
|
122303
122414
|
}
|
|
122415
|
+
helperObject(desc) {
|
|
122416
|
+
return `.object _pxt_helper_${desc.replace(/[^\w]+/g, "_")} "helper: ${desc}"`;
|
|
122417
|
+
}
|
|
122304
122418
|
emitBindHelper() {
|
|
122305
122419
|
const maxArgs = 12;
|
|
122306
122420
|
this.write(`
|
|
122421
|
+
${this.helperObject("bind")}
|
|
122307
122422
|
.section code
|
|
122308
122423
|
_pxt_bind_helper:
|
|
122309
122424
|
push {r0, r2}
|
|
@@ -122778,6 +122893,7 @@ ${baseLabel}_nochk:
|
|
|
122778
122893
|
emitFieldMethods() {
|
|
122779
122894
|
for (let op of ["get", "set"]) {
|
|
122780
122895
|
this.write(`
|
|
122896
|
+
${this.helperObject(op)}
|
|
122781
122897
|
.section code
|
|
122782
122898
|
_pxt_map_${op}:
|
|
122783
122899
|
`);
|
|
@@ -122819,6 +122935,7 @@ ${baseLabel}_nochk:
|
|
|
122819
122935
|
}
|
|
122820
122936
|
emitArrayMethod(op, isBuffer) {
|
|
122821
122937
|
this.write(`
|
|
122938
|
+
${this.helperObject(op + " " + (isBuffer ? "buffer" : "array"))}
|
|
122822
122939
|
.section code
|
|
122823
122940
|
_pxt_${isBuffer ? "buffer" : "array"}_${op}:
|
|
122824
122941
|
`);
|
|
@@ -122903,6 +123020,7 @@ ${baseLabel}_nochk:
|
|
|
122903
123020
|
emitLambdaTrampoline() {
|
|
122904
123021
|
let r3 = pxtc.target.stackAlign ? "r3," : "";
|
|
122905
123022
|
this.write(`
|
|
123023
|
+
${this.helperObject("trampoline")}
|
|
122906
123024
|
.section code
|
|
122907
123025
|
_pxt_lambda_trampoline:
|
|
122908
123026
|
push {${r3} r4, r5, r6, r7, lr}
|
|
@@ -122942,6 +123060,7 @@ ${baseLabel}_nochk:
|
|
|
122942
123060
|
mov r11, r7
|
|
122943
123061
|
pop {${r3} r4, r5, r6, r7, pc}`);
|
|
122944
123062
|
this.write(`
|
|
123063
|
+
${this.helperObject("exn")}
|
|
122945
123064
|
.section code
|
|
122946
123065
|
; r0 - try frame
|
|
122947
123066
|
; r1 - handler PC
|
|
@@ -122970,6 +123089,7 @@ ${baseLabel}_nochk:
|
|
|
122970
123089
|
bx r1
|
|
122971
123090
|
`);
|
|
122972
123091
|
this.write(`
|
|
123092
|
+
${this.helperObject("stringconv")}
|
|
122973
123093
|
.section code
|
|
122974
123094
|
_pxt_stringConv:
|
|
122975
123095
|
`);
|
|
@@ -124284,6 +124404,7 @@ _numops_fromInt:
|
|
|
124284
124404
|
// this make sure to set the Z flag correctly
|
|
124285
124405
|
r += `
|
|
124286
124406
|
.section code
|
|
124407
|
+
.object _pxt_helper_cmp_${op}
|
|
124287
124408
|
_cmp_${op}:
|
|
124288
124409
|
lsls r2, r0, #31
|
|
124289
124410
|
beq .boxed
|
|
@@ -128869,7 +128990,8 @@ var ts;
|
|
|
128869
128990
|
lbl = "_ldlit_" + ++seq;
|
|
128870
128991
|
values[v] = lbl;
|
|
128871
128992
|
}
|
|
128872
|
-
line.
|
|
128993
|
+
line.ldlitLabel = line.words[3];
|
|
128994
|
+
line.update(`ldr ${reg}, ${lbl} ; ${line.ldlitLabel}`);
|
|
128873
128995
|
}
|
|
128874
128996
|
if (line === nextGoodSpot) {
|
|
128875
128997
|
nextGoodSpot = null;
|
|
@@ -128877,6 +128999,7 @@ var ts;
|
|
|
128877
128999
|
let jmplbl = "_jmpwords_" + ++seq;
|
|
128878
129000
|
if (needsJumpOver)
|
|
128879
129001
|
txtLines.push("bb " + jmplbl);
|
|
129002
|
+
txtLines.push(`.object PUSH`);
|
|
128880
129003
|
txtLines.push(".balign 4");
|
|
128881
129004
|
for (let v of Object.keys(values)) {
|
|
128882
129005
|
let lbl = values[v];
|
|
@@ -128884,6 +129007,7 @@ var ts;
|
|
|
128884
129007
|
}
|
|
128885
129008
|
if (needsJumpOver)
|
|
128886
129009
|
txtLines.push(jmplbl + ":");
|
|
129010
|
+
txtLines.push(`.object POP`);
|
|
128887
129011
|
for (let t of txtLines) {
|
|
128888
129012
|
f.buildLine(t, outlines);
|
|
128889
129013
|
let ll = outlines[outlines.length - 1];
|
|
@@ -130178,7 +130302,7 @@ var ts;
|
|
|
130178
130302
|
function inspect(n) {
|
|
130179
130303
|
console.log(stringKind(n));
|
|
130180
130304
|
}
|
|
130181
|
-
// next free error
|
|
130305
|
+
// next free error 9284
|
|
130182
130306
|
function userError(code, msg, secondary = false) {
|
|
130183
130307
|
let e = new Error(msg);
|
|
130184
130308
|
e.ksEmitterUserError = true;
|
|
@@ -136348,7 +136472,8 @@ var ts;
|
|
|
136348
136472
|
asmLabels[lbl] = true;
|
|
136349
136473
|
return "";
|
|
136350
136474
|
});
|
|
136351
|
-
let code = ".
|
|
136475
|
+
let code = ".object inlineasm\n" +
|
|
136476
|
+
".section code\n" +
|
|
136352
136477
|
"@stackmark func\n" +
|
|
136353
136478
|
"@scope user" + asmIdx++ + "\n" +
|
|
136354
136479
|
src + "\n" +
|
|
@@ -136881,6 +137006,7 @@ var ts;
|
|
|
136881
137006
|
for (let data of Object.keys(bin.doubles)) {
|
|
136882
137007
|
let lbl = bin.doubles[data];
|
|
136883
137008
|
bin.otherLiterals.push(`
|
|
137009
|
+
.object ${lbl}
|
|
136884
137010
|
.balign 4
|
|
136885
137011
|
${lbl}: ${snippets.obj_header("pxt::number_vt")}
|
|
136886
137012
|
.hex ${data}
|
|
@@ -136973,6 +137099,7 @@ ${lbl}: ${snippets.obj_header("pxt::number_vt")}
|
|
|
136973
137099
|
// ifaceInfo.mult = 0
|
|
136974
137100
|
let ptrSz = pxtc.target.shortPointers ? ".short" : ".word";
|
|
136975
137101
|
let s = `
|
|
137102
|
+
.object ${info.id}_VT
|
|
136976
137103
|
.balign 4
|
|
136977
137104
|
${info.id}_VT:
|
|
136978
137105
|
.short ${info.allfields.length * 4 + 4} ; size in bytes
|
|
@@ -137070,14 +137197,18 @@ ${hexfile.hexPrelude()}
|
|
|
137070
137197
|
asmsource += hexfile.asmTotalSource; // user-supplied asm
|
|
137071
137198
|
asmsource += "_code_end:\n\n";
|
|
137072
137199
|
pxtc.U.iterMap(bin.codeHelpers, (code, lbl) => {
|
|
137073
|
-
asmsource +=
|
|
137200
|
+
asmsource +=
|
|
137201
|
+
` .section code\n` +
|
|
137202
|
+
` .object _code_helper_${lbl}\n` +
|
|
137203
|
+
`${lbl}:\n` +
|
|
137204
|
+
`${code}\n`;
|
|
137074
137205
|
});
|
|
137075
137206
|
asmsource += snippets.arithmetic();
|
|
137076
137207
|
asmsource += "_helpers_end:\n\n";
|
|
137077
137208
|
bin.usedClassInfos.forEach(info => {
|
|
137078
137209
|
asmsource += vtableToAsm(info, opts, bin);
|
|
137079
137210
|
});
|
|
137080
|
-
asmsource += `\n.balign 4\n_pxt_iface_member_names:\n`;
|
|
137211
|
+
asmsource += `\n.balign 4\n.object _pxt_iface_member_names\n_pxt_iface_member_names:\n`;
|
|
137081
137212
|
asmsource += ` .word ${bin.ifaceMembers.length}\n`;
|
|
137082
137213
|
let idx = 0;
|
|
137083
137214
|
for (let d of bin.ifaceMembers) {
|
|
@@ -137086,7 +137217,7 @@ ${hexfile.hexPrelude()}
|
|
|
137086
137217
|
}
|
|
137087
137218
|
asmsource += ` .word 0\n`;
|
|
137088
137219
|
asmsource += "_vtables_end:\n\n";
|
|
137089
|
-
asmsource += `\n.balign 4\n_pxt_config_data:\n`;
|
|
137220
|
+
asmsource += `\n.balign 4\n.object _pxt_config_data\n_pxt_config_data:\n`;
|
|
137090
137221
|
const cfg = bin.res.configData || [];
|
|
137091
137222
|
// asmsource += ` .word ${cfg.length}, 0 ; num. entries`
|
|
137092
137223
|
for (let d of cfg) {
|
|
@@ -137095,7 +137226,7 @@ ${hexfile.hexPrelude()}
|
|
|
137095
137226
|
asmsource += ` .word 0\n\n`;
|
|
137096
137227
|
emitStrings(snippets, bin);
|
|
137097
137228
|
asmsource += bin.otherLiterals.join("");
|
|
137098
|
-
asmsource += `\n.balign 4\n.section code\n_pxt_perf_counters:\n`;
|
|
137229
|
+
asmsource += `\n.balign 4\n.section code\n.object _perf_counters\n_pxt_perf_counters:\n`;
|
|
137099
137230
|
asmsource += ` .word ${perfCounters.length}\n`;
|
|
137100
137231
|
let strs = "";
|
|
137101
137232
|
for (let i = 0; i < perfCounters.length; ++i) {
|
|
@@ -137128,6 +137259,8 @@ ${hexfile.hexPrelude()}
|
|
|
137128
137259
|
b.ei.testAssembler(); // just in case
|
|
137129
137260
|
if (target.switches.noPeepHole)
|
|
137130
137261
|
b.disablePeepHole = true;
|
|
137262
|
+
if (target.switches.size)
|
|
137263
|
+
b.codeSizeStats = true;
|
|
137131
137264
|
b.lookupExternalLabel = hexfile.lookupFunctionAddr;
|
|
137132
137265
|
b.normalizeExternalLabel = s => {
|
|
137133
137266
|
let inf = hexfile.lookupFunc(s);
|
|
@@ -137188,6 +137321,7 @@ ${hexfile.hexPrelude()}
|
|
|
137188
137321
|
}
|
|
137189
137322
|
return `
|
|
137190
137323
|
.balign 16
|
|
137324
|
+
.object _stored_program
|
|
137191
137325
|
_stored_program: .hex ${res}
|
|
137192
137326
|
`;
|
|
137193
137327
|
}
|
|
@@ -139735,7 +139869,7 @@ var ts;
|
|
|
139735
139869
|
}
|
|
139736
139870
|
const type = checker === null || checker === void 0 ? void 0 : checker.getTypeAtLocation(param);
|
|
139737
139871
|
const typeSymbol = service.getPxtSymbolFromTsSymbol(type === null || type === void 0 ? void 0 : type.symbol, apis, checker);
|
|
139738
|
-
if ((typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.fixedInstances) && python) {
|
|
139872
|
+
if (((typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.fixedInstances) || (typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.emitAsConstant)) && python) {
|
|
139739
139873
|
return pxt.Util.snakify(paramDefl);
|
|
139740
139874
|
}
|
|
139741
139875
|
if (python) {
|
package/built/pxtblockly.js
CHANGED
|
@@ -12931,9 +12931,6 @@ var pxtblockly;
|
|
|
12931
12931
|
}
|
|
12932
12932
|
}
|
|
12933
12933
|
containerSize.height += addedHeight;
|
|
12934
|
-
if (this.sourceBlock_.RTL) {
|
|
12935
|
-
Blockly.utils.uiMenu.adjustBBoxesForRTL(viewportBBox, anchorBBox, containerSize);
|
|
12936
|
-
}
|
|
12937
12934
|
// Position the menu.
|
|
12938
12935
|
Blockly.WidgetDiv.positionWithAnchor(viewportBBox, anchorBBox, containerSize, this.sourceBlock_.RTL);
|
|
12939
12936
|
// (<any>scrollContainer).focus();
|
package/built/pxtblocks.js
CHANGED
|
@@ -9369,9 +9369,6 @@ var pxtblockly;
|
|
|
9369
9369
|
}
|
|
9370
9370
|
}
|
|
9371
9371
|
containerSize.height += addedHeight;
|
|
9372
|
-
if (this.sourceBlock_.RTL) {
|
|
9373
|
-
Blockly.utils.uiMenu.adjustBBoxesForRTL(viewportBBox, anchorBBox, containerSize);
|
|
9374
|
-
}
|
|
9375
9372
|
// Position the menu.
|
|
9376
9373
|
Blockly.WidgetDiv.positionWithAnchor(viewportBBox, anchorBBox, containerSize, this.sourceBlock_.RTL);
|
|
9377
9374
|
// (<any>scrollContainer).focus();
|
package/built/pxtcompiler.d.ts
CHANGED
package/built/pxtcompiler.js
CHANGED
|
@@ -665,6 +665,7 @@ var ts;
|
|
|
665
665
|
const info = utf8AsmStringLiteral(strLit);
|
|
666
666
|
return `
|
|
667
667
|
.balign 4
|
|
668
|
+
.object ${lbl}
|
|
668
669
|
${lbl}: ${this.obj_header(info.vt)}
|
|
669
670
|
${info.asm}
|
|
670
671
|
`;
|
|
@@ -675,6 +676,7 @@ var ts;
|
|
|
675
676
|
const align = /f{16}/i.test(data) ? 8 : 4;
|
|
676
677
|
return `
|
|
677
678
|
.balign ${align}
|
|
679
|
+
.object ${lbl}
|
|
678
680
|
${lbl}: ${this.obj_header("pxt::buffer_vt")}
|
|
679
681
|
${hexLiteralAsm(data)}
|
|
680
682
|
`;
|
|
@@ -784,6 +786,7 @@ ${hexLiteralAsm(data)}
|
|
|
784
786
|
;
|
|
785
787
|
`);
|
|
786
788
|
let baseLabel = this.proc.label();
|
|
789
|
+
this.write(`.object ${baseLabel} ${JSON.stringify(this.proc.getFullName())}`);
|
|
787
790
|
let preLabel = baseLabel + "_pre";
|
|
788
791
|
let bkptLabel = baseLabel + "_bkpt";
|
|
789
792
|
let locLabel = baseLabel + "_locals";
|
|
@@ -1148,9 +1151,13 @@ ${baseLabel}_nochk:
|
|
|
1148
1151
|
this.writeFailBranch();
|
|
1149
1152
|
});
|
|
1150
1153
|
}
|
|
1154
|
+
helperObject(desc) {
|
|
1155
|
+
return `.object _pxt_helper_${desc.replace(/[^\w]+/g, "_")} "helper: ${desc}"`;
|
|
1156
|
+
}
|
|
1151
1157
|
emitBindHelper() {
|
|
1152
1158
|
const maxArgs = 12;
|
|
1153
1159
|
this.write(`
|
|
1160
|
+
${this.helperObject("bind")}
|
|
1154
1161
|
.section code
|
|
1155
1162
|
_pxt_bind_helper:
|
|
1156
1163
|
push {r0, r2}
|
|
@@ -1625,6 +1632,7 @@ ${baseLabel}_nochk:
|
|
|
1625
1632
|
emitFieldMethods() {
|
|
1626
1633
|
for (let op of ["get", "set"]) {
|
|
1627
1634
|
this.write(`
|
|
1635
|
+
${this.helperObject(op)}
|
|
1628
1636
|
.section code
|
|
1629
1637
|
_pxt_map_${op}:
|
|
1630
1638
|
`);
|
|
@@ -1666,6 +1674,7 @@ ${baseLabel}_nochk:
|
|
|
1666
1674
|
}
|
|
1667
1675
|
emitArrayMethod(op, isBuffer) {
|
|
1668
1676
|
this.write(`
|
|
1677
|
+
${this.helperObject(op + " " + (isBuffer ? "buffer" : "array"))}
|
|
1669
1678
|
.section code
|
|
1670
1679
|
_pxt_${isBuffer ? "buffer" : "array"}_${op}:
|
|
1671
1680
|
`);
|
|
@@ -1750,6 +1759,7 @@ ${baseLabel}_nochk:
|
|
|
1750
1759
|
emitLambdaTrampoline() {
|
|
1751
1760
|
let r3 = pxtc.target.stackAlign ? "r3," : "";
|
|
1752
1761
|
this.write(`
|
|
1762
|
+
${this.helperObject("trampoline")}
|
|
1753
1763
|
.section code
|
|
1754
1764
|
_pxt_lambda_trampoline:
|
|
1755
1765
|
push {${r3} r4, r5, r6, r7, lr}
|
|
@@ -1789,6 +1799,7 @@ ${baseLabel}_nochk:
|
|
|
1789
1799
|
mov r11, r7
|
|
1790
1800
|
pop {${r3} r4, r5, r6, r7, pc}`);
|
|
1791
1801
|
this.write(`
|
|
1802
|
+
${this.helperObject("exn")}
|
|
1792
1803
|
.section code
|
|
1793
1804
|
; r0 - try frame
|
|
1794
1805
|
; r1 - handler PC
|
|
@@ -1817,6 +1828,7 @@ ${baseLabel}_nochk:
|
|
|
1817
1828
|
bx r1
|
|
1818
1829
|
`);
|
|
1819
1830
|
this.write(`
|
|
1831
|
+
${this.helperObject("stringconv")}
|
|
1820
1832
|
.section code
|
|
1821
1833
|
_pxt_stringConv:
|
|
1822
1834
|
`);
|
|
@@ -3131,6 +3143,7 @@ _numops_fromInt:
|
|
|
3131
3143
|
// this make sure to set the Z flag correctly
|
|
3132
3144
|
r += `
|
|
3133
3145
|
.section code
|
|
3146
|
+
.object _pxt_helper_cmp_${op}
|
|
3134
3147
|
_cmp_${op}:
|
|
3135
3148
|
lsls r2, r0, #31
|
|
3136
3149
|
beq .boxed
|
|
@@ -7716,7 +7729,8 @@ var ts;
|
|
|
7716
7729
|
lbl = "_ldlit_" + ++seq;
|
|
7717
7730
|
values[v] = lbl;
|
|
7718
7731
|
}
|
|
7719
|
-
line.
|
|
7732
|
+
line.ldlitLabel = line.words[3];
|
|
7733
|
+
line.update(`ldr ${reg}, ${lbl} ; ${line.ldlitLabel}`);
|
|
7720
7734
|
}
|
|
7721
7735
|
if (line === nextGoodSpot) {
|
|
7722
7736
|
nextGoodSpot = null;
|
|
@@ -7724,6 +7738,7 @@ var ts;
|
|
|
7724
7738
|
let jmplbl = "_jmpwords_" + ++seq;
|
|
7725
7739
|
if (needsJumpOver)
|
|
7726
7740
|
txtLines.push("bb " + jmplbl);
|
|
7741
|
+
txtLines.push(`.object PUSH`);
|
|
7727
7742
|
txtLines.push(".balign 4");
|
|
7728
7743
|
for (let v of Object.keys(values)) {
|
|
7729
7744
|
let lbl = values[v];
|
|
@@ -7731,6 +7746,7 @@ var ts;
|
|
|
7731
7746
|
}
|
|
7732
7747
|
if (needsJumpOver)
|
|
7733
7748
|
txtLines.push(jmplbl + ":");
|
|
7749
|
+
txtLines.push(`.object POP`);
|
|
7734
7750
|
for (let t of txtLines) {
|
|
7735
7751
|
f.buildLine(t, outlines);
|
|
7736
7752
|
let ll = outlines[outlines.length - 1];
|
|
@@ -9025,7 +9041,7 @@ var ts;
|
|
|
9025
9041
|
function inspect(n) {
|
|
9026
9042
|
console.log(stringKind(n));
|
|
9027
9043
|
}
|
|
9028
|
-
// next free error
|
|
9044
|
+
// next free error 9284
|
|
9029
9045
|
function userError(code, msg, secondary = false) {
|
|
9030
9046
|
let e = new Error(msg);
|
|
9031
9047
|
e.ksEmitterUserError = true;
|
|
@@ -15195,7 +15211,8 @@ var ts;
|
|
|
15195
15211
|
asmLabels[lbl] = true;
|
|
15196
15212
|
return "";
|
|
15197
15213
|
});
|
|
15198
|
-
let code = ".
|
|
15214
|
+
let code = ".object inlineasm\n" +
|
|
15215
|
+
".section code\n" +
|
|
15199
15216
|
"@stackmark func\n" +
|
|
15200
15217
|
"@scope user" + asmIdx++ + "\n" +
|
|
15201
15218
|
src + "\n" +
|
|
@@ -15728,6 +15745,7 @@ var ts;
|
|
|
15728
15745
|
for (let data of Object.keys(bin.doubles)) {
|
|
15729
15746
|
let lbl = bin.doubles[data];
|
|
15730
15747
|
bin.otherLiterals.push(`
|
|
15748
|
+
.object ${lbl}
|
|
15731
15749
|
.balign 4
|
|
15732
15750
|
${lbl}: ${snippets.obj_header("pxt::number_vt")}
|
|
15733
15751
|
.hex ${data}
|
|
@@ -15820,6 +15838,7 @@ ${lbl}: ${snippets.obj_header("pxt::number_vt")}
|
|
|
15820
15838
|
// ifaceInfo.mult = 0
|
|
15821
15839
|
let ptrSz = pxtc.target.shortPointers ? ".short" : ".word";
|
|
15822
15840
|
let s = `
|
|
15841
|
+
.object ${info.id}_VT
|
|
15823
15842
|
.balign 4
|
|
15824
15843
|
${info.id}_VT:
|
|
15825
15844
|
.short ${info.allfields.length * 4 + 4} ; size in bytes
|
|
@@ -15917,14 +15936,18 @@ ${hexfile.hexPrelude()}
|
|
|
15917
15936
|
asmsource += hexfile.asmTotalSource; // user-supplied asm
|
|
15918
15937
|
asmsource += "_code_end:\n\n";
|
|
15919
15938
|
pxtc.U.iterMap(bin.codeHelpers, (code, lbl) => {
|
|
15920
|
-
asmsource +=
|
|
15939
|
+
asmsource +=
|
|
15940
|
+
` .section code\n` +
|
|
15941
|
+
` .object _code_helper_${lbl}\n` +
|
|
15942
|
+
`${lbl}:\n` +
|
|
15943
|
+
`${code}\n`;
|
|
15921
15944
|
});
|
|
15922
15945
|
asmsource += snippets.arithmetic();
|
|
15923
15946
|
asmsource += "_helpers_end:\n\n";
|
|
15924
15947
|
bin.usedClassInfos.forEach(info => {
|
|
15925
15948
|
asmsource += vtableToAsm(info, opts, bin);
|
|
15926
15949
|
});
|
|
15927
|
-
asmsource += `\n.balign 4\n_pxt_iface_member_names:\n`;
|
|
15950
|
+
asmsource += `\n.balign 4\n.object _pxt_iface_member_names\n_pxt_iface_member_names:\n`;
|
|
15928
15951
|
asmsource += ` .word ${bin.ifaceMembers.length}\n`;
|
|
15929
15952
|
let idx = 0;
|
|
15930
15953
|
for (let d of bin.ifaceMembers) {
|
|
@@ -15933,7 +15956,7 @@ ${hexfile.hexPrelude()}
|
|
|
15933
15956
|
}
|
|
15934
15957
|
asmsource += ` .word 0\n`;
|
|
15935
15958
|
asmsource += "_vtables_end:\n\n";
|
|
15936
|
-
asmsource += `\n.balign 4\n_pxt_config_data:\n`;
|
|
15959
|
+
asmsource += `\n.balign 4\n.object _pxt_config_data\n_pxt_config_data:\n`;
|
|
15937
15960
|
const cfg = bin.res.configData || [];
|
|
15938
15961
|
// asmsource += ` .word ${cfg.length}, 0 ; num. entries`
|
|
15939
15962
|
for (let d of cfg) {
|
|
@@ -15942,7 +15965,7 @@ ${hexfile.hexPrelude()}
|
|
|
15942
15965
|
asmsource += ` .word 0\n\n`;
|
|
15943
15966
|
emitStrings(snippets, bin);
|
|
15944
15967
|
asmsource += bin.otherLiterals.join("");
|
|
15945
|
-
asmsource += `\n.balign 4\n.section code\n_pxt_perf_counters:\n`;
|
|
15968
|
+
asmsource += `\n.balign 4\n.section code\n.object _perf_counters\n_pxt_perf_counters:\n`;
|
|
15946
15969
|
asmsource += ` .word ${perfCounters.length}\n`;
|
|
15947
15970
|
let strs = "";
|
|
15948
15971
|
for (let i = 0; i < perfCounters.length; ++i) {
|
|
@@ -15975,6 +15998,8 @@ ${hexfile.hexPrelude()}
|
|
|
15975
15998
|
b.ei.testAssembler(); // just in case
|
|
15976
15999
|
if (target.switches.noPeepHole)
|
|
15977
16000
|
b.disablePeepHole = true;
|
|
16001
|
+
if (target.switches.size)
|
|
16002
|
+
b.codeSizeStats = true;
|
|
15978
16003
|
b.lookupExternalLabel = hexfile.lookupFunctionAddr;
|
|
15979
16004
|
b.normalizeExternalLabel = s => {
|
|
15980
16005
|
let inf = hexfile.lookupFunc(s);
|
|
@@ -16035,6 +16060,7 @@ ${hexfile.hexPrelude()}
|
|
|
16035
16060
|
}
|
|
16036
16061
|
return `
|
|
16037
16062
|
.balign 16
|
|
16063
|
+
.object _stored_program
|
|
16038
16064
|
_stored_program: .hex ${res}
|
|
16039
16065
|
`;
|
|
16040
16066
|
}
|
|
@@ -18582,7 +18608,7 @@ var ts;
|
|
|
18582
18608
|
}
|
|
18583
18609
|
const type = checker === null || checker === void 0 ? void 0 : checker.getTypeAtLocation(param);
|
|
18584
18610
|
const typeSymbol = service.getPxtSymbolFromTsSymbol(type === null || type === void 0 ? void 0 : type.symbol, apis, checker);
|
|
18585
|
-
if ((typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.fixedInstances) && python) {
|
|
18611
|
+
if (((typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.fixedInstances) || (typeSymbol === null || typeSymbol === void 0 ? void 0 : typeSymbol.attributes.emitAsConstant)) && python) {
|
|
18586
18612
|
return pxt.Util.snakify(paramDefl);
|
|
18587
18613
|
}
|
|
18588
18614
|
if (python) {
|
package/built/pxteditor.d.ts
CHANGED
|
@@ -377,6 +377,7 @@ declare namespace pxt.editor {
|
|
|
377
377
|
renderUsbPairDialog?: (firmwareUrl?: string, failedOnce?: boolean) => any;
|
|
378
378
|
renderIncompatibleHardwareDialog?: (unsupportedParts: string[]) => any;
|
|
379
379
|
showUploadInstructionsAsync?: (fn: string, url: string, confirmAsync: (options: any) => Promise<number>) => Promise<void>;
|
|
380
|
+
showProgramTooLargeErrorAsync?: (variants: string[], confirmAsync: (options: any) => Promise<number>) => Promise<pxt.commands.RecompileOptions>;
|
|
380
381
|
toolboxOptions?: IToolboxOptions;
|
|
381
382
|
blocklyPatch?: (pkgTargetVersion: string, dom: Element) => void;
|
|
382
383
|
webUsbPairDialogAsync?: (pairAsync: () => Promise<boolean>, confirmAsync: (options: any) => Promise<number>) => Promise<number>;
|