UNPKG

scope-tree

Version:

Module scope tree for CodeInspector

119 lines (117 loc) 5.95 kB
module.exports.__fsLocationMap = [[1, 8, 2, 7], [1, 24, 2, 28], [1, 8, 2, 44], [3, 8, 3, 1], [3, 14, 3, 7], [3, 26, 3, 19], [3, 34, 3, 27], [4, 5, 4, 3], [5, 9, 5, 5], [7, 9, 6, 5], [7, 14, 6, 10], [9, 5, 9, 3], [11, 9, 11, 5], [11, 15, 11, 11], [11, 33, 11, 29], [12, 13, 12, 7], [13, 13, 13, 7], [14, 13, 14, 7], [15, 13, 15, 7], [16, 13, 16, 7], [17, 13, 17, 7], [17, 14, 17, 9], [17, 27, 17, 22], [17, 33, 17, 28], [17, 47, 17, 42], [17, 55, 17, 50], [18, 13, 18, 7], [19, 13, 19, 7], [20, 13, 20, 7], [21, 13, 21, 7], [22, 13, 22, 7], [23, 13, 23, 7], [24, 13, 24, 7], [25, 13, 25, 7], [27, 13, 27, 7], [28, 13, 28, 7], [29, 13, 29, 7], [30, 13, 30, 7], [31, 13, 31, 7], [32, 13, 32, 7], [33, 13, 33, 7], [34, 13, 34, 7], [35, 13, 35, 7], [36, 13, 36, 7], [37, 13, 37, 7], [38, 13, 38, 7], [40, 13, 40, 7], [41, 13, 41, 7], [42, 13, 42, 7], [43, 13, 43, 7], [44, 13, 44, 7], [45, 13, 45, 7], [46, 13, 46, 7], [47, 13, 47, 7], [48, 13, 48, 7], [49, 13, 49, 7], [50, 13, 50, 7], [51, 13, 51, 7], [52, 13, 52, 7], [53, 13, 53, 7], [54, 13, 54, 7], [55, 13, 55, 7], [56, 13, 56, 7], [57, 13, 57, 7], [58, 13, 58, 7], [59, 13, 59, 7], [60, 13, 60, 7], [61, 13, 61, 7], [62, 13, 62, 7], [63, 13, 63, 7], [64, 13, 64, 7], [65, 13, 65, 7], [66, 13, 66, 7], [67, 13, 67, 7], [68, 13, 68, 7], [69, 13, 69, 7], [70, 13, 70, 7], [71, 13, 71, 7], [72, 13, 72, 7], [73, 13, 73, 7], [74, 13, 74, 7], [75, 13, 75, 7], [76, 13, 76, 7], [77, 13, 77, 7], [78, 13, 78, 7], [79, 13, 79, 7], [80, 13, 80, 7], [81, 13, 81, 7], [82, 13, 82, 7], [83, 13, 83, 7], [84, 13, 84, 7], [85, 13, 85, 7], [86, 13, 86, 7], [90, 13, 89, 7], [91, 13, 90, 7], [92, 13, 91, 7], [93, 13, 92, 7], [94, 13, 93, 7], [95, 13, 94, 7], [98, 9, 96, 5], [98, 25, 96, 21], [98, 33, 96, 29], [98, 34, 96, 30], [99, 13, 97, 7], [99, 16, 97, 11], [99, 22, 97, 17], [99, 30, 97, 25], [100, 17, 98, 9], [100, 23, 98, 15], [100, 30, 98, 22], [100, 33, 98, 25], [101, 17, 99, 9], [101, 23, 99, 15], [101, 32, 99, 24], [101, 35, 99, 27], [101, 41, 99, 33], [103, 17, 100, 9], [103, 22, 100, 14], [103, 34, 100, 26], [103, 40, 100, 32], [104, 13, 101, 9], [105, 17, 102, 9], [105, 22, 102, 14], [105, 34, 102, 26], [105, 38, 102, 30], [109, 9, 105, 5], [109, 14, 105, 10], [109, 26, 105, 22], [109, 35, 105, 31], [109, 42, 105, 38], [110, 9, 106, 5], [110, 14, 106, 10], [110, 26, 106, 22], [110, 35, 106, 31], [110, 42, 106, 38], [111, 9, 107, 5], [111, 14, 107, 10], [111, 26, 107, 22], [111, 35, 107, 31], [111, 42, 107, 38], [112, 9, 108, 5], [112, 14, 108, 10], [112, 26, 108, 22], [112, 35, 108, 31], [112, 42, 108, 38], [113, 9, 109, 5], [113, 14, 109, 10], [113, 26, 109, 22], [113, 35, 109, 31], [113, 42, 109, 38], [114, 9, 110, 5], [114, 14, 110, 10], [114, 26, 110, 22], [114, 35, 110, 31], [114, 42, 110, 38], [115, 9, 111, 5], [115, 14, 111, 10], [115, 26, 111, 22], [115, 33, 111, 29], [115, 40, 111, 36], [116, 9, 112, 5], [116, 14, 112, 10], [116, 26, 112, 22], [116, 35, 112, 31], [116, 42, 112, 38], [117, 9, 113, 5], [117, 14, 113, 10], [117, 26, 113, 22], [117, 35, 113, 31], [117, 42, 113, 38], [118, 9, 114, 5], [118, 14, 114, 10], [118, 26, 114, 22], [118, 35, 114, 31], [118, 42, 114, 38], [3, 14, 117, 16], [3, 14, 117, 30]]; module.exports.__esModule = true; const BlockScope = require('./BlockScope').BlockScope; class GlobalScope extends BlockScope { constructor () { super(); this.registerNodeScope(); } registerNodeScope () { // TODO Register function param typings const globalFunctions = [ 'Buffer', 'clearImmediate', 'clearInterval', 'clearTimeout', 'queueMicrotask', [ 'require', { name: 'modulePath', typing: 'str' } ], 'setImmediate', 'setInterval', 'setTimeout', 'TextDecoder', 'TextEncoder', 'URL', 'URLSearchParams', 'WebAssembly', // global js functions 'eval', 'uneval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'encodeURI', 'encodeURIComponent', 'decodeURI', 'decodeURIComponent', 'escape', 'unescape', // global js objects 'Object', 'Function', 'Boolean', 'Symbol', 'Error', 'AggregateError', 'EvalError', 'InternalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', 'Number', 'BigInt', 'Math', 'Date', 'String', 'RegExp', 'Array', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array', 'Map', 'Set', 'WeakMap', 'WeakSet', 'ArrayBuffer', 'SharedArrayBuffer', 'Atomics', 'DataView', 'JSON', 'Promise', 'Generator', 'GeneratorFunction', 'AsyncFunction', 'Reflect', 'Proxy', 'Intl', // Global testing methods // TODO enable it by a flag 'describe', 'it', 'before', 'after', 'beforeEach', 'afterEach' ]; globalFunctions.forEach((fn) => { if (Array.isArray(fn)) { const name = fn[0]; const params = fn.slice(1); this.addFunction(name, params); } else { this.addFunction(fn, [ ]); } }); this.addVariable('const', 'obj', 'console'); this.addVariable('const', 'arr', 'arguments'); this.addVariable('const', 'obj', 'process'); this.addVariable('const', 'obj', 'module'); this.addVariable('const', 'str', '__dirname'); this.addVariable('const', 'str', '__filename'); this.addVariable('let', 'obj', 'exports'); this.addVariable('const', 'obj', 'global'); this.addVariable('const', 'obj', 'window'); this.addVariable('const', 'obj', 'document'); } } module.exports.GlobalScope = GlobalScope;