MCPcopy Create free account
hub / github.com/evildecay/etcdkeeper / scopeManager

Function scopeManager

assets/etcdkeeper/framework/ace/worker-javascript.js:10168–10801  ·  view source on GitHub ↗
(state, predefined, exported, declared)

Source from the content-addressed store, hash-verified

10166var events = _dereq_("events");
10167var marker = {};
10168var scopeManager = function(state, predefined, exported, declared) {
10169
10170 var _current;
10171 var _scopeStack = [];
10172
10173 function _newScope(type) {
10174 _current = {
10175 "(labels)": Object.create(null),
10176 "(usages)": Object.create(null),
10177 "(breakLabels)": Object.create(null),
10178 "(parent)": _current,
10179 "(type)": type,
10180 "(params)": (type === "functionparams" || type === "catchparams") ? [] : null
10181 };
10182 _scopeStack.push(_current);
10183 }
10184
10185 _newScope("global");
10186 _current["(predefined)"] = predefined;
10187
10188 var _currentFunctBody = _current; // this is the block after the params = function
10189
10190 var usedPredefinedAndGlobals = Object.create(null);
10191 var impliedGlobals = Object.create(null);
10192 var unuseds = [];
10193 var emitter = new events.EventEmitter();
10194
10195 function warning(code, token) {
10196 emitter.emit("warning", {
10197 code: code,
10198 token: token,
10199 data: _.slice(arguments, 2)
10200 });
10201 }
10202
10203 function error(code, token) {
10204 emitter.emit("warning", {
10205 code: code,
10206 token: token,
10207 data: _.slice(arguments, 2)
10208 });
10209 }
10210
10211 function _setupUsages(labelName) {
10212 if (!_current["(usages)"][labelName]) {
10213 _current["(usages)"][labelName] = {
10214 "(modified)": [],
10215 "(reassigned)": [],
10216 "(tokens)": []
10217 };
10218 }
10219 }
10220
10221 var _getUnusedOption = function(unused_opt) {
10222 if (unused_opt === undefined) {
10223 unused_opt = state.option.unused;
10224 }
10225

Callers 1

itselfFunction · 0.85

Calls 10

_newScopeFunction · 0.85
warningFunction · 0.85
_warnUnusedFunction · 0.85
_checkForUnusedFunction · 0.85
_checkOuterShadowFunction · 0.85
_latedefWarningFunction · 0.85
_getLabelFunction · 0.85
_setupUsagesFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected