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

Function blockScope

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

Source from the content-addressed store, hash-verified

6641 }
6642
6643 var blockScope = function () {
6644 var _current = {};
6645 var _variables = [_current];
6646
6647 function _checkBlockLabels() {
6648 for (var t in _current) {
6649 if (_current[t]["(type)"] === "unused") {
6650 if (state.option.unused) {
6651 var tkn = _current[t]["(token)"];
6652 if (tkn.exported) {
6653 continue;
6654 }
6655 var line = tkn.line;
6656 var chr = tkn.character;
6657 warningAt("W098", line, chr, t);
6658 }
6659 }
6660 }
6661 }
6662
6663 return {
6664 stack: function () {
6665 _current = {};
6666 _variables.push(_current);
6667 },
6668
6669 unstack: function () {
6670 _checkBlockLabels();
6671 _variables.splice(_variables.length - 1, 1);
6672 _current = _.last(_variables);
6673 },
6674
6675 getlabel: function (l) {
6676 for (var i = _variables.length - 1 ; i >= 0; --i) {
6677 if (_.has(_variables[i], l) && !_variables[i][l]["(shadowed)"]) {
6678 return _variables[i];
6679 }
6680 }
6681 },
6682
6683 shadow: function (name) {
6684 for (var i = _variables.length - 1; i >= 0; i--) {
6685 if (_.has(_variables[i], name)) {
6686 _variables[i][name]["(shadowed)"] = true;
6687 }
6688 }
6689 },
6690
6691 unshadow: function (name) {
6692 for (var i = _variables.length - 1; i >= 0; i--) {
6693 if (_.has(_variables[i], name)) {
6694 _variables[i][name]["(shadowed)"] = false;
6695 }
6696 }
6697 },
6698
6699 atTop: function () {
6700 return _variables.length === 1;

Callers 1

itselfFunction · 0.85

Calls 1

_checkBlockLabelsFunction · 0.85

Tested by

no test coverage detected