mambascript 0.5.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/README.md +509 -267
  3. package/bin/mamba +1 -258
  4. package/decision.js +1 -246
  5. package/docs/coverage.md +70 -0
  6. package/docs/features.md +3348 -0
  7. package/docs/perf.md +94 -0
  8. package/docs/reference.md +1295 -0
  9. package/docs/vs-coffeescript.md +1593 -0
  10. package/docs/vs-iced-coffeescript.md +626 -0
  11. package/docs/vs-typescript.md +107 -0
  12. package/esm.js +8 -0
  13. package/jest.js +33 -0
  14. package/lib/black.js +17 -13
  15. package/lib/browser.js +2 -4
  16. package/lib/cli.js +207 -136
  17. package/lib/compiler.js +1162 -93
  18. package/lib/decision.js +10 -10
  19. package/lib/diagnostics.js +219 -0
  20. package/lib/esm-hooks.js +60 -0
  21. package/lib/fast-parser.js +3469 -0
  22. package/lib/functional-helpers.js +26 -9
  23. package/lib/helpers.js +67 -50
  24. package/lib/js-nodes.js +151 -12
  25. package/lib/lexer.js +1499 -0
  26. package/lib/light-module.js +200 -63
  27. package/lib/mamba.js +372 -0
  28. package/lib/module.js +23 -172
  29. package/lib/nodes.js +84 -21
  30. package/lib/optimiser.js +29 -9
  31. package/lib/optparse.js +32 -15
  32. package/lib/parser.js +9433 -4840
  33. package/lib/preprocessor.js +3 -5
  34. package/lib/register.js +49 -56
  35. package/lib/repl.js +28 -9
  36. package/lib/reporter.js +106 -69
  37. package/lib/run.js +3 -5
  38. package/lib/string-scanner.js +94 -0
  39. package/lib/syntax-tables.js +480 -0
  40. package/lib/type-checker.js +258 -44
  41. package/lib/type-helpers.js +28 -10
  42. package/lib/type-resolver.js +256 -34
  43. package/lib/type-scope.js +10 -6
  44. package/lib/type-walker.js +664 -85
  45. package/lib/types.js +17 -7
  46. package/lib/underscore.js +170 -76
  47. package/lib/unicode-classes.js +122 -0
  48. package/mambaview.js +1 -0
  49. package/package.json +49 -46
  50. package/stdlib.js +1 -0
  51. package/vendor/README.md +40 -0
  52. package/vendor/escodegen/LICENSE.BSD +19 -0
  53. package/vendor/escodegen/escodegen.js +2289 -0
  54. package/vendor/estraverse/LICENSE.BSD +19 -0
  55. package/vendor/estraverse/estraverse.js +706 -0
  56. package/vendor/mambacodegen/LICENSE +24 -0
  57. package/vendor/mambacodegen/lib/mscodegen.js +620 -0
  58. package/vendor/patches/escodegen.diff +130 -0
  59. package/vendor/patches/estraverse.diff +51 -0
  60. package/vendor/patches/pegjs.diff +70 -0
  61. package/vendor/patches/source-map.diff +160 -0
  62. package/vendor/source-map/LICENSE +28 -0
  63. package/vendor/source-map/lib/source-map/array-set.js +92 -0
  64. package/vendor/source-map/lib/source-map/base64-vlq.js +140 -0
  65. package/vendor/source-map/lib/source-map/base64.js +38 -0
  66. package/vendor/source-map/lib/source-map/binary-search.js +77 -0
  67. package/vendor/source-map/lib/source-map/source-map-consumer.js +404 -0
  68. package/vendor/source-map/lib/source-map/source-map-generator.js +229 -0
  69. package/vendor/source-map/lib/source-map/source-node.js +201 -0
  70. package/vendor/source-map/lib/source-map/util.js +57 -0
  71. package/vendor/source-map/lib/source-map.js +8 -0
  72. package/bin/fix +0 -17
  73. package/bin/updateImports +0 -46
  74. package/build.js +0 -25
  75. package/lib/module-esm.js +0 -901
  76. package/lib/pegjs-kofu-plugin.js +0 -35
  77. package/lib/pegjs-mamba-plugin.js +0 -35
  78. package/lib/processor-esm.js +0 -507
  79. package/mamba +0 -259
  80. package/msast.js +0 -1
  81. package/utils/gulp-mamba.js +0 -29
  82. /package/{lib/esm.js → vendor/patches/mambacodegen.diff} +0 -0
@@ -0,0 +1,38 @@
1
+ /* -*- Mode: js; js-indent-level: 2; -*- */
2
+ /*
3
+ * Copyright 2011 Mozilla Foundation and contributors
4
+ * Licensed under the New BSD license. See LICENSE or:
5
+ * http://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ // Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
8
+
9
+ var charToIntMap = {};
10
+ var intToCharMap = {};
11
+
12
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
13
+ .split('')
14
+ .forEach(function (ch, index) {
15
+ charToIntMap[ch] = index;
16
+ intToCharMap[index] = ch;
17
+ });
18
+
19
+ /**
20
+ * Encode an integer in the range of 0 to 63 to a single base 64 digit.
21
+ */
22
+ exports.encode = function base64_encode(aNumber) {
23
+ if (aNumber in intToCharMap) {
24
+ return intToCharMap[aNumber];
25
+ }
26
+ throw new TypeError("Must be between 0 and 63: " + aNumber);
27
+ };
28
+
29
+ /**
30
+ * Decode a single base 64 digit to an integer.
31
+ */
32
+ exports.decode = function base64_decode(aChar) {
33
+ if (aChar in charToIntMap) {
34
+ return charToIntMap[aChar];
35
+ }
36
+ throw new TypeError("Not a valid base 64 digit: " + aChar);
37
+ };
38
+
@@ -0,0 +1,77 @@
1
+ /* -*- Mode: js; js-indent-level: 2; -*- */
2
+ /*
3
+ * Copyright 2011 Mozilla Foundation and contributors
4
+ * Licensed under the New BSD license. See LICENSE or:
5
+ * http://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ // Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
8
+
9
+ /**
10
+ * Recursive implementation of binary search.
11
+ *
12
+ * @param aLow Indices here and lower do not contain the needle.
13
+ * @param aHigh Indices here and higher do not contain the needle.
14
+ * @param aNeedle The element being searched for.
15
+ * @param aHaystack The non-empty array being searched.
16
+ * @param aCompare Function which takes two elements and returns -1, 0, or 1.
17
+ */
18
+ function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {
19
+ // This function terminates when one of the following is true:
20
+ //
21
+ // 1. We find the exact element we are looking for.
22
+ //
23
+ // 2. We did not find the exact element, but we can return the next
24
+ // closest element that is less than that element.
25
+ //
26
+ // 3. We did not find the exact element, and there is no next-closest
27
+ // element which is less than the one we are searching for, so we
28
+ // return null.
29
+ var mid = Math.floor((aHigh - aLow) / 2) + aLow;
30
+ var cmp = aCompare(aNeedle, aHaystack[mid]);
31
+ if (cmp === 0) {
32
+ // Found the element we are looking for.
33
+ return aHaystack[mid];
34
+ }
35
+ else if (cmp > 0) {
36
+ // aHaystack[mid] is greater than our needle.
37
+ if (aHigh - mid > 1) {
38
+ // The element is in the upper half.
39
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare);
40
+ }
41
+ // We did not find an exact match, return the next closest one
42
+ // (termination case 2).
43
+ return aHaystack[mid];
44
+ }
45
+ else {
46
+ // aHaystack[mid] is less than our needle.
47
+ if (mid - aLow > 1) {
48
+ // The element is in the lower half.
49
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare);
50
+ }
51
+ // The exact needle element was not found in this haystack. Determine if
52
+ // we are in termination case (2) or (3) and return the appropriate thing.
53
+ return aLow < 0
54
+ ? null
55
+ : aHaystack[aLow];
56
+ }
57
+ }
58
+
59
+ /**
60
+ * This is an implementation of binary search which will always try and return
61
+ * the next lowest value checked if there is no exact hit. This is because
62
+ * mappings between original and generated line/col pairs are single points,
63
+ * and there is an implicit region between each of them, so a miss just means
64
+ * that you aren't on the very start of a region.
65
+ *
66
+ * @param aNeedle The element you are looking for.
67
+ * @param aHaystack The array that is being searched.
68
+ * @param aCompare A function which takes the needle and an element in the
69
+ * array and returns -1, 0, or 1 depending on whether the needle is less
70
+ * than, equal to, or greater than the element, respectively.
71
+ */
72
+ exports.search = function search(aNeedle, aHaystack, aCompare) {
73
+ return aHaystack.length > 0
74
+ ? recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare)
75
+ : null;
76
+ };
77
+
@@ -0,0 +1,404 @@
1
+ /* -*- Mode: js; js-indent-level: 2; -*- */
2
+ /*
3
+ * Copyright 2011 Mozilla Foundation and contributors
4
+ * Licensed under the New BSD license. See LICENSE or:
5
+ * http://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ // Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
8
+
9
+ var util = require('./util');
10
+ var binarySearch = require('./binary-search');
11
+ var ArraySet = require('./array-set').ArraySet;
12
+ var base64VLQ = require('./base64-vlq');
13
+
14
+ /**
15
+ * A SourceMapConsumer instance represents a parsed source map which we can
16
+ * query for information about the original file positions by giving it a file
17
+ * position in the generated source.
18
+ *
19
+ * The only parameter is the raw source map (either as a JSON string, or
20
+ * already parsed to an object). According to the spec, source maps have the
21
+ * following attributes:
22
+ *
23
+ * - version: Which version of the source map spec this map is following.
24
+ * - sources: An array of URLs to the original source files.
25
+ * - names: An array of identifiers which can be referrenced by individual mappings.
26
+ * - sourceRoot: Optional. The URL root from which all sources are relative.
27
+ * - sourcesContent: Optional. An array of contents of the original source files.
28
+ * - mappings: A string of base64 VLQs which contain the actual mappings.
29
+ * - file: The generated file this source map is associated with.
30
+ *
31
+ * Here is an example source map, taken from the source map spec[0]:
32
+ *
33
+ * {
34
+ * version : 3,
35
+ * file: "out.js",
36
+ * sourceRoot : "",
37
+ * sources: ["foo.js", "bar.js"],
38
+ * names: ["src", "maps", "are", "fun"],
39
+ * mappings: "AA,AB;;ABCDE;"
40
+ * }
41
+ *
42
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
43
+ */
44
+ function SourceMapConsumer(aSourceMap) {
45
+ var sourceMap = aSourceMap;
46
+ if (typeof aSourceMap === 'string') {
47
+ sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
48
+ }
49
+
50
+ var version = util.getArg(sourceMap, 'version');
51
+ var sources = util.getArg(sourceMap, 'sources');
52
+ var names = util.getArg(sourceMap, 'names');
53
+ var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
54
+ var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
55
+ var mappings = util.getArg(sourceMap, 'mappings');
56
+ var file = util.getArg(sourceMap, 'file');
57
+
58
+ if (version !== this._version) {
59
+ throw new Error('Unsupported version: ' + version);
60
+ }
61
+
62
+ this._names = ArraySet.fromArray(names);
63
+ this._sources = ArraySet.fromArray(sources);
64
+ this._sourceRoot = sourceRoot;
65
+ this.sourcesContent = sourcesContent;
66
+ this.file = file;
67
+
68
+ // `this._generatedMappings` and `this._originalMappings` hold the parsed
69
+ // mapping coordinates from the source map's "mappings" attribute. Each
70
+ // object in the array is of the form
71
+ //
72
+ // {
73
+ // generatedLine: The line number in the generated code,
74
+ // generatedColumn: The column number in the generated code,
75
+ // source: The path to the original source file that generated this
76
+ // chunk of code,
77
+ // originalLine: The line number in the original source that
78
+ // corresponds to this chunk of generated code,
79
+ // originalColumn: The column number in the original source that
80
+ // corresponds to this chunk of generated code,
81
+ // name: The name of the original symbol which generated this chunk of
82
+ // code.
83
+ // }
84
+ //
85
+ // All properties except for `generatedLine` and `generatedColumn` can be
86
+ // `null`.
87
+ //
88
+ // `this._generatedMappings` is ordered by the generated positions.
89
+ //
90
+ // `this._originalMappings` is ordered by the original positions.
91
+ this._generatedMappings = [];
92
+ this._originalMappings = [];
93
+ this._parseMappings(mappings, sourceRoot);
94
+ }
95
+
96
+ /**
97
+ * The version of the source mapping spec that we are consuming.
98
+ */
99
+ SourceMapConsumer.prototype._version = 3;
100
+
101
+ /**
102
+ * The list of original sources.
103
+ */
104
+ Object.defineProperty(SourceMapConsumer.prototype, 'sources', {
105
+ get: function () {
106
+ return this._sources.toArray().map(function (s) {
107
+ return this._sourceRoot ? util.join(this._sourceRoot, s) : s;
108
+ }, this);
109
+ }
110
+ });
111
+
112
+ /**
113
+ * Parse the mappings in a string in to a data structure which we can easily
114
+ * query (an ordered list in this._generatedMappings).
115
+ */
116
+ SourceMapConsumer.prototype._parseMappings =
117
+ function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
118
+ var generatedLine = 1;
119
+ var previousGeneratedColumn = 0;
120
+ var previousOriginalLine = 0;
121
+ var previousOriginalColumn = 0;
122
+ var previousSource = 0;
123
+ var previousName = 0;
124
+ var mappingSeparator = /^[,;]/;
125
+ var str = aStr;
126
+ var mapping;
127
+ var temp;
128
+
129
+ while (str.length > 0) {
130
+ if (str.charAt(0) === ';') {
131
+ generatedLine++;
132
+ str = str.slice(1);
133
+ previousGeneratedColumn = 0;
134
+ }
135
+ else if (str.charAt(0) === ',') {
136
+ str = str.slice(1);
137
+ }
138
+ else {
139
+ mapping = {};
140
+ mapping.generatedLine = generatedLine;
141
+
142
+ // Generated column.
143
+ temp = base64VLQ.decode(str);
144
+ mapping.generatedColumn = previousGeneratedColumn + temp.value;
145
+ previousGeneratedColumn = mapping.generatedColumn;
146
+ str = temp.rest;
147
+
148
+ if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
149
+ // Original source.
150
+ temp = base64VLQ.decode(str);
151
+ if (aSourceRoot) {
152
+ mapping.source = util.join(aSourceRoot, this._sources.at(previousSource + temp.value));
153
+ }
154
+ else {
155
+ mapping.source = this._sources.at(previousSource + temp.value);
156
+ }
157
+ previousSource += temp.value;
158
+ str = temp.rest;
159
+ if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
160
+ throw new Error('Found a source, but no line and column');
161
+ }
162
+
163
+ // Original line.
164
+ temp = base64VLQ.decode(str);
165
+ mapping.originalLine = previousOriginalLine + temp.value;
166
+ previousOriginalLine = mapping.originalLine;
167
+ // Lines are stored 0-based
168
+ mapping.originalLine += 1;
169
+ str = temp.rest;
170
+ if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
171
+ throw new Error('Found a source and line, but no column');
172
+ }
173
+
174
+ // Original column.
175
+ temp = base64VLQ.decode(str);
176
+ mapping.originalColumn = previousOriginalColumn + temp.value;
177
+ previousOriginalColumn = mapping.originalColumn;
178
+ str = temp.rest;
179
+
180
+ if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
181
+ // Original name.
182
+ temp = base64VLQ.decode(str);
183
+ mapping.name = this._names.at(previousName + temp.value);
184
+ previousName += temp.value;
185
+ str = temp.rest;
186
+ }
187
+ }
188
+
189
+ this._generatedMappings.push(mapping);
190
+ this._originalMappings.push(mapping);
191
+ }
192
+ }
193
+
194
+ this._originalMappings.sort(this._compareOriginalPositions);
195
+ };
196
+
197
+ /**
198
+ * Comparator between two mappings where the original positions are compared.
199
+ */
200
+ SourceMapConsumer.prototype._compareOriginalPositions =
201
+ function SourceMapConsumer_compareOriginalPositions(mappingA, mappingB) {
202
+ if (mappingA.source > mappingB.source) {
203
+ return 1;
204
+ }
205
+ else if (mappingA.source < mappingB.source) {
206
+ return -1;
207
+ }
208
+ else {
209
+ var cmp = mappingA.originalLine - mappingB.originalLine;
210
+ return cmp === 0
211
+ ? mappingA.originalColumn - mappingB.originalColumn
212
+ : cmp;
213
+ }
214
+ };
215
+
216
+ /**
217
+ * Comparator between two mappings where the generated positions are compared.
218
+ */
219
+ SourceMapConsumer.prototype._compareGeneratedPositions =
220
+ function SourceMapConsumer_compareGeneratedPositions(mappingA, mappingB) {
221
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
222
+ return cmp === 0
223
+ ? mappingA.generatedColumn - mappingB.generatedColumn
224
+ : cmp;
225
+ };
226
+
227
+ /**
228
+ * Find the mapping that best matches the hypothetical "needle" mapping that
229
+ * we are searching for in the given "haystack" of mappings.
230
+ */
231
+ SourceMapConsumer.prototype._findMapping =
232
+ function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
233
+ aColumnName, aComparator) {
234
+ // To return the position we are searching for, we must first find the
235
+ // mapping for the given position and then return the opposite position it
236
+ // points to. Because the mappings are sorted, we can use binary search to
237
+ // find the best mapping.
238
+
239
+ if (aNeedle[aLineName] <= 0) {
240
+ throw new TypeError('Line must be greater than or equal to 1, got '
241
+ + aNeedle[aLineName]);
242
+ }
243
+ if (aNeedle[aColumnName] < 0) {
244
+ throw new TypeError('Column must be greater than or equal to 0, got '
245
+ + aNeedle[aColumnName]);
246
+ }
247
+
248
+ return binarySearch.search(aNeedle, aMappings, aComparator);
249
+ };
250
+
251
+ /**
252
+ * Returns the original source, line, and column information for the generated
253
+ * source's line and column positions provided. The only argument is an object
254
+ * with the following properties:
255
+ *
256
+ * - line: The line number in the generated source.
257
+ * - column: The column number in the generated source.
258
+ *
259
+ * and an object is returned with the following properties:
260
+ *
261
+ * - source: The original source file, or null.
262
+ * - line: The line number in the original source, or null.
263
+ * - column: The column number in the original source, or null.
264
+ * - name: The original identifier, or null.
265
+ */
266
+ SourceMapConsumer.prototype.originalPositionFor =
267
+ function SourceMapConsumer_originalPositionFor(aArgs) {
268
+ var needle = {
269
+ generatedLine: util.getArg(aArgs, 'line'),
270
+ generatedColumn: util.getArg(aArgs, 'column')
271
+ };
272
+
273
+ var mapping = this._findMapping(needle,
274
+ this._generatedMappings,
275
+ "generatedLine",
276
+ "generatedColumn",
277
+ this._compareGeneratedPositions)
278
+
279
+ if (mapping) {
280
+ return {
281
+ source: util.getArg(mapping, 'source', null),
282
+ line: util.getArg(mapping, 'originalLine', null),
283
+ column: util.getArg(mapping, 'originalColumn', null),
284
+ name: util.getArg(mapping, 'name', null)
285
+ };
286
+ }
287
+
288
+ return {
289
+ source: null,
290
+ line: null,
291
+ column: null,
292
+ name: null
293
+ };
294
+ };
295
+
296
+ /**
297
+ * Returns the original source content. The only argument is
298
+ * the url of the original source file. Returns null if no
299
+ * original source content is availible.
300
+ */
301
+ SourceMapConsumer.prototype.sourceContentFor =
302
+ function SourceMapConsumer_sourceContentFor(aSource) {
303
+ if(!this.sourcesContent) {
304
+ return null;
305
+ }
306
+
307
+ if(this._sourceRoot) {
308
+ // Try to remove the sourceRoot
309
+ var relativeUrl = util.relative(this._sourceRoot, aSource);
310
+ if(relativeUrl !== aSource && this._sources.has(relativeUrl)) {
311
+ return this.sourcesContent[this._sources.indexOf(relativeUrl)];
312
+ }
313
+ }
314
+
315
+ if(this._sources.has(aSource)) {
316
+ return this.sourcesContent[this._sources.indexOf(aSource)];
317
+ }
318
+
319
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
320
+ };
321
+
322
+ /**
323
+ * Returns the generated line and column information for the original source,
324
+ * line, and column positions provided. The only argument is an object with
325
+ * the following properties:
326
+ *
327
+ * - source: The filename of the original source.
328
+ * - line: The line number in the original source.
329
+ * - column: The column number in the original source.
330
+ *
331
+ * and an object is returned with the following properties:
332
+ *
333
+ * - line: The line number in the generated source, or null.
334
+ * - column: The column number in the generated source, or null.
335
+ */
336
+ SourceMapConsumer.prototype.generatedPositionFor =
337
+ function SourceMapConsumer_generatedPositionFor(aArgs) {
338
+ var needle = {
339
+ source: util.getArg(aArgs, 'source'),
340
+ originalLine: util.getArg(aArgs, 'line'),
341
+ originalColumn: util.getArg(aArgs, 'column')
342
+ };
343
+
344
+ var mapping = this._findMapping(needle,
345
+ this._originalMappings,
346
+ "originalLine",
347
+ "originalColumn",
348
+ this._compareOriginalPositions)
349
+
350
+ if (mapping) {
351
+ return {
352
+ line: util.getArg(mapping, 'generatedLine', null),
353
+ column: util.getArg(mapping, 'generatedColumn', null)
354
+ };
355
+ }
356
+
357
+ return {
358
+ line: null,
359
+ column: null
360
+ };
361
+ };
362
+
363
+ SourceMapConsumer.GENERATED_ORDER = 1;
364
+ SourceMapConsumer.ORIGINAL_ORDER = 2;
365
+
366
+ /**
367
+ * Iterate over each mapping between an original source/line/column and a
368
+ * generated line/column in this source map.
369
+ *
370
+ * @param Function aCallback
371
+ * The function that is called with each mapping. This function should
372
+ * not mutate the mapping.
373
+ * @param Object aContext
374
+ * Optional. If specified, this object will be the value of `this` every
375
+ * time that `aCallback` is called.
376
+ * @param aOrder
377
+ * Either `SourceMapConsumer.GENERATED_ORDER` or
378
+ * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
379
+ * iterate over the mappings sorted by the generated file's line/column
380
+ * order or the original's source/line/column order, respectively. Defaults to
381
+ * `SourceMapConsumer.GENERATED_ORDER`.
382
+ */
383
+ SourceMapConsumer.prototype.eachMapping =
384
+ function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
385
+ var context = aContext || null;
386
+ var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
387
+
388
+ var mappings;
389
+ switch (order) {
390
+ case SourceMapConsumer.GENERATED_ORDER:
391
+ mappings = this._generatedMappings;
392
+ break;
393
+ case SourceMapConsumer.ORIGINAL_ORDER:
394
+ mappings = this._originalMappings;
395
+ break;
396
+ default:
397
+ throw new Error("Unknown order of iteration.");
398
+ }
399
+
400
+ mappings.forEach(aCallback, context);
401
+ };
402
+
403
+ exports.SourceMapConsumer = SourceMapConsumer;
404
+