pxt-common-packages
Version:
Microsoft MakeCode (PXT) common packages
350 lines (282 loc) • 10.2 kB
JavaScript
// total=10109 new=75.23% cached=0.00% other=24.77%
(function (ectx) {
'use strict';
const runtime = ectx.runtime;
const oops = ectx.oops;
const doNothing = ectx.doNothing;
const pxsim = ectx.pxsim;
const globals = ectx.globals;
const maybeYield = ectx.maybeYield;
const setupDebugger = ectx.setupDebugger;
const isBreakFrame = ectx.isBreakFrame;
const breakpoint = ectx.breakpoint;
const trace = ectx.trace;
const checkStack = ectx.checkStack;
const leave = ectx.leave;
const checkResumeConsumed = ectx.checkResumeConsumed;
const setupResume = ectx.setupResume;
const setupLambda = ectx.setupLambda;
const checkSubtype = ectx.checkSubtype;
const failedCast = ectx.failedCast;
const buildResume = ectx.buildResume;
const mkVTable = ectx.mkVTable;
const bind = ectx.bind;
const leaveAccessor = ectx.leaveAccessor;
const __this = runtime;
const pxtrt = pxsim.pxtrt;
let yieldSteps = 1;
ectx.setupYield(function() { yieldSteps = 100; })
pxsim.setTitle("screen");
pxsim.setConfigData({}, {});
pxtrt.mapKeyNames = [
""
];
__this.setupPerfCounters([]);
const pxsim_Array__getAt = pxsim.Array_.getAt;
const pxsim_Array__length = pxsim.Array_.length;
const pxsim_Array__mk = pxsim.Array_.mk;
const pxsim_Array__push = pxsim.Array_.push;
const pxsim_Boolean__bang = pxsim.Boolean_.bang;
const pxsim_String__concat = pxsim.String_.concat;
const pxsim_String__stringConv = pxsim.String_.stringConv;
const pxsim_numops_toBool = pxsim.numops.toBool;
const pxsim_numops_toBoolDecr = pxsim.numops.toBoolDecr;
const pxsim_pxtcore_mkAction = pxsim.pxtcore.mkAction;
const pxsim_pxtcore_mkClassInstance = pxsim.pxtcore.mkClassInstance;
const pxsim_pxtrt_ldlocRef = pxsim.pxtrt.ldlocRef;
const pxsim_pxtrt_mapGetByString = pxsim.pxtrt.mapGetByString;
const pxsim_pxtrt_stclo = pxsim.pxtrt.stclo;
const pxsim_pxtrt_stlocRef = pxsim.pxtrt.stlocRef;
const pxsim_Boolean_ = pxsim.Boolean_;
const pxsim_pxtcore = pxsim.pxtcore;
const pxsim_String_ = pxsim.String_;
const pxsim_ImageMethods = pxsim.ImageMethods;
const pxsim_Array_ = pxsim.Array_;
const pxsim_pxtrt = pxsim.pxtrt;
const pxsim_numops = pxsim.numops;
function _main___P51551(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
globals._intervals___51795 = (undefined);
globals._pollEventQueue___51808 = (undefined);
globals.__updated___52048 = (false);
r0 = pxsim.control.runInParallel(control___screen_inline__P52053);
r0 = pxsim.image.create(178, 128);
globals.screen___52076 = (r0);
s.tmp_0 = control___screen_setupUpdate__P52050_mk(s);
s.tmp_0.arg0 = _screen_internal_inline__P52081;
s.callLocIdx = 4; s.pc = 1; return s.tmp_0;
case 1:
r0 = s.retval;
globals.control_EventContext_onStats___51863 = (_screen_internal_inline__P52086);
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
_main___P51551.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"imagesoverrides.ts","functionName":"<main>","argumentNames":[]}
_main___P51551.continuations = [ ]
function _main___P51551_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: _main___P51551, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
tmp_0: undefined,
} }
function control___screen_inline__P52053(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
case 1:
r0 = pxsim_numops_toBoolDecr(true);
if (!r0) { step = 4; continue; }
globals.__updated___52048 = (false);
s.tmp_0 = pause__P51872_mk(s);
s.tmp_0.arg0 = 200;
s.callLocIdx = 2; s.pc = 5; return s.tmp_0;
case 5:
r0 = s.retval;
r0 = pxsim_numops_toBoolDecr(globals.__updated___52048);
s.tmp_1 = r0;
r0 = pxsim_Boolean__bang(s.tmp_1);
s.tmp_0 = r0;
r0 = pxsim_numops_toBoolDecr(s.tmp_0);
if (!r0) { step = 2; continue; }
s.tmp_2 = control___screen_update__P52049_mk(s);
s.callLocIdx = 3; s.pc = 6; return s.tmp_2;
case 6:
r0 = s.retval;
globals.__updated___52048 = (true);
case 2:
case 3:
{ step = 1; continue; }
case 4:
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
control___screen_inline__P52053.info = {"start":396,"length":211,"line":17,"column":26,"endLine":26,"endColumn":5,"fileName":"frame.ts","functionName":"inline","argumentNames":[]}
function control___screen_inline__P52053_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: control___screen_inline__P52053, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
tmp_0: undefined,
tmp_1: undefined,
tmp_2: undefined,
} }
function _screen_internal_inline__P52081(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
r0 = pxsim_pxtcore.updateScreen(globals.screen___52076);
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
_screen_internal_inline__P52081.info = {"start":327,"length":26,"line":8,"column":33,"endLine":8,"endColumn":59,"fileName":"targetoverrides.ts","functionName":"inline","argumentNames":[]}
function _screen_internal_inline__P52081_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: _screen_internal_inline__P52081, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
} }
function _screen_internal_inline__P52086(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
if (s.lambdaArgs) {
s.arg0 = (s.lambdaArgs[0]);
s.lambdaArgs = null;
}
r0 = pxsim_pxtcore.updateStats(s.arg0);
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
_screen_internal_inline__P52086.info = {"start":390,"length":56,"line":9,"column":35,"endLine":11,"endColumn":5,"fileName":"targetoverrides.ts","functionName":"inline","argumentNames":["msg"]}
function _screen_internal_inline__P52086_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: _screen_internal_inline__P52086, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
arg0: undefined,
} }
function control___screen_setupUpdate__P52050(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
if (s.lambdaArgs) {
s.arg0 = (s.lambdaArgs[0]);
s.lambdaArgs = null;
}
globals.__updated___52048 = (true);
globals.__update___52046 = (s.arg0);
s.tmp_0 = lambda_1_mk(s);
s.tmp_0.argL = s.arg0;
setupLambda(s.tmp_0, s.tmp_0.argL);
s.callLocIdx = 1; s.pc = 1; return s.tmp_0;
case 1:
r0 = s.retval;
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
control___screen_setupUpdate__P52050.info = {"start":198,"length":125,"line":10,"column":4,"endLine":14,"endColumn":5,"fileName":"frame.ts","functionName":"setupUpdate","argumentNames":["update"]}
function control___screen_setupUpdate__P52050_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: control___screen_setupUpdate__P52050, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
tmp_0: undefined,
arg0: undefined,
} }
function control___screen_update__P52049(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
r0 = pxsim_numops_toBoolDecr(globals.__update___52046);
if (!r0) { step = 1; continue; }
s.tmp_0 = lambda_1_mk(s);
s.tmp_0.argL = globals.__update___52046;
setupLambda(s.tmp_0, s.tmp_0.argL);
s.callLocIdx = 0; s.pc = 3; return s.tmp_0;
case 3:
r0 = s.retval;
case 1:
case 2:
globals.__updated___52048 = (true);
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
control___screen_update__P52049.info = {"start":90,"length":102,"line":4,"column":4,"endLine":8,"endColumn":5,"fileName":"frame.ts","functionName":"update","argumentNames":[]}
function control___screen_update__P52049_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: control___screen_update__P52049, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
tmp_0: undefined,
} }
function pause__P51872(s) {
let r0 = s.r0, step = s.pc;
s.pc = -1;
while (true) {
if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) return null;
switch (step) {
case 0:
if (s.lambdaArgs) {
s.arg0 = (s.lambdaArgs[0]);
s.lambdaArgs = null;
}
setupResume(s, 1);
pxsim.loops.pause(s.arg0);
checkResumeConsumed();
return;
case 1:
r0 = s.retval;
r0 = undefined;
return leave(s, r0)
default: oops()
} } }
pause__P51872.info = {"start":246,"length":57,"line":7,"column":0,"endLine":9,"endColumn":1,"fileName":"pxt_modules/base/pause.ts","functionName":"pause","argumentNames":["ms"]}
function pause__P51872_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: pause__P51872, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
arg0: undefined,
} }
function lambda_1_mk(s) {
checkStack(s.depth);
return {
parent: s, fn: null, depth: s.depth + 1,
pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
tmp_0: undefined,
tmp_1: undefined,
tmp_2: undefined,
tmp_3: undefined,
tmp_4: undefined,
arg0: undefined,
} }
const breakpoints = setupDebugger(1, ["__updated___52048","screen___52076","__update___52046"])
return _main___P51551
})