UNPKG

scope-tree

Version:

Module scope tree for CodeInspector

59 lines (56 loc) 3.49 kB
module.exports.__fsLocationMap = [[1, 8, 3, 7], [1, 19, 3, 23], [1, 8, 3, 34], [3, 8, 4, 1], [3, 14, 4, 7], [3, 25, 4, 18], [3, 33, 4, 26], [4, 5, 5, 3], [4, 50, 5, 36], [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, 19, 15, 13], [12, 13, 16, 7], [12, 21, 16, 15], [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, 62, 23, 44], [19, 62, 24, 5], [19, 62, 24, 15], [19, 72, 24, 26], [19, 40, 25, 5], [19, 40, 25, 20], [19, 55, 25, 36], [20, 9, 28, 5], [20, 12, 28, 9], [20, 17, 28, 14], [20, 23, 28, 20], [20, 27, 28, 24], [21, 13, 29, 7], [21, 20, 29, 14], [23, 9, 31, 5], [23, 14, 31, 10], [23, 20, 31, 16], [23, 24, 31, 20], [24, 13, 32, 7], [24, 19, 32, 13], [25, 13, 33, 7], [25, 19, 33, 13], [26, 13, 34, 7], [26, 21, 34, 15], [27, 13, 35, 7], [27, 27, 35, 21], [28, 13, 36, 7], [28, 22, 36, 16], [29, 13, 37, 7], [29, 24, 37, 18], [32, 9, 39, 5], [32, 16, 39, 12], [32, 21, 39, 17], [32, 27, 39, 23], [32, 31, 39, 27], [34, 5, 42, 3], [34, 25, 42, 19], [34, 25, 43, 5], [34, 25, 43, 14], [34, 34, 43, 24], [35, 9, 45, 5], [35, 12, 45, 9], [35, 17, 45, 14], [35, 23, 45, 20], [35, 27, 45, 24], [36, 13, 46, 7], [36, 20, 46, 14], [38, 9, 48, 5], [38, 14, 48, 10], [38, 20, 48, 16], [38, 24, 48, 20], [39, 13, 49, 7], [39, 19, 49, 13], [40, 13, 50, 7], [40, 19, 50, 13], [41, 13, 51, 7], [41, 21, 51, 15], [42, 13, 52, 7], [42, 24, 52, 18], [45, 9, 54, 5], [45, 16, 54, 12], [45, 21, 54, 17], [45, 27, 54, 23], [45, 31, 54, 27], [3, 14, 57, 16], [3, 14, 57, 29]]; module.exports.__esModule = true; const FirescriptRuntime = require('firescript-runtime').FirescriptRuntime; const Scope = require('./Scope').Scope; class BlockScope extends Scope { addVariable (kind, typing, name, value) { FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, kind, 'kind'); FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_ANY, typing, 'typing'); FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, name, 'name'); if (this.scope.has(name)) { return false; } this.scope.set(name, { type: 'variable', kind: kind, name: name, typing: typing, value: value, callCount: 0 }); return this.scope.get(name); } addFunction (name, params, returnTyping, isAsync) { isAsync = isAsync || false; returnTyping = returnTyping || 'any'; FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, name, 'name'); FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_ARR, params, 'params'); if (this.scope.has(name)) { return false; } this.scope.set(name, { type: 'function', name: name, params: params, returnTyping: returnTyping, isAsync: isAsync, callCount: 0 }); return this.scope.get(name); } addClass (name, params) { params = params || [ ]; FirescriptRuntime.paramTyping(FirescriptRuntime.TYPE_STR, name, 'name'); if (this.scope.has(name)) { return false; } this.scope.set(name, { type: 'class', name: name, params: params, callCount: 0 }); return this.scope.get(name); } } module.exports.BlockScope = BlockScope;