MCPcopy Index your code
hub / github.com/Macuyiko/minecraft-python / arrayComprehension

Function arrayComprehension

ServerEditorWeb/ace/worker-javascript.js:6475–6558  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6473 }
6474
6475 var arrayComprehension = function () {
6476 var CompArray = function () {
6477 this.mode = "use";
6478 this.variables = [];
6479 };
6480 var _carrays = [];
6481 var _current;
6482 function declare(v) {
6483 var l = _current.variables.filter(function (elt) {
6484 if (elt.value === v) {
6485 elt.undef = false;
6486 return v;
6487 }
6488 }).length;
6489 return l !== 0;
6490 }
6491 function use(v) {
6492 var l = _current.variables.filter(function (elt) {
6493 if (elt.value === v && !elt.undef) {
6494 if (elt.unused === true) {
6495 elt.unused = false;
6496 }
6497 return v;
6498 }
6499 }).length;
6500 return (l === 0);
6501 }
6502 return {stack: function () {
6503 _current = new CompArray();
6504 _carrays.push(_current);
6505 },
6506 unstack: function () {
6507 _current.variables.filter(function (v) {
6508 if (v.unused)
6509 warning("W098", v.token, v.raw_text || v.value);
6510 if (v.undef)
6511 isundef(v.funct, "W117", v.token, v.value);
6512 });
6513 _carrays.splice(-1, 1);
6514 _current = _carrays[_carrays.length - 1];
6515 },
6516 setState: function (s) {
6517 if (_.contains(["use", "define", "generate", "filter"], s))
6518 _current.mode = s;
6519 },
6520 check: function (v) {
6521 if (!_current) {
6522 return;
6523 }
6524 if (_current && _current.mode === "use") {
6525 if (use(v)) {
6526 _current.variables.push({
6527 funct: funct,
6528 token: state.tokens.curr,
6529 value: v,
6530 undef: true,
6531 unused: false
6532 });

Callers 1

itselfFunction · 0.85

Calls 4

warningFunction · 0.85
isundefFunction · 0.85
useFunction · 0.85
declareFunction · 0.85

Tested by

no test coverage detected