scope-tree
Version:
Module scope tree for CodeInspector
42 lines (40 loc) • 2.49 kB
JavaScript
module.exports.__fsLocationMap = [[1, 8, 3, 7], [1, 24, 3, 28], [1, 8, 3, 44], [3, 8, 4, 1], [3, 14, 4, 7], [3, 28, 4, 21], [3, 36, 4, 29], [4, 5, 5, 3], [4, 52, 5, 37], [5, 9, 9, 5], [5, 12, 9, 9], [5, 17, 9, 14], [5, 23, 9, 20], [5, 27, 9, 24], [6, 13, 10, 7], [6, 20, 10, 14], [8, 9, 12, 5], [8, 14, 12, 10], [8, 20, 12, 16], [8, 24, 12, 20], [9, 13, 13, 7], [9, 19, 13, 13], [10, 13, 14, 7], [10, 19, 14, 13], [11, 13, 15, 7], [11, 21, 15, 15], [12, 13, 16, 7], [12, 23, 16, 17], [13, 13, 17, 7], [13, 20, 17, 14], [14, 13, 18, 7], [14, 24, 18, 18], [17, 9, 20, 5], [17, 16, 20, 12], [17, 21, 20, 17], [17, 27, 20, 23], [17, 31, 20, 27], [19, 5, 23, 3], [19, 40, 23, 30], [19, 40, 24, 5], [19, 40, 24, 16], [19, 51, 24, 28], [20, 9, 27, 5], [20, 12, 27, 9], [20, 17, 27, 14], [20, 23, 27, 20], [20, 27, 27, 24], [21, 13, 28, 7], [21, 20, 28, 14], [23, 9, 30, 5], [23, 14, 30, 10], [23, 20, 30, 16], [23, 24, 30, 20], [24, 13, 31, 7], [24, 19, 31, 13], [25, 13, 32, 7], [25, 19, 32, 13], [26, 13, 33, 7], [26, 21, 33, 15], [27, 13, 34, 7], [27, 23, 34, 17], [28, 13, 35, 7], [28, 24, 35, 18], [31, 9, 37, 5], [31, 16, 37, 12], [31, 21, 37, 17], [31, 27, 37, 23], [31, 31, 37, 27], [3, 14, 40, 16], [3, 14, 40, 32]];
module.exports.__esModule = true;
const FirescriptRuntime = require('firescript-runtime').FirescriptRuntime;
const BlockScope = require('./BlockScope').BlockScope;
class FunctionScope extends BlockScope {
addParam (typing, name, required, value) {
FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_ANY, typing, 'typing');
FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, name, 'name');
FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_BOOL, required, 'required');
if (this.scope.has(name)) {
return false;
}
this.scope.set(name, {
type: 'param',
name: name,
typing: typing,
required: required,
value: value,
callCount: 0
});
return this.scope.get(name);
}
addProperty (typing, name, required) {
required = required || false;
FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, typing, 'typing');
FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, name, 'name');
if (this.scope.has(name)) {
return false;
}
this.scope.set(name, {
type: 'property',
name: name,
typing: typing,
required: required,
callCount: 0
});
return this.scope.get(name);
}
}
module.exports.FunctionScope = FunctionScope;