pxt-core 7.5.43 → 7.5.46

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/pxt.js CHANGED
@@ -140422,11 +140422,19 @@ var pxt;
140422
140422
  return pxt.U.lookup(internalApis, name) || pxt.U.lookup(externalApis, name);
140423
140423
  }
140424
140424
  function lookupGlobalSymbol(name) {
140425
+ var _a;
140425
140426
  if (!name)
140426
140427
  return undefined;
140427
140428
  let sym = lookupApi(name);
140428
140429
  if (sym)
140429
140430
  getOrSetSymbolType(sym);
140431
+ else if (name.indexOf(".") && !name.endsWith(".__constructor")) {
140432
+ const base = name.substring(0, name.lastIndexOf("."));
140433
+ const baseSymbol = lookupGlobalSymbol(base);
140434
+ if ((baseSymbol === null || baseSymbol === void 0 ? void 0 : baseSymbol.kind) === 8 /* Class */ && ((_a = baseSymbol.extendsTypes) === null || _a === void 0 ? void 0 : _a.length)) {
140435
+ return lookupGlobalSymbol(baseSymbol.extendsTypes[0] + name.substring(base.length));
140436
+ }
140437
+ }
140430
140438
  return sym;
140431
140439
  }
140432
140440
  function initApis(apisInfo, tsShadowFiles) {
@@ -140509,7 +140517,10 @@ var pxt;
140509
140517
  pref += ".";
140510
140518
  }
140511
140519
  let qualifiedName = pref + name;
140512
- if (isLocalScope(scope)
140520
+ if (scope.kind === "ClassDef") {
140521
+ varSym = addSymbol(2 /* Property */, qualifiedName);
140522
+ }
140523
+ else if (isLocalScope(scope)
140513
140524
  && (modifier === py_1.VarModifier.Global
140514
140525
  || modifier === py_1.VarModifier.NonLocal)) {
140515
140526
  varSym = addSymbol(4 /* Variable */, name);
@@ -140623,7 +140634,7 @@ var pxt;
140623
140634
  };
140624
140635
  }
140625
140636
  }
140626
- // next free error 9575
140637
+ // next free error 9576
140627
140638
  function error(astNode, code, msg) {
140628
140639
  diagnostics.push(mkDiag(astNode, pxtc.DiagnosticCategory.Error, code, msg));
140629
140640
  //const pos = position(astNode ? astNode.startPos || 0 : 0, mod.source)
@@ -140838,8 +140849,19 @@ var pxt;
140838
140849
  let qn = cd.symInfo.qName;
140839
140850
  return pxt.U.values(internalApis).filter(e => e.namespace == qn && e.kind == 2 /* Property */);
140840
140851
  }
140841
- function getClassField(ct, n, checkOnly = false, skipBases = false) {
140842
- let qid = ct.pyQName + "." + n;
140852
+ function getClassField(ct, n, isStatic, checkOnly = false, skipBases = false) {
140853
+ let qid;
140854
+ if (n === "__init__") {
140855
+ qid = ct.pyQName + ".__constructor";
140856
+ }
140857
+ else {
140858
+ if (n.startsWith(ct.pyQName + ".")) {
140859
+ qid = n;
140860
+ }
140861
+ else {
140862
+ qid = ct.pyQName + "." + n;
140863
+ }
140864
+ }
140843
140865
  let f = lookupGlobalSymbol(qid);
140844
140866
  if (f)
140845
140867
  return f;
@@ -140849,7 +140871,7 @@ var pxt;
140849
140871
  if (sym) {
140850
140872
  if (sym == ct)
140851
140873
  pxt.U.userError("field lookup loop on: " + sym.qName + " / " + n);
140852
- let classF = getClassField(sym, n, true);
140874
+ let classF = getClassField(sym, n, isStatic, true);
140853
140875
  if (classF)
140854
140876
  return classF;
140855
140877
  }
@@ -140857,7 +140879,7 @@ var pxt;
140857
140879
  }
140858
140880
  if (!checkOnly && ct.pyAST && ct.pyAST.kind == "ClassDef") {
140859
140881
  let sym = addSymbol(2 /* Property */, qid);
140860
- sym.isInstance = true;
140882
+ sym.isInstance = !isStatic;
140861
140883
  return sym;
140862
140884
  }
140863
140885
  return null;
@@ -140874,16 +140896,14 @@ var pxt;
140874
140896
  const recvType = typeOf(recv);
140875
140897
  const constructorTypes = getTypesForFieldLookup(recvType);
140876
140898
  for (let ct of constructorTypes) {
140877
- let f = getClassField(ct, n, checkOnly);
140899
+ let isModule = !!recvType.moduleType;
140900
+ let f = getClassField(ct, n, isModule, checkOnly);
140878
140901
  if (f) {
140879
- let isModule = !!recvType.moduleType;
140880
140902
  if (isModule) {
140881
140903
  if (f.isInstance)
140882
140904
  error(null, 9505, pxt.U.lf("the field '{0}' of '{1}' is not static", n, ct.pyQName));
140883
140905
  }
140884
140906
  else {
140885
- if (!f.isInstance)
140886
- error(null, 9504, pxt.U.lf("the field '{0}' of '{1}' is static", n, ct.pyQName));
140887
140907
  if (isSuper(recv))
140888
140908
  f.isProtected = true;
140889
140909
  else if (isThis(recv)) {
@@ -141066,14 +141086,17 @@ var pxt;
141066
141086
  return mkType({});
141067
141087
  }
141068
141088
  function doArgs(n, isMethod) {
141089
+ var _a;
141069
141090
  const args = n.args;
141070
141091
  if (args.kwonlyargs.length)
141071
141092
  error(n, 9517, pxt.U.lf("keyword-only arguments not supported yet"));
141072
141093
  let nargs = args.args.slice();
141073
141094
  if (isMethod) {
141074
- if (nargs[0].arg != "self")
141075
- error(n, 9518, pxt.U.lf("first argument of method has to be called 'self'"));
141076
- nargs.shift();
141095
+ if (((_a = nargs[0]) === null || _a === void 0 ? void 0 : _a.arg) !== "self")
141096
+ n.symInfo.isStatic = true;
141097
+ else {
141098
+ nargs.shift();
141099
+ }
141077
141100
  }
141078
141101
  else {
141079
141102
  if (nargs.some(a => a.arg == "self"))
@@ -141235,6 +141258,7 @@ var pxt;
141235
141258
  }
141236
141259
  function emitFunctionDef(n, inline = false) {
141237
141260
  return guardedScope(n, () => {
141261
+ var _a, _b, _c, _d;
141238
141262
  const isMethod = !!ctx.currClass && !ctx.currFun;
141239
141263
  const topLev = isTopLevel();
141240
141264
  const nested = !!ctx.currFun;
@@ -141287,7 +141311,7 @@ var pxt;
141287
141311
  let scopeValueVar = n.vars["value"];
141288
141312
  let valueVar = scopeValueVar === null || scopeValueVar === void 0 ? void 0 : scopeValueVar.symbol;
141289
141313
  if (funname == "__set__" && valueVar) {
141290
- let cf = getClassField(ctx.currClass.symInfo, "__get__");
141314
+ let cf = getClassField(ctx.currClass.symInfo, "__get__", false);
141291
141315
  if (cf && cf.pyAST && cf.pyAST.kind == "FunctionDef")
141292
141316
  unify(n, valueVar.pyRetType, cf.pyRetType);
141293
141317
  }
@@ -141295,6 +141319,9 @@ var pxt;
141295
141319
  }
141296
141320
  if (!prefix) {
141297
141321
  prefix = funname[0] == "_" ? (sym.isProtected ? "protected" : "private") : "public";
141322
+ if (n.symInfo.isStatic) {
141323
+ prefix += " static";
141324
+ }
141298
141325
  }
141299
141326
  nodes.push(B.mkText(prefix + " "), quote(funname));
141300
141327
  }
@@ -141306,7 +141333,7 @@ var pxt;
141306
141333
  else
141307
141334
  nodes.push(B.mkText("export function "), quote(funname));
141308
141335
  }
141309
- let retType = n.returns ? compileType(n.returns) : sym.pyRetType;
141336
+ let retType = n.name == "__init__" ? undefined : (n.returns ? compileType(n.returns) : sym.pyRetType);
141310
141337
  nodes.push(doArgs(n, isMethod), retType && canonicalize(retType) != tpVoid ? typeAnnot(retType) : B.mkText(""));
141311
141338
  // make sure type is initialized
141312
141339
  getOrSetSymbolType(sym);
@@ -141314,6 +141341,13 @@ var pxt;
141314
141341
  if (n.name == "__init__") {
141315
141342
  if (!ctx.currClass)
141316
141343
  error(n, 9533, lf("__init__ method '{0}' is missing current class context", sym.pyQName));
141344
+ if ((_a = ctx.currClass) === null || _a === void 0 ? void 0 : _a.baseClass) {
141345
+ const firstStatement = n.body[0];
141346
+ const superConstructor = ctx.currClass.baseClass.pyQName + ".__constructor";
141347
+ if (((_d = (_c = (_b = firstStatement.value) === null || _b === void 0 ? void 0 : _b.func) === null || _c === void 0 ? void 0 : _c.symbolInfo) === null || _d === void 0 ? void 0 : _d.pyQName) !== superConstructor) {
141348
+ error(n, 9575, lf("Sub classes must call 'super().__init__' as the first statement inside an __init__ method"));
141349
+ }
141350
+ }
141317
141351
  for (let f of listClassFields(ctx.currClass)) {
141318
141352
  let p = f.pyAST;
141319
141353
  if (p && p.value) {
@@ -141357,22 +141391,61 @@ var pxt;
141357
141391
  nodes.push(B.mkCommaSep(n.bases.map(expr)));
141358
141392
  let b = getClassDef(n.bases[0]);
141359
141393
  if (b) {
141360
- n.baseClass = b;
141394
+ n.baseClass = b.symInfo;
141361
141395
  sym.extendsTypes = [b.symInfo.pyQName];
141362
141396
  }
141397
+ else {
141398
+ const nm = tryGetName(n.bases[0]);
141399
+ if (nm) {
141400
+ const localSym = lookupSymbol(nm);
141401
+ const globalSym = lookupGlobalSymbol(nm);
141402
+ n.baseClass = localSym || globalSym;
141403
+ if (n.baseClass)
141404
+ sym.extendsTypes = [n.baseClass.pyQName];
141405
+ }
141406
+ }
141363
141407
  }
141364
141408
  }
141365
- let body = stmts(n.body);
141409
+ const classDefs = n.body.filter(s => n.isNamespace || s.kind === "FunctionDef");
141410
+ const staticStmts = n.isNamespace ? [] : n.body.filter(s => classDefs.indexOf(s) === -1 && s.kind !== "Pass");
141411
+ let body = stmts(classDefs);
141366
141412
  nodes.push(body);
141367
- let fieldDefs = listClassFields(n)
141368
- .filter(f => f.kind == 2 /* Property */ && f.isInstance)
141369
- .map(f => {
141370
- if (!f.pyName || !f.pyRetType)
141371
- error(n, 9535, lf("field definition missing py name or ret type", f.qName));
141372
- return f;
141373
- })
141374
- .map((f) => B.mkStmt(accessAnnot(f), quote(f.pyName), typeAnnot(f.pyRetType)));
141375
- body.children = fieldDefs.concat(body.children);
141413
+ // Python classes allow arbitrary statements in their bodies, sort of like namespaces.
141414
+ // Take all of these statements and put them in a static method that we can call when
141415
+ // the class is defined.
141416
+ let generatedInitFunction = false;
141417
+ if (staticStmts.length) {
141418
+ generatedInitFunction = true;
141419
+ const staticBody = stmts(staticStmts);
141420
+ const initFun = B.mkStmt(B.mkGroup([
141421
+ B.mkText(`public static __init${n.name}() `),
141422
+ staticBody
141423
+ ]));
141424
+ body.children.unshift(initFun);
141425
+ }
141426
+ if (!n.isNamespace) {
141427
+ const fieldDefs = listClassFields(n)
141428
+ .map(f => {
141429
+ if (!f.pyName || !f.pyRetType)
141430
+ error(n, 9535, lf("field definition missing py name or return type", f.qName));
141431
+ return f;
141432
+ });
141433
+ const staticFieldSymbols = fieldDefs.filter(f => !f.isInstance);
141434
+ const instanceFields = fieldDefs.filter(f => f.isInstance)
141435
+ .map((f) => B.mkStmt(accessAnnot(f), quote(f.pyName), typeAnnot(f.pyRetType)));
141436
+ const staticFields = staticFieldSymbols
141437
+ .map((f) => B.mkGroup([
141438
+ B.mkStmt(accessAnnot(f), B.mkText("static "), quote(f.pyName), typeAnnot(f.pyRetType)),
141439
+ declareLocalStatic(quoteStr(n.name), quoteStr(f.pyName), t2s(f.pyRetType))
141440
+ ]));
141441
+ body.children = staticFields.concat(instanceFields).concat(body.children);
141442
+ }
141443
+ if (generatedInitFunction) {
141444
+ nodes = [
141445
+ B.mkStmt(B.mkGroup(nodes)),
141446
+ B.mkStmt(B.mkText(`${n.name}.__init${n.name}()`))
141447
+ ];
141448
+ }
141376
141449
  return B.mkStmt(B.mkGroup(nodes));
141377
141450
  }),
141378
141451
  Return: (n) => {
@@ -141679,7 +141752,7 @@ var pxt;
141679
141752
  // class fields can't be const
141680
141753
  // hack: value in @namespace should always be const
141681
141754
  isConstCall = !!(value && ctx.currClass.isNamespace);
141682
- let fd = getClassField(ctx.currClass.symInfo, nm);
141755
+ let fd = getClassField(ctx.currClass.symInfo, nm, true);
141683
141756
  if (!fd)
141684
141757
  error(n, 9544, lf("cannot get class field"));
141685
141758
  // TODO: use or remove this code
@@ -141721,7 +141794,9 @@ var pxt;
141721
141794
  error(n, 9539, lf("function '{0}' missing return type", fd.pyQName));
141722
141795
  unifyTypeOf(target, fd.pyRetType);
141723
141796
  fd.isInstance = false;
141724
- pref = ctx.currClass.isNamespace ? `export ${isConstCall ? "const" : "let"} ` : "static ";
141797
+ if (ctx.currClass.isNamespace) {
141798
+ pref = `export ${isConstCall ? "const" : "let"} `;
141799
+ }
141725
141800
  }
141726
141801
  if (value)
141727
141802
  unifyTypeOf(target, typeOf(value));
@@ -141787,6 +141862,7 @@ var pxt;
141787
141862
  }
141788
141863
  }
141789
141864
  function possibleDef(n, excludeLet = false) {
141865
+ var _a, _b;
141790
141866
  let id = n.id;
141791
141867
  let currScopeVar = lookupScopeSymbol(id);
141792
141868
  let curr = currScopeVar === null || currScopeVar === void 0 ? void 0 : currScopeVar.symbol;
@@ -141821,6 +141897,10 @@ var pxt;
141821
141897
  if (n.isdef && !excludeLet) {
141822
141898
  return B.mkGroup([B.mkText("let "), quote(id)]);
141823
141899
  }
141900
+ else if ((curr === null || curr === void 0 ? void 0 : curr.namespace) && (curr === null || curr === void 0 ? void 0 : curr.qName) && !(((_a = ctx.currClass) === null || _a === void 0 ? void 0 : _a.isNamespace) && ((_b = ctx.currClass) === null || _b === void 0 ? void 0 : _b.name) === (curr === null || curr === void 0 ? void 0 : curr.namespace))) {
141901
+ // If this is a static variable in a class, we want the full qname
141902
+ return quote(curr.qName);
141903
+ }
141824
141904
  else
141825
141905
  return quote(id);
141826
141906
  }
@@ -141834,20 +141914,27 @@ var pxt;
141834
141914
  //return id.replace(/([a-z0-9])_([a-zA-Z0-9])/g, (f: string, x: string, y: string) => x + y.toUpperCase())
141835
141915
  }
141836
141916
  function tryGetName(e) {
141917
+ var _a;
141837
141918
  if (e.kind == "Name") {
141838
141919
  let s = e.id;
141839
141920
  let scopeV = lookupVar(s);
141840
141921
  let v = scopeV === null || scopeV === void 0 ? void 0 : scopeV.symbol;
141841
- if (v && v.expandsTo)
141842
- return v.expandsTo;
141843
- else
141844
- return s;
141922
+ if (v) {
141923
+ if (v.expandsTo)
141924
+ return v.expandsTo;
141925
+ else if (ctx.currClass && !ctx.currFun && !(scopeV === null || scopeV === void 0 ? void 0 : scopeV.modifier) && v.qName)
141926
+ return v.qName;
141927
+ }
141928
+ return s;
141845
141929
  }
141846
141930
  if (e.kind == "Attribute") {
141847
141931
  let pref = tryGetName(e.value);
141848
141932
  if (pref)
141849
141933
  return pref + "." + e.attr;
141850
141934
  }
141935
+ if (isSuper(e) && ((_a = ctx.currClass) === null || _a === void 0 ? void 0 : _a.baseClass)) {
141936
+ return ctx.currClass.baseClass.qName;
141937
+ }
141851
141938
  return undefined;
141852
141939
  }
141853
141940
  function getName(e) {
@@ -142055,6 +142142,7 @@ var pxt;
142055
142142
  return r;
142056
142143
  },
142057
142144
  Call: (n) => {
142145
+ var _a, _b, _c, _d, _e;
142058
142146
  // TODO(dz): move body out; needs seperate PR that doesn't touch content
142059
142147
  n.func.inCalledPosition = true;
142060
142148
  let nm = tryGetName(n.func);
@@ -142066,6 +142154,9 @@ var pxt;
142066
142154
  let methName = "";
142067
142155
  if (isClass) {
142068
142156
  fun = lookupSymbol(namedSymbol.pyQName + ".__constructor");
142157
+ if (!fun) {
142158
+ fun = addSymbolFor(3 /* Function */, createDummyConstructorSymbol(namedSymbol === null || namedSymbol === void 0 ? void 0 : namedSymbol.pyAST));
142159
+ }
142069
142160
  }
142070
142161
  else {
142071
142162
  if (n.func.kind == "Attribute") {
@@ -142085,7 +142176,7 @@ var pxt;
142085
142176
  if (ctx.currClass && ctx.currClass.baseClass) {
142086
142177
  if (!n.tsType)
142087
142178
  error(n, 9543, lf("call expr missing ts type"));
142088
- unifyClass(n, n.tsType, ctx.currClass.baseClass.symInfo);
142179
+ unifyClass(n, n.tsType, ctx.currClass.baseClass);
142089
142180
  }
142090
142181
  return B.mkText("super");
142091
142182
  }
@@ -142145,6 +142236,17 @@ var pxt;
142145
142236
  unify(n, n.tsType, tpString);
142146
142237
  return B.mkInfix(B.mkText(`""`), "+", expr(n.args[0]));
142147
142238
  }
142239
+ const isSuperAttribute = n.func.kind === "Attribute" && isSuper(n.func.value);
142240
+ if (!fun && isSuperAttribute) {
142241
+ fun = lookupGlobalSymbol(nm);
142242
+ }
142243
+ const isSuperConstructor = ((_a = ctx.currFun) === null || _a === void 0 ? void 0 : _a.name) === "__init__" &&
142244
+ (fun === null || fun === void 0 ? void 0 : fun.name) === "__constructor" &&
142245
+ ((_c = (_b = ctx.currClass) === null || _b === void 0 ? void 0 : _b.baseClass) === null || _c === void 0 ? void 0 : _c.pyQName) === (fun === null || fun === void 0 ? void 0 : fun.namespace) &&
142246
+ isSuperAttribute;
142247
+ if (isSuperConstructor) {
142248
+ fun = lookupSymbol(((_e = (_d = ctx.currClass) === null || _d === void 0 ? void 0 : _d.baseClass) === null || _e === void 0 ? void 0 : _e.pyQName) + ".__constructor");
142249
+ }
142148
142250
  if (!fun) {
142149
142251
  error(n, 9508, pxt.U.lf("can't find called function '{0}'", nm));
142150
142252
  }
@@ -142252,7 +142354,13 @@ var pxt;
142252
142354
  ]);
142253
142355
  }
142254
142356
  }
142255
- let fn = methName ? B.mkInfix(expr(recv), ".", B.mkText(methName)) : expr(n.func);
142357
+ let fn;
142358
+ if (isSuperConstructor) {
142359
+ fn = B.mkText("super");
142360
+ }
142361
+ else {
142362
+ fn = methName ? B.mkInfix(expr(recv), ".", B.mkText(methName)) : expr(n.func);
142363
+ }
142256
142364
  let nodes = [
142257
142365
  fn,
142258
142366
  B.mkText("("),
@@ -142909,6 +143017,68 @@ var pxt;
142909
143017
  break;
142910
143018
  }
142911
143019
  }
143020
+ function createDummyConstructorSymbol(def, sym = def.symInfo) {
143021
+ var _a;
143022
+ const existing = lookupApi(sym.pyQName + ".__constructor");
143023
+ if (!existing && ((_a = sym.extendsTypes) === null || _a === void 0 ? void 0 : _a.length)) {
143024
+ const parentSymbol = lookupSymbol(sym.extendsTypes[0]) || lookupGlobalSymbol(sym.extendsTypes[0]);
143025
+ if (parentSymbol) {
143026
+ return createDummyConstructorSymbol(def, parentSymbol);
143027
+ }
143028
+ }
143029
+ const result = {
143030
+ kind: "FunctionDef",
143031
+ name: "__init__",
143032
+ startPos: def.startPos,
143033
+ endPos: def.endPos,
143034
+ parent: def,
143035
+ body: [],
143036
+ args: {
143037
+ kind: "Arguments",
143038
+ startPos: 0,
143039
+ endPos: 0,
143040
+ args: [{
143041
+ startPos: 0,
143042
+ endPos: 0,
143043
+ kind: "Arg",
143044
+ arg: "self"
143045
+ }],
143046
+ kw_defaults: [],
143047
+ kwonlyargs: [],
143048
+ defaults: []
143049
+ },
143050
+ decorator_list: [],
143051
+ vars: {},
143052
+ symInfo: mkSymbol(3 /* Function */, def.symInfo.qName + ".__constructor")
143053
+ };
143054
+ result.symInfo.parameters = [];
143055
+ result.symInfo.pyRetType = mkType({ classType: def.symInfo });
143056
+ if (existing) {
143057
+ result.args.args.push(...existing.parameters.map(p => ({
143058
+ startPos: 0,
143059
+ endPos: 0,
143060
+ kind: "Arg",
143061
+ arg: p.name,
143062
+ })));
143063
+ result.symInfo.parameters.push(...existing.parameters.map(p => {
143064
+ if (p.pyType)
143065
+ return p;
143066
+ const res = Object.assign(Object.assign({}, p), { pyType: mapTsType(p.type) });
143067
+ return res;
143068
+ }));
143069
+ }
143070
+ return result;
143071
+ }
143072
+ function declareLocalStatic(className, name, type) {
143073
+ const isSetVar = `___${name}_is_set`;
143074
+ const localVar = `___${name}`;
143075
+ return B.mkStmt(B.mkStmt(B.mkText(`private ${isSetVar}: boolean`)), B.mkStmt(B.mkText(`private ${localVar}: ${type}`)), B.mkStmt(B.mkText(`get ${name}(): ${type}`), B.mkBlock([
143076
+ B.mkText(`return this.${isSetVar} ? this.${localVar} : ${className}.${name}`)
143077
+ ])), B.mkStmt(B.mkText(`set ${name}(value: ${type})`), B.mkBlock([
143078
+ B.mkStmt(B.mkText(`this.${isSetVar} = true`)),
143079
+ B.mkStmt(B.mkText(`this.${localVar} = value`)),
143080
+ ])));
143081
+ }
142912
143082
  })(py = pxt.py || (pxt.py = {}));
142913
143083
  })(pxt || (pxt = {}));
142914
143084
  // Lexer spec: https://docs.python.org/3/reference/lexical_analysis.html
@@ -14988,6 +14988,15 @@ var pxtblockly;
14988
14988
  }
14989
14989
  })(pxtblockly || (pxtblockly = {}));
14990
14990
  /// <reference path="../../localtypings/pxtblockly.d.ts" />
14991
+ // common time options -- do not remove
14992
+ // lf("100 ms")
14993
+ // lf("200 ms")
14994
+ // lf("500 ms")
14995
+ // lf("1 second")
14996
+ // lf("2 seconds")
14997
+ // lf("5 seconds")
14998
+ // lf("1 minute")
14999
+ // lf("1 hour")
14991
15000
  var pxtblockly;
14992
15001
  (function (pxtblockly) {
14993
15002
  class FieldNumberDropdown extends Blockly.FieldNumberDropdown {
@@ -14999,7 +15008,12 @@ var pxtblockly;
14999
15008
  let newOptions;
15000
15009
  if (this.menuGenerator_) {
15001
15010
  newOptions = JSON.parse(this.menuGenerator_).map((x) => {
15002
- return (typeof x == 'object') ? x : [String(x), String(x)];
15011
+ if (typeof x == 'object') {
15012
+ return [pxt.Util.rlf(x[0]), x[1]];
15013
+ }
15014
+ else {
15015
+ return [String(x), String(x)];
15016
+ }
15003
15017
  });
15004
15018
  }
15005
15019
  return newOptions;
@@ -11426,6 +11426,15 @@ var pxtblockly;
11426
11426
  }
11427
11427
  })(pxtblockly || (pxtblockly = {}));
11428
11428
  /// <reference path="../../localtypings/pxtblockly.d.ts" />
11429
+ // common time options -- do not remove
11430
+ // lf("100 ms")
11431
+ // lf("200 ms")
11432
+ // lf("500 ms")
11433
+ // lf("1 second")
11434
+ // lf("2 seconds")
11435
+ // lf("5 seconds")
11436
+ // lf("1 minute")
11437
+ // lf("1 hour")
11429
11438
  var pxtblockly;
11430
11439
  (function (pxtblockly) {
11431
11440
  class FieldNumberDropdown extends Blockly.FieldNumberDropdown {
@@ -11437,7 +11446,12 @@ var pxtblockly;
11437
11446
  let newOptions;
11438
11447
  if (this.menuGenerator_) {
11439
11448
  newOptions = JSON.parse(this.menuGenerator_).map((x) => {
11440
- return (typeof x == 'object') ? x : [String(x), String(x)];
11449
+ if (typeof x == 'object') {
11450
+ return [pxt.Util.rlf(x[0]), x[1]];
11451
+ }
11452
+ else {
11453
+ return [String(x), String(x)];
11454
+ }
11441
11455
  });
11442
11456
  }
11443
11457
  return newOptions;
package/built/pxtpy.d.ts CHANGED
@@ -16,6 +16,7 @@ declare namespace pxt.py {
16
16
  pyAST?: AST;
17
17
  isProtected?: boolean;
18
18
  moduleTypeMarker?: {};
19
+ isStatic?: boolean;
19
20
  declared?: number;
20
21
  }
21
22
  interface TypeOptions {
@@ -170,7 +171,7 @@ declare namespace pxt.py {
170
171
  keywords: Keyword[];
171
172
  body: Stmt[];
172
173
  decorator_list: Expr[];
173
- baseClass?: ClassDef;
174
+ baseClass?: SymbolInfo;
174
175
  isEnum?: boolean;
175
176
  isNamespace?: boolean;
176
177
  }