react 0.13.0-beta.2 → 0.13.1

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * JSXTransformer v0.13.0-beta.2
2
+ * JSXTransformer v0.13.1
3
3
  */
4
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSXTransformer=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
4
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
5
5
  /**
6
6
  * Copyright 2013-2015, Facebook, Inc.
7
7
  * All rights reserved.
@@ -12,13 +12,13 @@
12
12
  */
13
13
  /* jshint browser: true */
14
14
  /* jslint evil: true */
15
+ /*eslint-disable no-eval */
16
+ /*eslint-disable block-scoped-var */
15
17
 
16
18
  'use strict';
17
19
 
18
- var buffer = _dereq_('buffer');
19
- var transform = _dereq_('jstransform').transform;
20
- var typesSyntax = _dereq_('jstransform/visitors/type-syntax');
21
- var visitors = _dereq_('./fbtransform/visitors');
20
+ var ReactTools = _dereq_('../main');
21
+ var inlineSourceMap = _dereq_('./inline-source-map');
22
22
 
23
23
  var headEl;
24
24
  var dummyAnchor;
@@ -38,26 +38,18 @@ var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
38
38
  * @return {object} object as returned from jstransform
39
39
  */
40
40
  function transformReact(source, options) {
41
- // TODO: just use react-tools
42
41
  options = options || {};
43
- var visitorList;
44
- if (options.harmony) {
45
- visitorList = visitors.getAllVisitors();
46
- } else {
47
- visitorList = visitors.transformVisitors.react;
48
- }
49
42
 
50
- if (options.stripTypes) {
51
- // Stripping types needs to happen before the other transforms
52
- // unfortunately, due to bad interactions. For example,
53
- // es6-rest-param-visitors conflict with stripping rest param type
54
- // annotation
55
- source = transform(typesSyntax.visitorList, source, options).code;
43
+ // Force the sourcemaps option manually. We don't want to use it if it will
44
+ // break (see above note about supportsAccessors). We'll only override the
45
+ // value here if sourceMap was specified and is truthy. This guarantees that
46
+ // we won't override any user intent (since this method is exposed publicly).
47
+ if (options.sourceMap) {
48
+ options.sourceMap = supportsAccessors;
56
49
  }
57
50
 
58
- return transform(visitorList, source, {
59
- sourceMap: supportsAccessors && options.sourceMap
60
- });
51
+ // Otherwise just pass all options straight through to react-tools.
52
+ return ReactTools.transformWithDetails(source, options);
61
53
  }
62
54
 
63
55
  /**
@@ -153,10 +145,9 @@ function transformCode(code, url, options) {
153
145
  return transformed.code;
154
146
  }
155
147
 
156
- var map = transformed.sourceMap.toJSON();
157
148
  var source;
158
149
  if (url == null) {
159
- source = "Inline JSX script";
150
+ source = 'Inline JSX script';
160
151
  inlineScriptCount++;
161
152
  if (inlineScriptCount > 1) {
162
153
  source += ' (' + inlineScriptCount + ')';
@@ -169,13 +160,11 @@ function transformCode(code, url, options) {
169
160
  dummyAnchor.href = url;
170
161
  source = dummyAnchor.pathname.substr(1);
171
162
  }
172
- map.sources = [source];
173
- map.sourcesContent = [code];
174
163
 
175
164
  return (
176
165
  transformed.code +
177
- '\n//# sourceMappingURL=data:application/json;base64,' +
178
- buffer.Buffer(JSON.stringify(map)).toString('base64')
166
+ '\n' +
167
+ inlineSourceMap(transformed.sourceMap, code, source)
179
168
  );
180
169
  }
181
170
 
@@ -219,7 +208,7 @@ function load(url, successCallback, errorCallback) {
219
208
  successCallback(xhr.responseText);
220
209
  } else {
221
210
  errorCallback();
222
- throw new Error("Could not load " + url);
211
+ throw new Error('Could not load ' + url);
223
212
  }
224
213
  }
225
214
  };
@@ -333,7 +322,7 @@ function runScripts() {
333
322
 
334
323
  // Listen for load event if we're in a browser and then kick off finding and
335
324
  // running of scripts.
336
- if (typeof window !== "undefined" && window !== null) {
325
+ if (typeof window !== 'undefined' && window !== null) {
337
326
  headEl = document.getElementsByTagName('head')[0];
338
327
  dummyAnchor = document.createElement('a');
339
328
 
@@ -349,7 +338,104 @@ module.exports = {
349
338
  exec: exec
350
339
  };
351
340
 
352
- },{"./fbtransform/visitors":37,"buffer":2,"jstransform":21,"jstransform/visitors/type-syntax":33}],2:[function(_dereq_,module,exports){
341
+ },{"../main":2,"./inline-source-map":41}],2:[function(_dereq_,module,exports){
342
+ /**
343
+ * Copyright 2013-2015, Facebook, Inc.
344
+ * All rights reserved.
345
+ *
346
+ * This source code is licensed under the BSD-style license found in the
347
+ * LICENSE file in the root directory of this source tree. An additional grant
348
+ * of patent rights can be found in the PATENTS file in the same directory.
349
+ */
350
+
351
+ 'use strict';
352
+ /*eslint-disable no-undef*/
353
+ var visitors = _dereq_('./vendor/fbtransform/visitors');
354
+ var transform = _dereq_('jstransform').transform;
355
+ var typesSyntax = _dereq_('jstransform/visitors/type-syntax');
356
+ var inlineSourceMap = _dereq_('./vendor/inline-source-map');
357
+
358
+ module.exports = {
359
+ transform: function(input, options) {
360
+ options = processOptions(options);
361
+ var output = innerTransform(input, options);
362
+ var result = output.code;
363
+ if (options.sourceMap) {
364
+ var map = inlineSourceMap(
365
+ output.sourceMap,
366
+ input,
367
+ options.filename
368
+ );
369
+ result += '\n' + map;
370
+ }
371
+ return result;
372
+ },
373
+ transformWithDetails: function(input, options) {
374
+ options = processOptions(options);
375
+ var output = innerTransform(input, options);
376
+ var result = {};
377
+ result.code = output.code;
378
+ if (options.sourceMap) {
379
+ result.sourceMap = output.sourceMap.toJSON();
380
+ }
381
+ if (options.filename) {
382
+ result.sourceMap.sources = [options.filename];
383
+ }
384
+ return result;
385
+ }
386
+ };
387
+
388
+ /**
389
+ * Only copy the values that we need. We'll do some preprocessing to account for
390
+ * converting command line flags to options that jstransform can actually use.
391
+ */
392
+ function processOptions(opts) {
393
+ opts = opts || {};
394
+ var options = {};
395
+
396
+ options.harmony = opts.harmony;
397
+ options.stripTypes = opts.stripTypes;
398
+ options.sourceMap = opts.sourceMap;
399
+ options.filename = opts.sourceFilename;
400
+
401
+ if (opts.es6module) {
402
+ options.sourceType = 'module';
403
+ }
404
+ if (opts.nonStrictEs6module) {
405
+ options.sourceType = 'nonStrictModule';
406
+ }
407
+
408
+ // Instead of doing any fancy validation, only look for 'es3'. If we have
409
+ // that, then use it. Otherwise use 'es5'.
410
+ options.es3 = opts.target === 'es3';
411
+ options.es5 = !options.es3;
412
+
413
+ return options;
414
+ }
415
+
416
+ function innerTransform(input, options) {
417
+ var visitorSets = ['react'];
418
+ if (options.harmony) {
419
+ visitorSets.push('harmony');
420
+ }
421
+
422
+ if (options.es3) {
423
+ visitorSets.push('es3');
424
+ }
425
+
426
+ if (options.stripTypes) {
427
+ // Stripping types needs to happen before the other transforms
428
+ // unfortunately, due to bad interactions. For example,
429
+ // es6-rest-param-visitors conflict with stripping rest param type
430
+ // annotation
431
+ input = transform(typesSyntax.visitorList, input, options).code;
432
+ }
433
+
434
+ var visitorList = visitors.getVisitorsBySet(visitorSets);
435
+ return transform(visitorList, input, options);
436
+ }
437
+
438
+ },{"./vendor/fbtransform/visitors":40,"./vendor/inline-source-map":41,"jstransform":22,"jstransform/visitors/type-syntax":36}],3:[function(_dereq_,module,exports){
353
439
  /*!
354
440
  * The buffer module from node.js, for the browser.
355
441
  *
@@ -396,7 +482,7 @@ Buffer.TYPED_ARRAY_SUPPORT = (function () {
396
482
  var buf = new ArrayBuffer(0)
397
483
  var arr = new Uint8Array(buf)
398
484
  arr.foo = function () { return 42 }
399
- return 42 === arr.foo() && // typed array instances can be augmented
485
+ return arr.foo() === 42 && // typed array instances can be augmented
400
486
  typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
401
487
  new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
402
488
  } catch (e) {
@@ -417,82 +503,89 @@ Buffer.TYPED_ARRAY_SUPPORT = (function () {
417
503
  * prototype.
418
504
  */
419
505
  function Buffer (subject, encoding, noZero) {
420
- if (!(this instanceof Buffer))
421
- return new Buffer(subject, encoding, noZero)
506
+ if (!(this instanceof Buffer)) return new Buffer(subject, encoding, noZero)
422
507
 
423
508
  var type = typeof subject
424
-
425
- // Find the length
426
509
  var length
427
- if (type === 'number')
428
- length = subject > 0 ? subject >>> 0 : 0
429
- else if (type === 'string') {
510
+
511
+ if (type === 'number') {
512
+ length = +subject
513
+ } else if (type === 'string') {
430
514
  length = Buffer.byteLength(subject, encoding)
431
- } else if (type === 'object' && subject !== null) { // assume object is array-like
432
- if (subject.type === 'Buffer' && isArray(subject.data))
433
- subject = subject.data
434
- length = +subject.length > 0 ? Math.floor(+subject.length) : 0
435
- } else
515
+ } else if (type === 'object' && subject !== null) {
516
+ // assume object is array-like
517
+ if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data
518
+ length = +subject.length
519
+ } else {
436
520
  throw new TypeError('must start with number, buffer, array or string')
521
+ }
522
+
523
+ if (length > kMaxLength) {
524
+ throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +
525
+ kMaxLength.toString(16) + ' bytes')
526
+ }
437
527
 
438
- if (length > kMaxLength)
439
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
440
- 'size: 0x' + kMaxLength.toString(16) + ' bytes')
528
+ if (length < 0) length = 0
529
+ else length >>>= 0 // coerce to uint32
441
530
 
442
- var buf
531
+ var self = this
443
532
  if (Buffer.TYPED_ARRAY_SUPPORT) {
444
533
  // Preferred: Return an augmented `Uint8Array` instance for best performance
445
- buf = Buffer._augment(new Uint8Array(length))
534
+ /*eslint-disable consistent-this */
535
+ self = Buffer._augment(new Uint8Array(length))
536
+ /*eslint-enable consistent-this */
446
537
  } else {
447
538
  // Fallback: Return THIS instance of Buffer (created by `new`)
448
- buf = this
449
- buf.length = length
450
- buf._isBuffer = true
539
+ self.length = length
540
+ self._isBuffer = true
451
541
  }
452
542
 
453
543
  var i
454
544
  if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {
455
545
  // Speed optimization -- use set if we're copying from a typed array
456
- buf._set(subject)
546
+ self._set(subject)
457
547
  } else if (isArrayish(subject)) {
458
548
  // Treat array-ish objects as a byte array
459
549
  if (Buffer.isBuffer(subject)) {
460
- for (i = 0; i < length; i++)
461
- buf[i] = subject.readUInt8(i)
550
+ for (i = 0; i < length; i++) {
551
+ self[i] = subject.readUInt8(i)
552
+ }
462
553
  } else {
463
- for (i = 0; i < length; i++)
464
- buf[i] = ((subject[i] % 256) + 256) % 256
554
+ for (i = 0; i < length; i++) {
555
+ self[i] = ((subject[i] % 256) + 256) % 256
556
+ }
465
557
  }
466
558
  } else if (type === 'string') {
467
- buf.write(subject, 0, encoding)
559
+ self.write(subject, 0, encoding)
468
560
  } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT && !noZero) {
469
561
  for (i = 0; i < length; i++) {
470
- buf[i] = 0
562
+ self[i] = 0
471
563
  }
472
564
  }
473
565
 
474
- if (length > 0 && length <= Buffer.poolSize)
475
- buf.parent = rootParent
566
+ if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent
476
567
 
477
- return buf
568
+ return self
478
569
  }
479
570
 
480
- function SlowBuffer(subject, encoding, noZero) {
481
- if (!(this instanceof SlowBuffer))
482
- return new SlowBuffer(subject, encoding, noZero)
571
+ function SlowBuffer (subject, encoding, noZero) {
572
+ if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding, noZero)
483
573
 
484
574
  var buf = new Buffer(subject, encoding, noZero)
485
575
  delete buf.parent
486
576
  return buf
487
577
  }
488
578
 
489
- Buffer.isBuffer = function (b) {
579
+ Buffer.isBuffer = function isBuffer (b) {
490
580
  return !!(b != null && b._isBuffer)
491
581
  }
492
582
 
493
- Buffer.compare = function (a, b) {
494
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b))
583
+ Buffer.compare = function compare (a, b) {
584
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
495
585
  throw new TypeError('Arguments must be Buffers')
586
+ }
587
+
588
+ if (a === b) return 0
496
589
 
497
590
  var x = a.length
498
591
  var y = b.length
@@ -506,7 +599,7 @@ Buffer.compare = function (a, b) {
506
599
  return 0
507
600
  }
508
601
 
509
- Buffer.isEncoding = function (encoding) {
602
+ Buffer.isEncoding = function isEncoding (encoding) {
510
603
  switch (String(encoding).toLowerCase()) {
511
604
  case 'hex':
512
605
  case 'utf8':
@@ -525,7 +618,7 @@ Buffer.isEncoding = function (encoding) {
525
618
  }
526
619
  }
527
620
 
528
- Buffer.concat = function (list, totalLength) {
621
+ Buffer.concat = function concat (list, totalLength) {
529
622
  if (!isArray(list)) throw new TypeError('Usage: Buffer.concat(list[, length])')
530
623
 
531
624
  if (list.length === 0) {
@@ -552,7 +645,7 @@ Buffer.concat = function (list, totalLength) {
552
645
  return buf
553
646
  }
554
647
 
555
- Buffer.byteLength = function (str, encoding) {
648
+ Buffer.byteLength = function byteLength (str, encoding) {
556
649
  var ret
557
650
  str = str + ''
558
651
  switch (encoding || 'utf8') {
@@ -588,7 +681,7 @@ Buffer.prototype.length = undefined
588
681
  Buffer.prototype.parent = undefined
589
682
 
590
683
  // toString(encoding, start=0, end=buffer.length)
591
- Buffer.prototype.toString = function (encoding, start, end) {
684
+ Buffer.prototype.toString = function toString (encoding, start, end) {
592
685
  var loweredCase = false
593
686
 
594
687
  start = start >>> 0
@@ -624,43 +717,84 @@ Buffer.prototype.toString = function (encoding, start, end) {
624
717
  return utf16leSlice(this, start, end)
625
718
 
626
719
  default:
627
- if (loweredCase)
628
- throw new TypeError('Unknown encoding: ' + encoding)
720
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
629
721
  encoding = (encoding + '').toLowerCase()
630
722
  loweredCase = true
631
723
  }
632
724
  }
633
725
  }
634
726
 
635
- Buffer.prototype.equals = function (b) {
727
+ Buffer.prototype.equals = function equals (b) {
636
728
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
729
+ if (this === b) return true
637
730
  return Buffer.compare(this, b) === 0
638
731
  }
639
732
 
640
- Buffer.prototype.inspect = function () {
733
+ Buffer.prototype.inspect = function inspect () {
641
734
  var str = ''
642
735
  var max = exports.INSPECT_MAX_BYTES
643
736
  if (this.length > 0) {
644
737
  str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
645
- if (this.length > max)
646
- str += ' ... '
738
+ if (this.length > max) str += ' ... '
647
739
  }
648
740
  return '<Buffer ' + str + '>'
649
741
  }
650
742
 
651
- Buffer.prototype.compare = function (b) {
743
+ Buffer.prototype.compare = function compare (b) {
652
744
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
745
+ if (this === b) return 0
653
746
  return Buffer.compare(this, b)
654
747
  }
655
748
 
749
+ Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
750
+ if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
751
+ else if (byteOffset < -0x80000000) byteOffset = -0x80000000
752
+ byteOffset >>= 0
753
+
754
+ if (this.length === 0) return -1
755
+ if (byteOffset >= this.length) return -1
756
+
757
+ // Negative offsets start from the end of the buffer
758
+ if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
759
+
760
+ if (typeof val === 'string') {
761
+ if (val.length === 0) return -1 // special case: looking for empty string always fails
762
+ return String.prototype.indexOf.call(this, val, byteOffset)
763
+ }
764
+ if (Buffer.isBuffer(val)) {
765
+ return arrayIndexOf(this, val, byteOffset)
766
+ }
767
+ if (typeof val === 'number') {
768
+ if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
769
+ return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
770
+ }
771
+ return arrayIndexOf(this, [ val ], byteOffset)
772
+ }
773
+
774
+ function arrayIndexOf (arr, val, byteOffset) {
775
+ var foundIndex = -1
776
+ for (var i = 0; byteOffset + i < arr.length; i++) {
777
+ if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
778
+ if (foundIndex === -1) foundIndex = i
779
+ if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
780
+ } else {
781
+ foundIndex = -1
782
+ }
783
+ }
784
+ return -1
785
+ }
786
+
787
+ throw new TypeError('val must be string, number or Buffer')
788
+ }
789
+
656
790
  // `get` will be removed in Node 0.13+
657
- Buffer.prototype.get = function (offset) {
791
+ Buffer.prototype.get = function get (offset) {
658
792
  console.log('.get() is deprecated. Access using array indexes instead.')
659
793
  return this.readUInt8(offset)
660
794
  }
661
795
 
662
796
  // `set` will be removed in Node 0.13+
663
- Buffer.prototype.set = function (v, offset) {
797
+ Buffer.prototype.set = function set (v, offset) {
664
798
  console.log('.set() is deprecated. Access using array indexes instead.')
665
799
  return this.writeUInt8(v, offset)
666
800
  }
@@ -685,9 +819,9 @@ function hexWrite (buf, string, offset, length) {
685
819
  length = strLen / 2
686
820
  }
687
821
  for (var i = 0; i < length; i++) {
688
- var byte = parseInt(string.substr(i * 2, 2), 16)
689
- if (isNaN(byte)) throw new Error('Invalid hex string')
690
- buf[offset + i] = byte
822
+ var parsed = parseInt(string.substr(i * 2, 2), 16)
823
+ if (isNaN(parsed)) throw new Error('Invalid hex string')
824
+ buf[offset + i] = parsed
691
825
  }
692
826
  return i
693
827
  }
@@ -712,11 +846,11 @@ function base64Write (buf, string, offset, length) {
712
846
  }
713
847
 
714
848
  function utf16leWrite (buf, string, offset, length) {
715
- var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length, 2)
849
+ var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
716
850
  return charsWritten
717
851
  }
718
852
 
719
- Buffer.prototype.write = function (string, offset, length, encoding) {
853
+ Buffer.prototype.write = function write (string, offset, length, encoding) {
720
854
  // Support both (string, offset, length, encoding)
721
855
  // and the legacy (string, encoding, offset, length)
722
856
  if (isFinite(offset)) {
@@ -733,8 +867,9 @@ Buffer.prototype.write = function (string, offset, length, encoding) {
733
867
 
734
868
  offset = Number(offset) || 0
735
869
 
736
- if (length < 0 || offset < 0 || offset > this.length)
737
- throw new RangeError('attempt to write outside buffer bounds');
870
+ if (length < 0 || offset < 0 || offset > this.length) {
871
+ throw new RangeError('attempt to write outside buffer bounds')
872
+ }
738
873
 
739
874
  var remaining = this.length - offset
740
875
  if (!length) {
@@ -777,7 +912,7 @@ Buffer.prototype.write = function (string, offset, length, encoding) {
777
912
  return ret
778
913
  }
779
914
 
780
- Buffer.prototype.toJSON = function () {
915
+ Buffer.prototype.toJSON = function toJSON () {
781
916
  return {
782
917
  type: 'Buffer',
783
918
  data: Array.prototype.slice.call(this._arr || this, 0)
@@ -851,29 +986,26 @@ function utf16leSlice (buf, start, end) {
851
986
  return res
852
987
  }
853
988
 
854
- Buffer.prototype.slice = function (start, end) {
989
+ Buffer.prototype.slice = function slice (start, end) {
855
990
  var len = this.length
856
991
  start = ~~start
857
992
  end = end === undefined ? len : ~~end
858
993
 
859
994
  if (start < 0) {
860
- start += len;
861
- if (start < 0)
862
- start = 0
995
+ start += len
996
+ if (start < 0) start = 0
863
997
  } else if (start > len) {
864
998
  start = len
865
999
  }
866
1000
 
867
1001
  if (end < 0) {
868
1002
  end += len
869
- if (end < 0)
870
- end = 0
1003
+ if (end < 0) end = 0
871
1004
  } else if (end > len) {
872
1005
  end = len
873
1006
  }
874
1007
 
875
- if (end < start)
876
- end = start
1008
+ if (end < start) end = start
877
1009
 
878
1010
  var newBuf
879
1011
  if (Buffer.TYPED_ARRAY_SUPPORT) {
@@ -886,8 +1018,7 @@ Buffer.prototype.slice = function (start, end) {
886
1018
  }
887
1019
  }
888
1020
 
889
- if (newBuf.length)
890
- newBuf.parent = this.parent || this
1021
+ if (newBuf.length) newBuf.parent = this.parent || this
891
1022
 
892
1023
  return newBuf
893
1024
  }
@@ -896,62 +1027,58 @@ Buffer.prototype.slice = function (start, end) {
896
1027
  * Need to make sure that buffer isn't trying to write out of bounds.
897
1028
  */
898
1029
  function checkOffset (offset, ext, length) {
899
- if ((offset % 1) !== 0 || offset < 0)
900
- throw new RangeError('offset is not uint')
901
- if (offset + ext > length)
902
- throw new RangeError('Trying to access beyond buffer length')
1030
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1031
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
903
1032
  }
904
1033
 
905
- Buffer.prototype.readUIntLE = function (offset, byteLength, noAssert) {
1034
+ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
906
1035
  offset = offset >>> 0
907
1036
  byteLength = byteLength >>> 0
908
- if (!noAssert)
909
- checkOffset(offset, byteLength, this.length)
1037
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
910
1038
 
911
1039
  var val = this[offset]
912
1040
  var mul = 1
913
1041
  var i = 0
914
- while (++i < byteLength && (mul *= 0x100))
1042
+ while (++i < byteLength && (mul *= 0x100)) {
915
1043
  val += this[offset + i] * mul
1044
+ }
916
1045
 
917
1046
  return val
918
1047
  }
919
1048
 
920
- Buffer.prototype.readUIntBE = function (offset, byteLength, noAssert) {
1049
+ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
921
1050
  offset = offset >>> 0
922
1051
  byteLength = byteLength >>> 0
923
- if (!noAssert)
1052
+ if (!noAssert) {
924
1053
  checkOffset(offset, byteLength, this.length)
1054
+ }
925
1055
 
926
1056
  var val = this[offset + --byteLength]
927
1057
  var mul = 1
928
- while (byteLength > 0 && (mul *= 0x100))
929
- val += this[offset + --byteLength] * mul;
1058
+ while (byteLength > 0 && (mul *= 0x100)) {
1059
+ val += this[offset + --byteLength] * mul
1060
+ }
930
1061
 
931
1062
  return val
932
1063
  }
933
1064
 
934
- Buffer.prototype.readUInt8 = function (offset, noAssert) {
935
- if (!noAssert)
936
- checkOffset(offset, 1, this.length)
1065
+ Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1066
+ if (!noAssert) checkOffset(offset, 1, this.length)
937
1067
  return this[offset]
938
1068
  }
939
1069
 
940
- Buffer.prototype.readUInt16LE = function (offset, noAssert) {
941
- if (!noAssert)
942
- checkOffset(offset, 2, this.length)
1070
+ Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1071
+ if (!noAssert) checkOffset(offset, 2, this.length)
943
1072
  return this[offset] | (this[offset + 1] << 8)
944
1073
  }
945
1074
 
946
- Buffer.prototype.readUInt16BE = function (offset, noAssert) {
947
- if (!noAssert)
948
- checkOffset(offset, 2, this.length)
1075
+ Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1076
+ if (!noAssert) checkOffset(offset, 2, this.length)
949
1077
  return (this[offset] << 8) | this[offset + 1]
950
1078
  }
951
1079
 
952
- Buffer.prototype.readUInt32LE = function (offset, noAssert) {
953
- if (!noAssert)
954
- checkOffset(offset, 4, this.length)
1080
+ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1081
+ if (!noAssert) checkOffset(offset, 4, this.length)
955
1082
 
956
1083
  return ((this[offset]) |
957
1084
  (this[offset + 1] << 8) |
@@ -959,117 +1086,104 @@ Buffer.prototype.readUInt32LE = function (offset, noAssert) {
959
1086
  (this[offset + 3] * 0x1000000)
960
1087
  }
961
1088
 
962
- Buffer.prototype.readUInt32BE = function (offset, noAssert) {
963
- if (!noAssert)
964
- checkOffset(offset, 4, this.length)
1089
+ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1090
+ if (!noAssert) checkOffset(offset, 4, this.length)
965
1091
 
966
1092
  return (this[offset] * 0x1000000) +
967
- ((this[offset + 1] << 16) |
968
- (this[offset + 2] << 8) |
969
- this[offset + 3])
1093
+ ((this[offset + 1] << 16) |
1094
+ (this[offset + 2] << 8) |
1095
+ this[offset + 3])
970
1096
  }
971
1097
 
972
- Buffer.prototype.readIntLE = function (offset, byteLength, noAssert) {
1098
+ Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
973
1099
  offset = offset >>> 0
974
1100
  byteLength = byteLength >>> 0
975
- if (!noAssert)
976
- checkOffset(offset, byteLength, this.length)
1101
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
977
1102
 
978
1103
  var val = this[offset]
979
1104
  var mul = 1
980
1105
  var i = 0
981
- while (++i < byteLength && (mul *= 0x100))
1106
+ while (++i < byteLength && (mul *= 0x100)) {
982
1107
  val += this[offset + i] * mul
1108
+ }
983
1109
  mul *= 0x80
984
1110
 
985
- if (val >= mul)
986
- val -= Math.pow(2, 8 * byteLength)
1111
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
987
1112
 
988
1113
  return val
989
1114
  }
990
1115
 
991
- Buffer.prototype.readIntBE = function (offset, byteLength, noAssert) {
1116
+ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
992
1117
  offset = offset >>> 0
993
1118
  byteLength = byteLength >>> 0
994
- if (!noAssert)
995
- checkOffset(offset, byteLength, this.length)
1119
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
996
1120
 
997
1121
  var i = byteLength
998
1122
  var mul = 1
999
1123
  var val = this[offset + --i]
1000
- while (i > 0 && (mul *= 0x100))
1124
+ while (i > 0 && (mul *= 0x100)) {
1001
1125
  val += this[offset + --i] * mul
1126
+ }
1002
1127
  mul *= 0x80
1003
1128
 
1004
- if (val >= mul)
1005
- val -= Math.pow(2, 8 * byteLength)
1129
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1006
1130
 
1007
1131
  return val
1008
1132
  }
1009
1133
 
1010
- Buffer.prototype.readInt8 = function (offset, noAssert) {
1011
- if (!noAssert)
1012
- checkOffset(offset, 1, this.length)
1013
- if (!(this[offset] & 0x80))
1014
- return (this[offset])
1134
+ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1135
+ if (!noAssert) checkOffset(offset, 1, this.length)
1136
+ if (!(this[offset] & 0x80)) return (this[offset])
1015
1137
  return ((0xff - this[offset] + 1) * -1)
1016
1138
  }
1017
1139
 
1018
- Buffer.prototype.readInt16LE = function (offset, noAssert) {
1019
- if (!noAssert)
1020
- checkOffset(offset, 2, this.length)
1140
+ Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1141
+ if (!noAssert) checkOffset(offset, 2, this.length)
1021
1142
  var val = this[offset] | (this[offset + 1] << 8)
1022
1143
  return (val & 0x8000) ? val | 0xFFFF0000 : val
1023
1144
  }
1024
1145
 
1025
- Buffer.prototype.readInt16BE = function (offset, noAssert) {
1026
- if (!noAssert)
1027
- checkOffset(offset, 2, this.length)
1146
+ Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1147
+ if (!noAssert) checkOffset(offset, 2, this.length)
1028
1148
  var val = this[offset + 1] | (this[offset] << 8)
1029
1149
  return (val & 0x8000) ? val | 0xFFFF0000 : val
1030
1150
  }
1031
1151
 
1032
- Buffer.prototype.readInt32LE = function (offset, noAssert) {
1033
- if (!noAssert)
1034
- checkOffset(offset, 4, this.length)
1152
+ Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1153
+ if (!noAssert) checkOffset(offset, 4, this.length)
1035
1154
 
1036
1155
  return (this[offset]) |
1037
- (this[offset + 1] << 8) |
1038
- (this[offset + 2] << 16) |
1039
- (this[offset + 3] << 24)
1156
+ (this[offset + 1] << 8) |
1157
+ (this[offset + 2] << 16) |
1158
+ (this[offset + 3] << 24)
1040
1159
  }
1041
1160
 
1042
- Buffer.prototype.readInt32BE = function (offset, noAssert) {
1043
- if (!noAssert)
1044
- checkOffset(offset, 4, this.length)
1161
+ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1162
+ if (!noAssert) checkOffset(offset, 4, this.length)
1045
1163
 
1046
1164
  return (this[offset] << 24) |
1047
- (this[offset + 1] << 16) |
1048
- (this[offset + 2] << 8) |
1049
- (this[offset + 3])
1165
+ (this[offset + 1] << 16) |
1166
+ (this[offset + 2] << 8) |
1167
+ (this[offset + 3])
1050
1168
  }
1051
1169
 
1052
- Buffer.prototype.readFloatLE = function (offset, noAssert) {
1053
- if (!noAssert)
1054
- checkOffset(offset, 4, this.length)
1170
+ Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1171
+ if (!noAssert) checkOffset(offset, 4, this.length)
1055
1172
  return ieee754.read(this, offset, true, 23, 4)
1056
1173
  }
1057
1174
 
1058
- Buffer.prototype.readFloatBE = function (offset, noAssert) {
1059
- if (!noAssert)
1060
- checkOffset(offset, 4, this.length)
1175
+ Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1176
+ if (!noAssert) checkOffset(offset, 4, this.length)
1061
1177
  return ieee754.read(this, offset, false, 23, 4)
1062
1178
  }
1063
1179
 
1064
- Buffer.prototype.readDoubleLE = function (offset, noAssert) {
1065
- if (!noAssert)
1066
- checkOffset(offset, 8, this.length)
1180
+ Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1181
+ if (!noAssert) checkOffset(offset, 8, this.length)
1067
1182
  return ieee754.read(this, offset, true, 52, 8)
1068
1183
  }
1069
1184
 
1070
- Buffer.prototype.readDoubleBE = function (offset, noAssert) {
1071
- if (!noAssert)
1072
- checkOffset(offset, 8, this.length)
1185
+ Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1186
+ if (!noAssert) checkOffset(offset, 8, this.length)
1073
1187
  return ieee754.read(this, offset, false, 52, 8)
1074
1188
  }
1075
1189
 
@@ -1079,43 +1193,42 @@ function checkInt (buf, value, offset, ext, max, min) {
1079
1193
  if (offset + ext > buf.length) throw new RangeError('index out of range')
1080
1194
  }
1081
1195
 
1082
- Buffer.prototype.writeUIntLE = function (value, offset, byteLength, noAssert) {
1196
+ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1083
1197
  value = +value
1084
1198
  offset = offset >>> 0
1085
1199
  byteLength = byteLength >>> 0
1086
- if (!noAssert)
1087
- checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
1200
+ if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
1088
1201
 
1089
1202
  var mul = 1
1090
1203
  var i = 0
1091
1204
  this[offset] = value & 0xFF
1092
- while (++i < byteLength && (mul *= 0x100))
1205
+ while (++i < byteLength && (mul *= 0x100)) {
1093
1206
  this[offset + i] = (value / mul) >>> 0 & 0xFF
1207
+ }
1094
1208
 
1095
1209
  return offset + byteLength
1096
1210
  }
1097
1211
 
1098
- Buffer.prototype.writeUIntBE = function (value, offset, byteLength, noAssert) {
1212
+ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1099
1213
  value = +value
1100
1214
  offset = offset >>> 0
1101
1215
  byteLength = byteLength >>> 0
1102
- if (!noAssert)
1103
- checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
1216
+ if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
1104
1217
 
1105
1218
  var i = byteLength - 1
1106
1219
  var mul = 1
1107
1220
  this[offset + i] = value & 0xFF
1108
- while (--i >= 0 && (mul *= 0x100))
1221
+ while (--i >= 0 && (mul *= 0x100)) {
1109
1222
  this[offset + i] = (value / mul) >>> 0 & 0xFF
1223
+ }
1110
1224
 
1111
1225
  return offset + byteLength
1112
1226
  }
1113
1227
 
1114
- Buffer.prototype.writeUInt8 = function (value, offset, noAssert) {
1228
+ Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1115
1229
  value = +value
1116
1230
  offset = offset >>> 0
1117
- if (!noAssert)
1118
- checkInt(this, value, offset, 1, 0xff, 0)
1231
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1119
1232
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1120
1233
  this[offset] = value
1121
1234
  return offset + 1
@@ -1129,27 +1242,29 @@ function objectWriteUInt16 (buf, value, offset, littleEndian) {
1129
1242
  }
1130
1243
  }
1131
1244
 
1132
- Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) {
1245
+ Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1133
1246
  value = +value
1134
1247
  offset = offset >>> 0
1135
- if (!noAssert)
1136
- checkInt(this, value, offset, 2, 0xffff, 0)
1248
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1137
1249
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1138
1250
  this[offset] = value
1139
1251
  this[offset + 1] = (value >>> 8)
1140
- } else objectWriteUInt16(this, value, offset, true)
1252
+ } else {
1253
+ objectWriteUInt16(this, value, offset, true)
1254
+ }
1141
1255
  return offset + 2
1142
1256
  }
1143
1257
 
1144
- Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) {
1258
+ Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1145
1259
  value = +value
1146
1260
  offset = offset >>> 0
1147
- if (!noAssert)
1148
- checkInt(this, value, offset, 2, 0xffff, 0)
1261
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1149
1262
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1150
1263
  this[offset] = (value >>> 8)
1151
1264
  this[offset + 1] = value
1152
- } else objectWriteUInt16(this, value, offset, false)
1265
+ } else {
1266
+ objectWriteUInt16(this, value, offset, false)
1267
+ }
1153
1268
  return offset + 2
1154
1269
  }
1155
1270
 
@@ -1160,139 +1275,144 @@ function objectWriteUInt32 (buf, value, offset, littleEndian) {
1160
1275
  }
1161
1276
  }
1162
1277
 
1163
- Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) {
1278
+ Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1164
1279
  value = +value
1165
1280
  offset = offset >>> 0
1166
- if (!noAssert)
1167
- checkInt(this, value, offset, 4, 0xffffffff, 0)
1281
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1168
1282
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1169
1283
  this[offset + 3] = (value >>> 24)
1170
1284
  this[offset + 2] = (value >>> 16)
1171
1285
  this[offset + 1] = (value >>> 8)
1172
1286
  this[offset] = value
1173
- } else objectWriteUInt32(this, value, offset, true)
1287
+ } else {
1288
+ objectWriteUInt32(this, value, offset, true)
1289
+ }
1174
1290
  return offset + 4
1175
1291
  }
1176
1292
 
1177
- Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) {
1293
+ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1178
1294
  value = +value
1179
1295
  offset = offset >>> 0
1180
- if (!noAssert)
1181
- checkInt(this, value, offset, 4, 0xffffffff, 0)
1296
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1182
1297
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1183
1298
  this[offset] = (value >>> 24)
1184
1299
  this[offset + 1] = (value >>> 16)
1185
1300
  this[offset + 2] = (value >>> 8)
1186
1301
  this[offset + 3] = value
1187
- } else objectWriteUInt32(this, value, offset, false)
1302
+ } else {
1303
+ objectWriteUInt32(this, value, offset, false)
1304
+ }
1188
1305
  return offset + 4
1189
1306
  }
1190
1307
 
1191
- Buffer.prototype.writeIntLE = function (value, offset, byteLength, noAssert) {
1308
+ Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1192
1309
  value = +value
1193
1310
  offset = offset >>> 0
1194
1311
  if (!noAssert) {
1195
- checkInt(this,
1196
- value,
1197
- offset,
1198
- byteLength,
1199
- Math.pow(2, 8 * byteLength - 1) - 1,
1200
- -Math.pow(2, 8 * byteLength - 1))
1312
+ checkInt(
1313
+ this, value, offset, byteLength,
1314
+ Math.pow(2, 8 * byteLength - 1) - 1,
1315
+ -Math.pow(2, 8 * byteLength - 1)
1316
+ )
1201
1317
  }
1202
1318
 
1203
1319
  var i = 0
1204
1320
  var mul = 1
1205
1321
  var sub = value < 0 ? 1 : 0
1206
1322
  this[offset] = value & 0xFF
1207
- while (++i < byteLength && (mul *= 0x100))
1323
+ while (++i < byteLength && (mul *= 0x100)) {
1208
1324
  this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1325
+ }
1209
1326
 
1210
1327
  return offset + byteLength
1211
1328
  }
1212
1329
 
1213
- Buffer.prototype.writeIntBE = function (value, offset, byteLength, noAssert) {
1330
+ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1214
1331
  value = +value
1215
1332
  offset = offset >>> 0
1216
1333
  if (!noAssert) {
1217
- checkInt(this,
1218
- value,
1219
- offset,
1220
- byteLength,
1221
- Math.pow(2, 8 * byteLength - 1) - 1,
1222
- -Math.pow(2, 8 * byteLength - 1))
1334
+ checkInt(
1335
+ this, value, offset, byteLength,
1336
+ Math.pow(2, 8 * byteLength - 1) - 1,
1337
+ -Math.pow(2, 8 * byteLength - 1)
1338
+ )
1223
1339
  }
1224
1340
 
1225
1341
  var i = byteLength - 1
1226
1342
  var mul = 1
1227
1343
  var sub = value < 0 ? 1 : 0
1228
1344
  this[offset + i] = value & 0xFF
1229
- while (--i >= 0 && (mul *= 0x100))
1345
+ while (--i >= 0 && (mul *= 0x100)) {
1230
1346
  this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1347
+ }
1231
1348
 
1232
1349
  return offset + byteLength
1233
1350
  }
1234
1351
 
1235
- Buffer.prototype.writeInt8 = function (value, offset, noAssert) {
1352
+ Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1236
1353
  value = +value
1237
1354
  offset = offset >>> 0
1238
- if (!noAssert)
1239
- checkInt(this, value, offset, 1, 0x7f, -0x80)
1355
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1240
1356
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
1241
1357
  if (value < 0) value = 0xff + value + 1
1242
1358
  this[offset] = value
1243
1359
  return offset + 1
1244
1360
  }
1245
1361
 
1246
- Buffer.prototype.writeInt16LE = function (value, offset, noAssert) {
1362
+ Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1247
1363
  value = +value
1248
1364
  offset = offset >>> 0
1249
- if (!noAssert)
1250
- checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1365
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1251
1366
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1252
1367
  this[offset] = value
1253
1368
  this[offset + 1] = (value >>> 8)
1254
- } else objectWriteUInt16(this, value, offset, true)
1369
+ } else {
1370
+ objectWriteUInt16(this, value, offset, true)
1371
+ }
1255
1372
  return offset + 2
1256
1373
  }
1257
1374
 
1258
- Buffer.prototype.writeInt16BE = function (value, offset, noAssert) {
1375
+ Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1259
1376
  value = +value
1260
1377
  offset = offset >>> 0
1261
- if (!noAssert)
1262
- checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1378
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1263
1379
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1264
1380
  this[offset] = (value >>> 8)
1265
1381
  this[offset + 1] = value
1266
- } else objectWriteUInt16(this, value, offset, false)
1382
+ } else {
1383
+ objectWriteUInt16(this, value, offset, false)
1384
+ }
1267
1385
  return offset + 2
1268
1386
  }
1269
1387
 
1270
- Buffer.prototype.writeInt32LE = function (value, offset, noAssert) {
1388
+ Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1271
1389
  value = +value
1272
1390
  offset = offset >>> 0
1273
- if (!noAssert)
1274
- checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1391
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1275
1392
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1276
1393
  this[offset] = value
1277
1394
  this[offset + 1] = (value >>> 8)
1278
1395
  this[offset + 2] = (value >>> 16)
1279
1396
  this[offset + 3] = (value >>> 24)
1280
- } else objectWriteUInt32(this, value, offset, true)
1397
+ } else {
1398
+ objectWriteUInt32(this, value, offset, true)
1399
+ }
1281
1400
  return offset + 4
1282
1401
  }
1283
1402
 
1284
- Buffer.prototype.writeInt32BE = function (value, offset, noAssert) {
1403
+ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1285
1404
  value = +value
1286
1405
  offset = offset >>> 0
1287
- if (!noAssert)
1288
- checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1406
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1289
1407
  if (value < 0) value = 0xffffffff + value + 1
1290
1408
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1291
1409
  this[offset] = (value >>> 24)
1292
1410
  this[offset + 1] = (value >>> 16)
1293
1411
  this[offset + 2] = (value >>> 8)
1294
1412
  this[offset + 3] = value
1295
- } else objectWriteUInt32(this, value, offset, false)
1413
+ } else {
1414
+ objectWriteUInt32(this, value, offset, false)
1415
+ }
1296
1416
  return offset + 4
1297
1417
  }
1298
1418
 
@@ -1303,38 +1423,40 @@ function checkIEEE754 (buf, value, offset, ext, max, min) {
1303
1423
  }
1304
1424
 
1305
1425
  function writeFloat (buf, value, offset, littleEndian, noAssert) {
1306
- if (!noAssert)
1426
+ if (!noAssert) {
1307
1427
  checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1428
+ }
1308
1429
  ieee754.write(buf, value, offset, littleEndian, 23, 4)
1309
1430
  return offset + 4
1310
1431
  }
1311
1432
 
1312
- Buffer.prototype.writeFloatLE = function (value, offset, noAssert) {
1433
+ Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1313
1434
  return writeFloat(this, value, offset, true, noAssert)
1314
1435
  }
1315
1436
 
1316
- Buffer.prototype.writeFloatBE = function (value, offset, noAssert) {
1437
+ Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1317
1438
  return writeFloat(this, value, offset, false, noAssert)
1318
1439
  }
1319
1440
 
1320
1441
  function writeDouble (buf, value, offset, littleEndian, noAssert) {
1321
- if (!noAssert)
1442
+ if (!noAssert) {
1322
1443
  checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1444
+ }
1323
1445
  ieee754.write(buf, value, offset, littleEndian, 52, 8)
1324
1446
  return offset + 8
1325
1447
  }
1326
1448
 
1327
- Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) {
1449
+ Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1328
1450
  return writeDouble(this, value, offset, true, noAssert)
1329
1451
  }
1330
1452
 
1331
- Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) {
1453
+ Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1332
1454
  return writeDouble(this, value, offset, false, noAssert)
1333
1455
  }
1334
1456
 
1335
1457
  // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1336
- Buffer.prototype.copy = function (target, target_start, start, end) {
1337
- var source = this
1458
+ Buffer.prototype.copy = function copy (target, target_start, start, end) {
1459
+ var self = this // source
1338
1460
 
1339
1461
  if (!start) start = 0
1340
1462
  if (!end && end !== 0) end = this.length
@@ -1344,19 +1466,20 @@ Buffer.prototype.copy = function (target, target_start, start, end) {
1344
1466
 
1345
1467
  // Copy 0 bytes; we're done
1346
1468
  if (end === start) return 0
1347
- if (target.length === 0 || source.length === 0) return 0
1469
+ if (target.length === 0 || self.length === 0) return 0
1348
1470
 
1349
1471
  // Fatal error conditions
1350
- if (target_start < 0)
1472
+ if (target_start < 0) {
1351
1473
  throw new RangeError('targetStart out of bounds')
1352
- if (start < 0 || start >= source.length) throw new RangeError('sourceStart out of bounds')
1474
+ }
1475
+ if (start < 0 || start >= self.length) throw new RangeError('sourceStart out of bounds')
1353
1476
  if (end < 0) throw new RangeError('sourceEnd out of bounds')
1354
1477
 
1355
1478
  // Are we oob?
1356
- if (end > this.length)
1357
- end = this.length
1358
- if (target.length - target_start < end - start)
1479
+ if (end > this.length) end = this.length
1480
+ if (target.length - target_start < end - start) {
1359
1481
  end = target.length - target_start + start
1482
+ }
1360
1483
 
1361
1484
  var len = end - start
1362
1485
 
@@ -1372,7 +1495,7 @@ Buffer.prototype.copy = function (target, target_start, start, end) {
1372
1495
  }
1373
1496
 
1374
1497
  // fill(value, start=0, end=buffer.length)
1375
- Buffer.prototype.fill = function (value, start, end) {
1498
+ Buffer.prototype.fill = function fill (value, start, end) {
1376
1499
  if (!value) value = 0
1377
1500
  if (!start) start = 0
1378
1501
  if (!end) end = this.length
@@ -1406,7 +1529,7 @@ Buffer.prototype.fill = function (value, start, end) {
1406
1529
  * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
1407
1530
  * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
1408
1531
  */
1409
- Buffer.prototype.toArrayBuffer = function () {
1532
+ Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
1410
1533
  if (typeof Uint8Array !== 'undefined') {
1411
1534
  if (Buffer.TYPED_ARRAY_SUPPORT) {
1412
1535
  return (new Buffer(this)).buffer
@@ -1430,7 +1553,7 @@ var BP = Buffer.prototype
1430
1553
  /**
1431
1554
  * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
1432
1555
  */
1433
- Buffer._augment = function (arr) {
1556
+ Buffer._augment = function _augment (arr) {
1434
1557
  arr.constructor = Buffer
1435
1558
  arr._isBuffer = true
1436
1559
 
@@ -1448,6 +1571,7 @@ Buffer._augment = function (arr) {
1448
1571
  arr.toJSON = BP.toJSON
1449
1572
  arr.equals = BP.equals
1450
1573
  arr.compare = BP.compare
1574
+ arr.indexOf = BP.indexOf
1451
1575
  arr.copy = BP.copy
1452
1576
  arr.slice = BP.slice
1453
1577
  arr.readUIntLE = BP.readUIntLE
@@ -1523,61 +1647,50 @@ function toHex (n) {
1523
1647
  return n.toString(16)
1524
1648
  }
1525
1649
 
1526
- function utf8ToBytes(string, units) {
1527
- var codePoint, length = string.length
1528
- var leadSurrogate = null
1650
+ function utf8ToBytes (string, units) {
1529
1651
  units = units || Infinity
1652
+ var codePoint
1653
+ var length = string.length
1654
+ var leadSurrogate = null
1530
1655
  var bytes = []
1531
1656
  var i = 0
1532
1657
 
1533
- for (; i<length; i++) {
1658
+ for (; i < length; i++) {
1534
1659
  codePoint = string.charCodeAt(i)
1535
1660
 
1536
1661
  // is surrogate component
1537
1662
  if (codePoint > 0xD7FF && codePoint < 0xE000) {
1538
-
1539
1663
  // last char was a lead
1540
1664
  if (leadSurrogate) {
1541
-
1542
1665
  // 2 leads in a row
1543
1666
  if (codePoint < 0xDC00) {
1544
1667
  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1545
1668
  leadSurrogate = codePoint
1546
1669
  continue
1547
- }
1548
-
1549
- // valid surrogate pair
1550
- else {
1670
+ } else {
1671
+ // valid surrogate pair
1551
1672
  codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
1552
1673
  leadSurrogate = null
1553
1674
  }
1554
- }
1555
-
1556
- // no lead yet
1557
- else {
1675
+ } else {
1676
+ // no lead yet
1558
1677
 
1559
- // unexpected trail
1560
1678
  if (codePoint > 0xDBFF) {
1679
+ // unexpected trail
1561
1680
  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1562
1681
  continue
1563
- }
1564
-
1565
- // unpaired lead
1566
- else if (i + 1 === length) {
1682
+ } else if (i + 1 === length) {
1683
+ // unpaired lead
1567
1684
  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1568
1685
  continue
1569
- }
1570
-
1571
- // valid lead
1572
- else {
1686
+ } else {
1687
+ // valid lead
1573
1688
  leadSurrogate = codePoint
1574
1689
  continue
1575
1690
  }
1576
1691
  }
1577
- }
1578
-
1579
- // valid bmp char, but last char was a lead
1580
- else if (leadSurrogate) {
1692
+ } else if (leadSurrogate) {
1693
+ // valid bmp char, but last char was a lead
1581
1694
  if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1582
1695
  leadSurrogate = null
1583
1696
  }
@@ -1586,32 +1699,28 @@ function utf8ToBytes(string, units) {
1586
1699
  if (codePoint < 0x80) {
1587
1700
  if ((units -= 1) < 0) break
1588
1701
  bytes.push(codePoint)
1589
- }
1590
- else if (codePoint < 0x800) {
1702
+ } else if (codePoint < 0x800) {
1591
1703
  if ((units -= 2) < 0) break
1592
1704
  bytes.push(
1593
1705
  codePoint >> 0x6 | 0xC0,
1594
1706
  codePoint & 0x3F | 0x80
1595
- );
1596
- }
1597
- else if (codePoint < 0x10000) {
1707
+ )
1708
+ } else if (codePoint < 0x10000) {
1598
1709
  if ((units -= 3) < 0) break
1599
1710
  bytes.push(
1600
1711
  codePoint >> 0xC | 0xE0,
1601
1712
  codePoint >> 0x6 & 0x3F | 0x80,
1602
1713
  codePoint & 0x3F | 0x80
1603
- );
1604
- }
1605
- else if (codePoint < 0x200000) {
1714
+ )
1715
+ } else if (codePoint < 0x200000) {
1606
1716
  if ((units -= 4) < 0) break
1607
1717
  bytes.push(
1608
1718
  codePoint >> 0x12 | 0xF0,
1609
1719
  codePoint >> 0xC & 0x3F | 0x80,
1610
1720
  codePoint >> 0x6 & 0x3F | 0x80,
1611
1721
  codePoint & 0x3F | 0x80
1612
- );
1613
- }
1614
- else {
1722
+ )
1723
+ } else {
1615
1724
  throw new Error('Invalid code point')
1616
1725
  }
1617
1726
  }
@@ -1632,7 +1741,6 @@ function utf16leToBytes (str, units) {
1632
1741
  var c, hi, lo
1633
1742
  var byteArray = []
1634
1743
  for (var i = 0; i < str.length; i++) {
1635
-
1636
1744
  if ((units -= 2) < 0) break
1637
1745
 
1638
1746
  c = str.charCodeAt(i)
@@ -1649,11 +1757,9 @@ function base64ToBytes (str) {
1649
1757
  return base64.toByteArray(base64clean(str))
1650
1758
  }
1651
1759
 
1652
- function blitBuffer (src, dst, offset, length, unitSize) {
1653
- if (unitSize) length -= length % unitSize;
1760
+ function blitBuffer (src, dst, offset, length) {
1654
1761
  for (var i = 0; i < length; i++) {
1655
- if ((i + offset >= dst.length) || (i >= src.length))
1656
- break
1762
+ if ((i + offset >= dst.length) || (i >= src.length)) break
1657
1763
  dst[i + offset] = src[i]
1658
1764
  }
1659
1765
  return i
@@ -1667,7 +1773,7 @@ function decodeUtf8Char (str) {
1667
1773
  }
1668
1774
  }
1669
1775
 
1670
- },{"base64-js":3,"ieee754":4,"is-array":5}],3:[function(_dereq_,module,exports){
1776
+ },{"base64-js":4,"ieee754":5,"is-array":6}],4:[function(_dereq_,module,exports){
1671
1777
  var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1672
1778
 
1673
1779
  ;(function (exports) {
@@ -1793,7 +1899,7 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1793
1899
  exports.fromByteArray = uint8ToBase64
1794
1900
  }(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
1795
1901
 
1796
- },{}],4:[function(_dereq_,module,exports){
1902
+ },{}],5:[function(_dereq_,module,exports){
1797
1903
  exports.read = function(buffer, offset, isLE, mLen, nBytes) {
1798
1904
  var e, m,
1799
1905
  eLen = nBytes * 8 - mLen - 1,
@@ -1879,7 +1985,7 @@ exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
1879
1985
  buffer[offset + i - d] |= s * 128;
1880
1986
  };
1881
1987
 
1882
- },{}],5:[function(_dereq_,module,exports){
1988
+ },{}],6:[function(_dereq_,module,exports){
1883
1989
 
1884
1990
  /**
1885
1991
  * isArray
@@ -1914,7 +2020,7 @@ module.exports = isArray || function (val) {
1914
2020
  return !! val && '[object Array]' == str.call(val);
1915
2021
  };
1916
2022
 
1917
- },{}],6:[function(_dereq_,module,exports){
2023
+ },{}],7:[function(_dereq_,module,exports){
1918
2024
  (function (process){
1919
2025
  // Copyright Joyent, Inc. and other Node contributors.
1920
2026
  //
@@ -2142,7 +2248,7 @@ var substr = 'ab'.substr(-1) === 'b'
2142
2248
  ;
2143
2249
 
2144
2250
  }).call(this,_dereq_('_process'))
2145
- },{"_process":7}],7:[function(_dereq_,module,exports){
2251
+ },{"_process":8}],8:[function(_dereq_,module,exports){
2146
2252
  // shim for using process in browser
2147
2253
 
2148
2254
  var process = module.exports = {};
@@ -2179,6 +2285,7 @@ process.browser = true;
2179
2285
  process.env = {};
2180
2286
  process.argv = [];
2181
2287
  process.version = ''; // empty string to avoid regexp issues
2288
+ process.versions = {};
2182
2289
 
2183
2290
  function noop() {}
2184
2291
 
@@ -2201,7 +2308,7 @@ process.chdir = function (dir) {
2201
2308
  };
2202
2309
  process.umask = function() { return 0; };
2203
2310
 
2204
- },{}],8:[function(_dereq_,module,exports){
2311
+ },{}],9:[function(_dereq_,module,exports){
2205
2312
  /*
2206
2313
  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
2207
2314
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
@@ -2234,32 +2341,6 @@ process.umask = function() { return 0; };
2234
2341
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2235
2342
  */
2236
2343
 
2237
- /*jslint bitwise:true plusplus:true */
2238
- /*global esprima:true, define:true, exports:true, window: true,
2239
- throwErrorTolerant: true,
2240
- throwError: true, generateStatement: true, peek: true,
2241
- parseAssignmentExpression: true, parseBlock: true,
2242
- parseClassExpression: true, parseClassDeclaration: true, parseExpression: true,
2243
- parseDeclareClass: true, parseDeclareFunction: true,
2244
- parseDeclareModule: true, parseDeclareVariable: true,
2245
- parseForStatement: true,
2246
- parseFunctionDeclaration: true, parseFunctionExpression: true,
2247
- parseFunctionSourceElements: true, parseVariableIdentifier: true,
2248
- parseImportSpecifier: true, parseInterface: true,
2249
- parseLeftHandSideExpression: true, parseParams: true, validateParam: true,
2250
- parseSpreadOrAssignmentExpression: true,
2251
- parseStatement: true, parseSourceElement: true, parseConciseBody: true,
2252
- advanceXJSChild: true, isXJSIdentifierStart: true, isXJSIdentifierPart: true,
2253
- scanXJSStringLiteral: true, scanXJSIdentifier: true,
2254
- parseXJSAttributeValue: true, parseXJSChild: true, parseXJSElement: true, parseXJSExpressionContainer: true, parseXJSEmptyExpression: true,
2255
- parseFunctionTypeParam: true,
2256
- parsePrimaryType: true,
2257
- parseTypeAlias: true,
2258
- parseType: true, parseTypeAnnotatableIdentifier: true, parseTypeAnnotation: true,
2259
- parseTypeParameterDeclaration: true,
2260
- parseYieldExpression: true, parseAwaitExpression: true
2261
- */
2262
-
2263
2344
  (function (root, factory) {
2264
2345
  'use strict';
2265
2346
 
@@ -2309,8 +2390,8 @@ parseYieldExpression: true, parseAwaitExpression: true
2309
2390
  StringLiteral: 8,
2310
2391
  RegularExpression: 9,
2311
2392
  Template: 10,
2312
- XJSIdentifier: 11,
2313
- XJSText: 12
2393
+ JSXIdentifier: 11,
2394
+ JSXText: 12
2314
2395
  };
2315
2396
 
2316
2397
  TokenName = {};
@@ -2322,8 +2403,8 @@ parseYieldExpression: true, parseAwaitExpression: true
2322
2403
  TokenName[Token.NumericLiteral] = 'Numeric';
2323
2404
  TokenName[Token.Punctuator] = 'Punctuator';
2324
2405
  TokenName[Token.StringLiteral] = 'String';
2325
- TokenName[Token.XJSIdentifier] = 'XJSIdentifier';
2326
- TokenName[Token.XJSText] = 'XJSText';
2406
+ TokenName[Token.JSXIdentifier] = 'JSXIdentifier';
2407
+ TokenName[Token.JSXText] = 'JSXText';
2327
2408
  TokenName[Token.RegularExpression] = 'RegularExpression';
2328
2409
 
2329
2410
  // A function following one of those tokens is an expression.
@@ -2434,17 +2515,17 @@ parseYieldExpression: true, parseAwaitExpression: true
2434
2515
  VoidTypeAnnotation: 'VoidTypeAnnotation',
2435
2516
  WhileStatement: 'WhileStatement',
2436
2517
  WithStatement: 'WithStatement',
2437
- XJSIdentifier: 'XJSIdentifier',
2438
- XJSNamespacedName: 'XJSNamespacedName',
2439
- XJSMemberExpression: 'XJSMemberExpression',
2440
- XJSEmptyExpression: 'XJSEmptyExpression',
2441
- XJSExpressionContainer: 'XJSExpressionContainer',
2442
- XJSElement: 'XJSElement',
2443
- XJSClosingElement: 'XJSClosingElement',
2444
- XJSOpeningElement: 'XJSOpeningElement',
2445
- XJSAttribute: 'XJSAttribute',
2446
- XJSSpreadAttribute: 'XJSSpreadAttribute',
2447
- XJSText: 'XJSText',
2518
+ JSXIdentifier: 'JSXIdentifier',
2519
+ JSXNamespacedName: 'JSXNamespacedName',
2520
+ JSXMemberExpression: 'JSXMemberExpression',
2521
+ JSXEmptyExpression: 'JSXEmptyExpression',
2522
+ JSXExpressionContainer: 'JSXExpressionContainer',
2523
+ JSXElement: 'JSXElement',
2524
+ JSXClosingElement: 'JSXClosingElement',
2525
+ JSXOpeningElement: 'JSXOpeningElement',
2526
+ JSXAttribute: 'JSXAttribute',
2527
+ JSXSpreadAttribute: 'JSXSpreadAttribute',
2528
+ JSXText: 'JSXText',
2448
2529
  YieldExpression: 'YieldExpression',
2449
2530
  AwaitExpression: 'AwaitExpression'
2450
2531
  };
@@ -2462,32 +2543,33 @@ parseYieldExpression: true, parseAwaitExpression: true
2462
2543
 
2463
2544
  // Error messages should be identical to V8.
2464
2545
  Messages = {
2465
- UnexpectedToken: 'Unexpected token %0',
2466
- UnexpectedNumber: 'Unexpected number',
2467
- UnexpectedString: 'Unexpected string',
2468
- UnexpectedIdentifier: 'Unexpected identifier',
2469
- UnexpectedReserved: 'Unexpected reserved word',
2470
- UnexpectedTemplate: 'Unexpected quasi %0',
2471
- UnexpectedEOS: 'Unexpected end of input',
2472
- NewlineAfterThrow: 'Illegal newline after throw',
2546
+ UnexpectedToken: 'Unexpected token %0',
2547
+ UnexpectedNumber: 'Unexpected number',
2548
+ UnexpectedString: 'Unexpected string',
2549
+ UnexpectedIdentifier: 'Unexpected identifier',
2550
+ UnexpectedReserved: 'Unexpected reserved word',
2551
+ UnexpectedTemplate: 'Unexpected quasi %0',
2552
+ UnexpectedEOS: 'Unexpected end of input',
2553
+ NewlineAfterThrow: 'Illegal newline after throw',
2473
2554
  InvalidRegExp: 'Invalid regular expression',
2474
- UnterminatedRegExp: 'Invalid regular expression: missing /',
2475
- InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
2476
- InvalidLHSInFormalsList: 'Invalid left-hand side in formals list',
2477
- InvalidLHSInForIn: 'Invalid left-hand side in for-in',
2555
+ UnterminatedRegExp: 'Invalid regular expression: missing /',
2556
+ InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
2557
+ InvalidLHSInFormalsList: 'Invalid left-hand side in formals list',
2558
+ InvalidLHSInForIn: 'Invalid left-hand side in for-in',
2478
2559
  MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
2479
- NoCatchOrFinally: 'Missing catch or finally after try',
2560
+ NoCatchOrFinally: 'Missing catch or finally after try',
2480
2561
  UnknownLabel: 'Undefined label \'%0\'',
2481
2562
  Redeclaration: '%0 \'%1\' has already been declared',
2482
2563
  IllegalContinue: 'Illegal continue statement',
2483
2564
  IllegalBreak: 'Illegal break statement',
2484
2565
  IllegalDuplicateClassProperty: 'Illegal duplicate property in class definition',
2566
+ IllegalClassConstructorProperty: 'Illegal constructor property in class definition',
2485
2567
  IllegalReturn: 'Illegal return statement',
2486
2568
  IllegalSpread: 'Illegal spread element',
2487
- StrictModeWith: 'Strict mode code may not include a with statement',
2488
- StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
2489
- StrictVarName: 'Variable name may not be eval or arguments in strict mode',
2490
- StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
2569
+ StrictModeWith: 'Strict mode code may not include a with statement',
2570
+ StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
2571
+ StrictVarName: 'Variable name may not be eval or arguments in strict mode',
2572
+ StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
2491
2573
  StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
2492
2574
  ParameterAfterRestParameter: 'Rest parameter must be final parameter of an argument list',
2493
2575
  DefaultRestParameter: 'Rest parameter can not have a default value',
@@ -2495,28 +2577,28 @@ parseYieldExpression: true, parseAwaitExpression: true
2495
2577
  PropertyAfterSpreadProperty: 'A rest property must be the final property of an object literal',
2496
2578
  ObjectPatternAsRestParameter: 'Invalid rest parameter',
2497
2579
  ObjectPatternAsSpread: 'Invalid spread argument',
2498
- StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
2499
- StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
2500
- StrictDelete: 'Delete of an unqualified identifier in strict mode.',
2501
- StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',
2502
- AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',
2503
- AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',
2504
- StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
2505
- StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
2506
- StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
2507
- StrictReservedWord: 'Use of future reserved word in strict mode',
2580
+ StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
2581
+ StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
2582
+ StrictDelete: 'Delete of an unqualified identifier in strict mode.',
2583
+ StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',
2584
+ AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',
2585
+ AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',
2586
+ StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
2587
+ StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
2588
+ StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
2589
+ StrictReservedWord: 'Use of future reserved word in strict mode',
2508
2590
  MissingFromClause: 'Missing from clause',
2509
2591
  NoAsAfterImportNamespace: 'Missing as after import *',
2510
2592
  InvalidModuleSpecifier: 'Invalid module specifier',
2511
2593
  IllegalImportDeclaration: 'Illegal import declaration',
2512
2594
  IllegalExportDeclaration: 'Illegal export declaration',
2513
- NoUnintializedConst: 'Const must be initialized',
2595
+ NoUninitializedConst: 'Const must be initialized',
2514
2596
  ComprehensionRequiresBlock: 'Comprehension must have at least one block',
2515
- ComprehensionError: 'Comprehension Error',
2516
- EachNotAllowed: 'Each is not supported',
2517
- InvalidXJSAttributeValue: 'XJS value should be either an expression or a quoted XJS text',
2518
- ExpectedXJSClosingTag: 'Expected corresponding XJS closing tag for %0',
2519
- AdjacentXJSElements: 'Adjacent XJS elements must be wrapped in an enclosing tag',
2597
+ ComprehensionError: 'Comprehension Error',
2598
+ EachNotAllowed: 'Each is not supported',
2599
+ InvalidJSXAttributeValue: 'JSX value should be either an expression or a quoted JSX text',
2600
+ ExpectedJSXClosingTag: 'Expected corresponding JSX closing tag for %0',
2601
+ AdjacentJSXElements: 'Adjacent JSX elements must be wrapped in an enclosing tag',
2520
2602
  ConfusedAboutFunctionType: 'Unexpected token =>. It looks like ' +
2521
2603
  'you are trying to write a function type, but you ended up ' +
2522
2604
  'writing a grouped type followed by an =>, which is a syntax ' +
@@ -2564,7 +2646,7 @@ parseYieldExpression: true, parseAwaitExpression: true
2564
2646
  return Object.prototype.hasOwnProperty.call(this.$data, key);
2565
2647
  };
2566
2648
 
2567
- StringMap.prototype['delete'] = function (key) {
2649
+ StringMap.prototype["delete"] = function (key) {
2568
2650
  key = '$' + key;
2569
2651
  return delete this.$data[key];
2570
2652
  };
@@ -2696,103 +2778,181 @@ parseYieldExpression: true, parseAwaitExpression: true
2696
2778
 
2697
2779
  // 7.4 Comments
2698
2780
 
2699
- function skipComment() {
2700
- var ch, blockComment, lineComment;
2781
+ function addComment(type, value, start, end, loc) {
2782
+ var comment;
2783
+ assert(typeof start === 'number', 'Comment must have valid position');
2784
+
2785
+ // Because the way the actual token is scanned, often the comments
2786
+ // (if any) are skipped twice during the lexical analysis.
2787
+ // Thus, we need to skip adding a comment if the comment array already
2788
+ // handled it.
2789
+ if (state.lastCommentStart >= start) {
2790
+ return;
2791
+ }
2792
+ state.lastCommentStart = start;
2793
+
2794
+ comment = {
2795
+ type: type,
2796
+ value: value
2797
+ };
2798
+ if (extra.range) {
2799
+ comment.range = [start, end];
2800
+ }
2801
+ if (extra.loc) {
2802
+ comment.loc = loc;
2803
+ }
2804
+ extra.comments.push(comment);
2805
+ if (extra.attachComment) {
2806
+ extra.leadingComments.push(comment);
2807
+ extra.trailingComments.push(comment);
2808
+ }
2809
+ }
2701
2810
 
2702
- blockComment = false;
2703
- lineComment = false;
2811
+ function skipSingleLineComment() {
2812
+ var start, loc, ch, comment;
2813
+
2814
+ start = index - 2;
2815
+ loc = {
2816
+ start: {
2817
+ line: lineNumber,
2818
+ column: index - lineStart - 2
2819
+ }
2820
+ };
2704
2821
 
2705
2822
  while (index < length) {
2706
2823
  ch = source.charCodeAt(index);
2707
-
2708
- if (lineComment) {
2709
- ++index;
2710
- if (isLineTerminator(ch)) {
2711
- lineComment = false;
2712
- if (ch === 13 && source.charCodeAt(index) === 10) {
2713
- ++index;
2714
- }
2715
- ++lineNumber;
2716
- lineStart = index;
2717
- }
2718
- } else if (blockComment) {
2719
- if (isLineTerminator(ch)) {
2720
- if (ch === 13) {
2721
- ++index;
2722
- }
2723
- if (ch !== 13 || source.charCodeAt(index) === 10) {
2724
- ++lineNumber;
2725
- ++index;
2726
- lineStart = index;
2727
- if (index >= length) {
2728
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2729
- }
2730
- }
2731
- } else {
2732
- ch = source.charCodeAt(index++);
2733
- if (index >= length) {
2734
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2735
- }
2736
- // Block comment ends with '*/' (char #42, char #47).
2737
- if (ch === 42) {
2738
- ch = source.charCodeAt(index);
2739
- if (ch === 47) {
2740
- ++index;
2741
- blockComment = false;
2742
- }
2743
- }
2744
- }
2745
- } else if (ch === 47) {
2746
- ch = source.charCodeAt(index + 1);
2747
- // Line comment starts with '//' (char #47, char #47).
2748
- if (ch === 47) {
2749
- index += 2;
2750
- lineComment = true;
2751
- } else if (ch === 42) {
2752
- // Block comment starts with '/*' (char #47, char #42).
2753
- index += 2;
2754
- blockComment = true;
2755
- if (index >= length) {
2756
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2757
- }
2758
- } else {
2759
- break;
2824
+ ++index;
2825
+ if (isLineTerminator(ch)) {
2826
+ if (extra.comments) {
2827
+ comment = source.slice(start + 2, index - 1);
2828
+ loc.end = {
2829
+ line: lineNumber,
2830
+ column: index - lineStart - 1
2831
+ };
2832
+ addComment('Line', comment, start, index - 1, loc);
2760
2833
  }
2761
- } else if (isWhiteSpace(ch)) {
2762
- ++index;
2763
- } else if (isLineTerminator(ch)) {
2764
- ++index;
2765
2834
  if (ch === 13 && source.charCodeAt(index) === 10) {
2766
2835
  ++index;
2767
2836
  }
2768
2837
  ++lineNumber;
2769
2838
  lineStart = index;
2770
- } else {
2771
- break;
2839
+ return;
2772
2840
  }
2773
2841
  }
2774
- }
2775
2842
 
2776
- function scanHexEscape(prefix) {
2777
- var i, len, ch, code = 0;
2778
-
2779
- len = (prefix === 'u') ? 4 : 2;
2780
- for (i = 0; i < len; ++i) {
2781
- if (index < length && isHexDigit(source[index])) {
2782
- ch = source[index++];
2783
- code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
2784
- } else {
2785
- return '';
2786
- }
2843
+ if (extra.comments) {
2844
+ comment = source.slice(start + 2, index);
2845
+ loc.end = {
2846
+ line: lineNumber,
2847
+ column: index - lineStart
2848
+ };
2849
+ addComment('Line', comment, start, index, loc);
2787
2850
  }
2788
- return String.fromCharCode(code);
2789
2851
  }
2790
2852
 
2791
- function scanUnicodeCodePointEscape() {
2792
- var ch, code, cu1, cu2;
2853
+ function skipMultiLineComment() {
2854
+ var start, loc, ch, comment;
2793
2855
 
2794
- ch = source[index];
2795
- code = 0;
2856
+ if (extra.comments) {
2857
+ start = index - 2;
2858
+ loc = {
2859
+ start: {
2860
+ line: lineNumber,
2861
+ column: index - lineStart - 2
2862
+ }
2863
+ };
2864
+ }
2865
+
2866
+ while (index < length) {
2867
+ ch = source.charCodeAt(index);
2868
+ if (isLineTerminator(ch)) {
2869
+ if (ch === 13 && source.charCodeAt(index + 1) === 10) {
2870
+ ++index;
2871
+ }
2872
+ ++lineNumber;
2873
+ ++index;
2874
+ lineStart = index;
2875
+ if (index >= length) {
2876
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2877
+ }
2878
+ } else if (ch === 42) {
2879
+ // Block comment ends with '*/' (char #42, char #47).
2880
+ if (source.charCodeAt(index + 1) === 47) {
2881
+ ++index;
2882
+ ++index;
2883
+ if (extra.comments) {
2884
+ comment = source.slice(start + 2, index - 2);
2885
+ loc.end = {
2886
+ line: lineNumber,
2887
+ column: index - lineStart
2888
+ };
2889
+ addComment('Block', comment, start, index, loc);
2890
+ }
2891
+ return;
2892
+ }
2893
+ ++index;
2894
+ } else {
2895
+ ++index;
2896
+ }
2897
+ }
2898
+
2899
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
2900
+ }
2901
+
2902
+ function skipComment() {
2903
+ var ch;
2904
+
2905
+ while (index < length) {
2906
+ ch = source.charCodeAt(index);
2907
+
2908
+ if (isWhiteSpace(ch)) {
2909
+ ++index;
2910
+ } else if (isLineTerminator(ch)) {
2911
+ ++index;
2912
+ if (ch === 13 && source.charCodeAt(index) === 10) {
2913
+ ++index;
2914
+ }
2915
+ ++lineNumber;
2916
+ lineStart = index;
2917
+ } else if (ch === 47) { // 47 is '/'
2918
+ ch = source.charCodeAt(index + 1);
2919
+ if (ch === 47) {
2920
+ ++index;
2921
+ ++index;
2922
+ skipSingleLineComment();
2923
+ } else if (ch === 42) { // 42 is '*'
2924
+ ++index;
2925
+ ++index;
2926
+ skipMultiLineComment();
2927
+ } else {
2928
+ break;
2929
+ }
2930
+ } else {
2931
+ break;
2932
+ }
2933
+ }
2934
+ }
2935
+
2936
+ function scanHexEscape(prefix) {
2937
+ var i, len, ch, code = 0;
2938
+
2939
+ len = (prefix === 'u') ? 4 : 2;
2940
+ for (i = 0; i < len; ++i) {
2941
+ if (index < length && isHexDigit(source[index])) {
2942
+ ch = source[index++];
2943
+ code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
2944
+ } else {
2945
+ return '';
2946
+ }
2947
+ }
2948
+ return String.fromCharCode(code);
2949
+ }
2950
+
2951
+ function scanUnicodeCodePointEscape() {
2952
+ var ch, code, cu1, cu2;
2953
+
2954
+ ch = source[index];
2955
+ code = 0;
2796
2956
 
2797
2957
  // At least, one hex digit is required.
2798
2958
  if (ch === '}') {
@@ -2929,7 +3089,7 @@ parseYieldExpression: true, parseAwaitExpression: true
2929
3089
  ch3,
2930
3090
  ch4;
2931
3091
 
2932
- if (state.inXJSTag || state.inXJSChild) {
3092
+ if (state.inJSXTag || state.inJSXChild) {
2933
3093
  // Don't need to check for '{' and '}' as it's already handled
2934
3094
  // correctly by default.
2935
3095
  switch (code) {
@@ -3045,7 +3205,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3045
3205
 
3046
3206
  // 3-character punctuators: === !== >>> <<= >>=
3047
3207
 
3048
- if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
3208
+ if (ch1 === '>' && ch2 === '>' && ch3 === '>' && !state.inType) {
3049
3209
  index += 3;
3050
3210
  return {
3051
3211
  type: Token.Punctuator,
@@ -3169,6 +3329,41 @@ parseYieldExpression: true, parseAwaitExpression: true
3169
3329
  };
3170
3330
  }
3171
3331
 
3332
+ function scanBinaryLiteral(start) {
3333
+ var ch, number;
3334
+
3335
+ number = '';
3336
+
3337
+ while (index < length) {
3338
+ ch = source[index];
3339
+ if (ch !== '0' && ch !== '1') {
3340
+ break;
3341
+ }
3342
+ number += source[index++];
3343
+ }
3344
+
3345
+ if (number.length === 0) {
3346
+ // only 0b or 0B
3347
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3348
+ }
3349
+
3350
+ if (index < length) {
3351
+ ch = source.charCodeAt(index);
3352
+ /* istanbul ignore else */
3353
+ if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
3354
+ throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3355
+ }
3356
+ }
3357
+
3358
+ return {
3359
+ type: Token.NumericLiteral,
3360
+ value: parseInt(number, 2),
3361
+ lineNumber: lineNumber,
3362
+ lineStart: lineStart,
3363
+ range: [start, index]
3364
+ };
3365
+ }
3366
+
3172
3367
  function scanOctalLiteral(prefix, start) {
3173
3368
  var number, octal;
3174
3369
 
@@ -3208,7 +3403,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3208
3403
  }
3209
3404
 
3210
3405
  function scanNumericLiteral() {
3211
- var number, start, ch, octal;
3406
+ var number, start, ch;
3212
3407
 
3213
3408
  ch = source[index];
3214
3409
  assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
@@ -3231,35 +3426,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3231
3426
  }
3232
3427
  if (ch === 'b' || ch === 'B') {
3233
3428
  ++index;
3234
- number = '';
3235
-
3236
- while (index < length) {
3237
- ch = source[index];
3238
- if (ch !== '0' && ch !== '1') {
3239
- break;
3240
- }
3241
- number += source[index++];
3242
- }
3243
-
3244
- if (number.length === 0) {
3245
- // only 0b or 0B
3246
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3247
- }
3248
-
3249
- if (index < length) {
3250
- ch = source.charCodeAt(index);
3251
- /* istanbul ignore else */
3252
- if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
3253
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
3254
- }
3255
- }
3256
- return {
3257
- type: Token.NumericLiteral,
3258
- value: parseInt(number, 2),
3259
- lineNumber: lineNumber,
3260
- lineStart: lineStart,
3261
- range: [start, index]
3262
- };
3429
+ return scanBinaryLiteral(start);
3263
3430
  }
3264
3431
  if (ch === 'o' || ch === 'O' || isOctalDigit(ch)) {
3265
3432
  return scanOctalLiteral(ch, start);
@@ -3400,7 +3567,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3400
3567
  }
3401
3568
  } else {
3402
3569
  ++lineNumber;
3403
- if (ch === '\r' && source[index] === '\n') {
3570
+ if (ch === '\r' && source[index] === '\n') {
3404
3571
  ++index;
3405
3572
  }
3406
3573
  lineStart = index;
@@ -3517,14 +3684,14 @@ parseYieldExpression: true, parseAwaitExpression: true
3517
3684
  }
3518
3685
  } else {
3519
3686
  ++lineNumber;
3520
- if (ch === '\r' && source[index] === '\n') {
3687
+ if (ch === '\r' && source[index] === '\n') {
3521
3688
  ++index;
3522
3689
  }
3523
3690
  lineStart = index;
3524
3691
  }
3525
3692
  } else if (isLineTerminator(ch.charCodeAt(0))) {
3526
3693
  ++lineNumber;
3527
- if (ch === '\r' && source[index] === '\n') {
3694
+ if (ch === '\r' && source[index] === '\n') {
3528
3695
  ++index;
3529
3696
  }
3530
3697
  lineStart = index;
@@ -3571,39 +3738,77 @@ parseYieldExpression: true, parseAwaitExpression: true
3571
3738
  return template;
3572
3739
  }
3573
3740
 
3574
- function scanRegExp() {
3575
- var str, ch, start, pattern, flags, value, classMarker = false, restore, terminated = false, tmp;
3741
+ function testRegExp(pattern, flags) {
3742
+ var tmp = pattern,
3743
+ value;
3576
3744
 
3577
- lookahead = null;
3578
- skipComment();
3745
+ if (flags.indexOf('u') >= 0) {
3746
+ // Replace each astral symbol and every Unicode code point
3747
+ // escape sequence with a single ASCII symbol to avoid throwing on
3748
+ // regular expressions that are only valid in combination with the
3749
+ // `/u` flag.
3750
+ // Note: replacing with the ASCII symbol `x` might cause false
3751
+ // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
3752
+ // perfectly valid pattern that is equivalent to `[a-b]`, but it
3753
+ // would be replaced by `[x-b]` which throws an error.
3754
+ tmp = tmp
3755
+ .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
3756
+ if (parseInt($1, 16) <= 0x10FFFF) {
3757
+ return 'x';
3758
+ }
3759
+ throwError({}, Messages.InvalidRegExp);
3760
+ })
3761
+ .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
3762
+ }
3763
+
3764
+ // First, detect invalid regular expressions.
3765
+ try {
3766
+ value = new RegExp(tmp);
3767
+ } catch (e) {
3768
+ throwError({}, Messages.InvalidRegExp);
3769
+ }
3770
+
3771
+ // Return a regular expression object for this pattern-flag pair, or
3772
+ // `null` in case the current environment doesn't support the flags it
3773
+ // uses.
3774
+ try {
3775
+ return new RegExp(pattern, flags);
3776
+ } catch (exception) {
3777
+ return null;
3778
+ }
3779
+ }
3780
+
3781
+ function scanRegExpBody() {
3782
+ var ch, str, classMarker, terminated, body;
3579
3783
 
3580
- start = index;
3581
3784
  ch = source[index];
3582
3785
  assert(ch === '/', 'Regular expression literal must start with a slash');
3583
3786
  str = source[index++];
3584
3787
 
3788
+ classMarker = false;
3789
+ terminated = false;
3585
3790
  while (index < length) {
3586
3791
  ch = source[index++];
3587
3792
  str += ch;
3588
- if (classMarker) {
3793
+ if (ch === '\\') {
3794
+ ch = source[index++];
3795
+ // ECMA-262 7.8.5
3796
+ if (isLineTerminator(ch.charCodeAt(0))) {
3797
+ throwError({}, Messages.UnterminatedRegExp);
3798
+ }
3799
+ str += ch;
3800
+ } else if (isLineTerminator(ch.charCodeAt(0))) {
3801
+ throwError({}, Messages.UnterminatedRegExp);
3802
+ } else if (classMarker) {
3589
3803
  if (ch === ']') {
3590
3804
  classMarker = false;
3591
3805
  }
3592
3806
  } else {
3593
- if (ch === '\\') {
3594
- ch = source[index++];
3595
- // ECMA-262 7.8.5
3596
- if (isLineTerminator(ch.charCodeAt(0))) {
3597
- throwError({}, Messages.UnterminatedRegExp);
3598
- }
3599
- str += ch;
3600
- } else if (ch === '/') {
3807
+ if (ch === '/') {
3601
3808
  terminated = true;
3602
3809
  break;
3603
3810
  } else if (ch === '[') {
3604
3811
  classMarker = true;
3605
- } else if (isLineTerminator(ch.charCodeAt(0))) {
3606
- throwError({}, Messages.UnterminatedRegExp);
3607
3812
  }
3608
3813
  }
3609
3814
  }
@@ -3613,8 +3818,17 @@ parseYieldExpression: true, parseAwaitExpression: true
3613
3818
  }
3614
3819
 
3615
3820
  // Exclude leading and trailing slash.
3616
- pattern = str.substr(1, str.length - 2);
3821
+ body = str.substr(1, str.length - 2);
3822
+ return {
3823
+ value: body,
3824
+ literal: str
3825
+ };
3826
+ }
3827
+
3828
+ function scanRegExpFlags() {
3829
+ var ch, str, flags, restore;
3617
3830
 
3831
+ str = '';
3618
3832
  flags = '';
3619
3833
  while (index < length) {
3620
3834
  ch = source[index];
@@ -3629,7 +3843,6 @@ parseYieldExpression: true, parseAwaitExpression: true
3629
3843
  ++index;
3630
3844
  restore = index;
3631
3845
  ch = scanHexEscape('u');
3632
- /* istanbul ignore else */
3633
3846
  if (ch) {
3634
3847
  flags += ch;
3635
3848
  for (str += '\\u'; restore < index; ++restore) {
@@ -3643,6 +3856,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3643
3856
  throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
3644
3857
  } else {
3645
3858
  str += '\\';
3859
+ throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
3646
3860
  }
3647
3861
  } else {
3648
3862
  flags += ch;
@@ -3650,61 +3864,43 @@ parseYieldExpression: true, parseAwaitExpression: true
3650
3864
  }
3651
3865
  }
3652
3866
 
3653
- tmp = pattern;
3654
- if (flags.indexOf('u') >= 0) {
3655
- // Replace each astral symbol and every Unicode code point
3656
- // escape sequence with a single ASCII symbol to avoid throwing on
3657
- // regular expressions that are only valid in combination with the
3658
- // `/u` flag.
3659
- // Note: replacing with the ASCII symbol `x` might cause false
3660
- // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
3661
- // perfectly valid pattern that is equivalent to `[a-b]`, but it
3662
- // would be replaced by `[x-b]` which throws an error.
3663
- tmp = tmp
3664
- .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
3665
- if (parseInt($1, 16) <= 0x10FFFF) {
3666
- return 'x';
3667
- }
3668
- throwError({}, Messages.InvalidRegExp);
3669
- })
3670
- .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
3671
- }
3867
+ return {
3868
+ value: flags,
3869
+ literal: str
3870
+ };
3871
+ }
3672
3872
 
3673
- // First, detect invalid regular expressions.
3674
- try {
3675
- value = new RegExp(tmp);
3676
- } catch (e) {
3677
- throwError({}, Messages.InvalidRegExp);
3678
- }
3873
+ function scanRegExp() {
3874
+ var start, body, flags, value;
3679
3875
 
3680
- // Return a regular expression object for this pattern-flag pair, or
3681
- // `null` in case the current environment doesn't support the flags it
3682
- // uses.
3683
- try {
3684
- value = new RegExp(pattern, flags);
3685
- } catch (exception) {
3686
- value = null;
3687
- }
3876
+ lookahead = null;
3877
+ skipComment();
3878
+ start = index;
3879
+
3880
+ body = scanRegExpBody();
3881
+ flags = scanRegExpFlags();
3882
+ value = testRegExp(body.value, flags.value);
3688
3883
 
3689
3884
  if (extra.tokenize) {
3690
3885
  return {
3691
3886
  type: Token.RegularExpression,
3692
3887
  value: value,
3693
3888
  regex: {
3694
- pattern: pattern,
3695
- flags: flags
3889
+ pattern: body.value,
3890
+ flags: flags.value
3696
3891
  },
3697
3892
  lineNumber: lineNumber,
3698
3893
  lineStart: lineStart,
3699
3894
  range: [start, index]
3700
3895
  };
3701
3896
  }
3897
+
3702
3898
  return {
3703
- literal: str,
3899
+ literal: body.literal + flags.literal,
3704
3900
  value: value,
3705
3901
  regex: {
3706
- pattern: pattern,
3707
- flags: flags
3902
+ pattern: body.value,
3903
+ flags: flags.value
3708
3904
  },
3709
3905
  range: [start, index]
3710
3906
  };
@@ -3771,7 +3967,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3771
3967
  }
3772
3968
  return scanRegExp();
3773
3969
  }
3774
- if (prevToken.type === 'Keyword') {
3970
+ if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
3775
3971
  return scanRegExp();
3776
3972
  }
3777
3973
  return scanPunctuator();
@@ -3780,7 +3976,7 @@ parseYieldExpression: true, parseAwaitExpression: true
3780
3976
  function advance() {
3781
3977
  var ch;
3782
3978
 
3783
- if (!state.inXJSChild) {
3979
+ if (!state.inJSXChild) {
3784
3980
  skipComment();
3785
3981
  }
3786
3982
 
@@ -3793,8 +3989,8 @@ parseYieldExpression: true, parseAwaitExpression: true
3793
3989
  };
3794
3990
  }
3795
3991
 
3796
- if (state.inXJSChild) {
3797
- return advanceXJSChild();
3992
+ if (state.inJSXChild) {
3993
+ return advanceJSXChild();
3798
3994
  }
3799
3995
 
3800
3996
  ch = source.charCodeAt(index);
@@ -3806,14 +4002,14 @@ parseYieldExpression: true, parseAwaitExpression: true
3806
4002
 
3807
4003
  // String literal starts with single quote (#39) or double quote (#34).
3808
4004
  if (ch === 39 || ch === 34) {
3809
- if (state.inXJSTag) {
3810
- return scanXJSStringLiteral();
4005
+ if (state.inJSXTag) {
4006
+ return scanJSXStringLiteral();
3811
4007
  }
3812
4008
  return scanStringLiteral();
3813
4009
  }
3814
4010
 
3815
- if (state.inXJSTag && isXJSIdentifierStart(ch)) {
3816
- return scanXJSIdentifier();
4011
+ if (state.inJSXTag && isJSXIdentifierStart(ch)) {
4012
+ return scanJSXIdentifier();
3817
4013
  }
3818
4014
 
3819
4015
  if (ch === 96) {
@@ -4424,78 +4620,78 @@ parseYieldExpression: true, parseAwaitExpression: true
4424
4620
  };
4425
4621
  },
4426
4622
 
4427
- createXJSAttribute: function (name, value) {
4623
+ createJSXAttribute: function (name, value) {
4428
4624
  return {
4429
- type: Syntax.XJSAttribute,
4625
+ type: Syntax.JSXAttribute,
4430
4626
  name: name,
4431
4627
  value: value || null
4432
4628
  };
4433
4629
  },
4434
4630
 
4435
- createXJSSpreadAttribute: function (argument) {
4631
+ createJSXSpreadAttribute: function (argument) {
4436
4632
  return {
4437
- type: Syntax.XJSSpreadAttribute,
4633
+ type: Syntax.JSXSpreadAttribute,
4438
4634
  argument: argument
4439
4635
  };
4440
4636
  },
4441
4637
 
4442
- createXJSIdentifier: function (name) {
4638
+ createJSXIdentifier: function (name) {
4443
4639
  return {
4444
- type: Syntax.XJSIdentifier,
4640
+ type: Syntax.JSXIdentifier,
4445
4641
  name: name
4446
4642
  };
4447
4643
  },
4448
4644
 
4449
- createXJSNamespacedName: function (namespace, name) {
4645
+ createJSXNamespacedName: function (namespace, name) {
4450
4646
  return {
4451
- type: Syntax.XJSNamespacedName,
4647
+ type: Syntax.JSXNamespacedName,
4452
4648
  namespace: namespace,
4453
4649
  name: name
4454
4650
  };
4455
4651
  },
4456
4652
 
4457
- createXJSMemberExpression: function (object, property) {
4653
+ createJSXMemberExpression: function (object, property) {
4458
4654
  return {
4459
- type: Syntax.XJSMemberExpression,
4655
+ type: Syntax.JSXMemberExpression,
4460
4656
  object: object,
4461
4657
  property: property
4462
4658
  };
4463
4659
  },
4464
4660
 
4465
- createXJSElement: function (openingElement, closingElement, children) {
4661
+ createJSXElement: function (openingElement, closingElement, children) {
4466
4662
  return {
4467
- type: Syntax.XJSElement,
4663
+ type: Syntax.JSXElement,
4468
4664
  openingElement: openingElement,
4469
4665
  closingElement: closingElement,
4470
4666
  children: children
4471
4667
  };
4472
4668
  },
4473
4669
 
4474
- createXJSEmptyExpression: function () {
4670
+ createJSXEmptyExpression: function () {
4475
4671
  return {
4476
- type: Syntax.XJSEmptyExpression
4672
+ type: Syntax.JSXEmptyExpression
4477
4673
  };
4478
4674
  },
4479
4675
 
4480
- createXJSExpressionContainer: function (expression) {
4676
+ createJSXExpressionContainer: function (expression) {
4481
4677
  return {
4482
- type: Syntax.XJSExpressionContainer,
4678
+ type: Syntax.JSXExpressionContainer,
4483
4679
  expression: expression
4484
4680
  };
4485
4681
  },
4486
4682
 
4487
- createXJSOpeningElement: function (name, attributes, selfClosing) {
4683
+ createJSXOpeningElement: function (name, attributes, selfClosing) {
4488
4684
  return {
4489
- type: Syntax.XJSOpeningElement,
4685
+ type: Syntax.JSXOpeningElement,
4490
4686
  name: name,
4491
4687
  selfClosing: selfClosing,
4492
4688
  attributes: attributes
4493
4689
  };
4494
4690
  },
4495
4691
 
4496
- createXJSClosingElement: function (name) {
4692
+ createJSXClosingElement: function (name) {
4497
4693
  return {
4498
- type: Syntax.XJSClosingElement,
4694
+ type: Syntax.JSXClosingElement,
4499
4695
  name: name
4500
4696
  };
4501
4697
  },
@@ -4836,13 +5032,13 @@ parseYieldExpression: true, parseAwaitExpression: true
4836
5032
  };
4837
5033
  },
4838
5034
 
4839
- createExportDeclaration: function (isDefault, declaration, specifiers, source) {
5035
+ createExportDeclaration: function (isDefault, declaration, specifiers, src) {
4840
5036
  return {
4841
5037
  type: Syntax.ExportDeclaration,
4842
5038
  'default': !!isDefault,
4843
5039
  declaration: declaration,
4844
5040
  specifiers: specifiers,
4845
- source: source
5041
+ source: src
4846
5042
  };
4847
5043
  },
4848
5044
 
@@ -4854,20 +5050,20 @@ parseYieldExpression: true, parseAwaitExpression: true
4854
5050
  };
4855
5051
  },
4856
5052
 
4857
- createImportDeclaration: function (specifiers, source, isType) {
5053
+ createImportDeclaration: function (specifiers, src, isType) {
4858
5054
  return {
4859
5055
  type: Syntax.ImportDeclaration,
4860
5056
  specifiers: specifiers,
4861
- source: source,
5057
+ source: src,
4862
5058
  isType: isType
4863
5059
  };
4864
5060
  },
4865
5061
 
4866
- createYieldExpression: function (argument, delegate) {
5062
+ createYieldExpression: function (argument, dlg) {
4867
5063
  return {
4868
5064
  type: Syntax.YieldExpression,
4869
5065
  argument: argument,
4870
- delegate: delegate
5066
+ delegate: dlg
4871
5067
  };
4872
5068
  },
4873
5069
 
@@ -4913,9 +5109,9 @@ parseYieldExpression: true, parseAwaitExpression: true
4913
5109
  args = Array.prototype.slice.call(arguments, 2),
4914
5110
  msg = messageFormat.replace(
4915
5111
  /%(\d)/g,
4916
- function (whole, index) {
4917
- assert(index < args.length, 'Message reference must be in range');
4918
- return args[index];
5112
+ function (whole, idx) {
5113
+ assert(idx < args.length, 'Message reference must be in range');
5114
+ return args[idx];
4919
5115
  }
4920
5116
  );
4921
5117
 
@@ -4959,7 +5155,7 @@ parseYieldExpression: true, parseAwaitExpression: true
4959
5155
  throwError(token, Messages.UnexpectedNumber);
4960
5156
  }
4961
5157
 
4962
- if (token.type === Token.StringLiteral || token.type === Token.XJSText) {
5158
+ if (token.type === Token.StringLiteral || token.type === Token.JSXText) {
4963
5159
  throwError(token, Messages.UnexpectedString);
4964
5160
  }
4965
5161
 
@@ -5122,7 +5318,7 @@ parseYieldExpression: true, parseAwaitExpression: true
5122
5318
  // 11.1.4 Array Initialiser
5123
5319
 
5124
5320
  function parseArrayInitialiser() {
5125
- var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true, body,
5321
+ var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true,
5126
5322
  marker = markerCreate();
5127
5323
 
5128
5324
  expect('[');
@@ -5278,7 +5474,7 @@ parseYieldExpression: true, parseAwaitExpression: true
5278
5474
  }
5279
5475
 
5280
5476
  function parseObjectProperty() {
5281
- var token, key, id, value, param, expr, computed,
5477
+ var token, key, id, param, computed,
5282
5478
  marker = markerCreate(), returnType, typeParameters;
5283
5479
 
5284
5480
  token = lookahead;
@@ -5684,7 +5880,7 @@ parseYieldExpression: true, parseAwaitExpression: true
5684
5880
  }
5685
5881
 
5686
5882
  if (match('<')) {
5687
- return parseXJSElement();
5883
+ return parseJSXElement();
5688
5884
  }
5689
5885
 
5690
5886
  throwUnexpected(lex());
@@ -6332,9 +6528,7 @@ parseYieldExpression: true, parseAwaitExpression: true
6332
6528
  // 11.14 Comma Operator
6333
6529
 
6334
6530
  function parseExpression() {
6335
- var marker, expr, expressions, sequence, coverFormalsList, spreadFound, oldParenthesizedCount;
6336
-
6337
- oldParenthesizedCount = state.parenthesizedCount;
6531
+ var marker, expr, expressions, sequence, spreadFound;
6338
6532
 
6339
6533
  marker = markerCreate();
6340
6534
  expr = parseAssignmentExpression();
@@ -6408,7 +6602,7 @@ parseYieldExpression: true, parseAwaitExpression: true
6408
6602
 
6409
6603
  expect('<');
6410
6604
  while (!match('>')) {
6411
- paramTypes.push(parseVariableIdentifier());
6605
+ paramTypes.push(parseTypeAnnotatableIdentifier());
6412
6606
  if (!match('>')) {
6413
6607
  expect(',');
6414
6608
  }
@@ -6512,7 +6706,7 @@ parseYieldExpression: true, parseAwaitExpression: true
6512
6706
 
6513
6707
  function parseObjectType(allowStatic) {
6514
6708
  var callProperties = [], indexers = [], marker, optional = false,
6515
- properties = [], property, propertyKey, propertyTypeAnnotation,
6709
+ properties = [], propertyKey, propertyTypeAnnotation,
6516
6710
  token, isStatic, matchStatic;
6517
6711
 
6518
6712
  expect('{');
@@ -6576,9 +6770,8 @@ parseYieldExpression: true, parseAwaitExpression: true
6576
6770
  }
6577
6771
 
6578
6772
  function parseGenericType() {
6579
- var marker = markerCreate(), returnType = null,
6580
- typeParameters = null, typeIdentifier,
6581
- typeIdentifierMarker = markerCreate;
6773
+ var marker = markerCreate(),
6774
+ typeParameters = null, typeIdentifier;
6582
6775
 
6583
6776
  typeIdentifier = parseVariableIdentifier();
6584
6777
 
@@ -6668,7 +6861,7 @@ parseYieldExpression: true, parseAwaitExpression: true
6668
6861
  // primary types are kind of like primary expressions...they're the
6669
6862
  // primitives with which other types are constructed.
6670
6863
  function parsePrimaryType() {
6671
- var typeIdentifier = null, params = null, returnType = null,
6864
+ var params = null, returnType = null,
6672
6865
  marker = markerCreate(), rest = null, tmp,
6673
6866
  typeParameters, token, type, isGroupedType = false;
6674
6867
 
@@ -6914,7 +7107,7 @@ parseYieldExpression: true, parseAwaitExpression: true
6914
7107
 
6915
7108
  if (kind === 'const') {
6916
7109
  if (!match('=')) {
6917
- throwError({}, Messages.NoUnintializedConst);
7110
+ throwError({}, Messages.NoUninitializedConst);
6918
7111
  }
6919
7112
  expect('=');
6920
7113
  init = parseAssignmentExpression();
@@ -7006,7 +7199,8 @@ parseYieldExpression: true, parseAwaitExpression: true
7006
7199
  }
7007
7200
 
7008
7201
  function parseExportDeclaration() {
7009
- var backtrackToken, id, previousAllowKeyword, declaration = null,
7202
+ var declaration = null,
7203
+ possibleIdentifierToken, sourceElement,
7010
7204
  isExportFromIdentifier,
7011
7205
  src = null, specifiers = [],
7012
7206
  marker = markerCreate();
@@ -7018,20 +7212,17 @@ parseYieldExpression: true, parseAwaitExpression: true
7018
7212
  // export default ...
7019
7213
  lex();
7020
7214
  if (matchKeyword('function') || matchKeyword('class')) {
7021
- backtrackToken = lookahead;
7022
- lex();
7023
- if (isIdentifierName(lookahead)) {
7215
+ possibleIdentifierToken = lookahead2();
7216
+ if (isIdentifierName(possibleIdentifierToken)) {
7024
7217
  // covers:
7025
7218
  // export default function foo () {}
7026
7219
  // export default class foo {}
7027
- id = parseNonComputedProperty();
7028
- rewind(backtrackToken);
7029
- return markerApply(marker, delegate.createExportDeclaration(true, parseSourceElement(), [id], null));
7220
+ sourceElement = parseSourceElement();
7221
+ return markerApply(marker, delegate.createExportDeclaration(true, sourceElement, [sourceElement.id], null));
7030
7222
  }
7031
7223
  // covers:
7032
7224
  // export default function () {}
7033
7225
  // export default class {}
7034
- rewind(backtrackToken);
7035
7226
  switch (lookahead.value) {
7036
7227
  case 'class':
7037
7228
  return markerApply(marker, delegate.createExportDeclaration(true, parseClassExpression(), [], null));
@@ -7789,7 +7980,7 @@ parseYieldExpression: true, parseAwaitExpression: true
7789
7980
 
7790
7981
  state.labelSet.set(expr.name, true);
7791
7982
  labeledBody = parseStatement();
7792
- state.labelSet['delete'](expr.name);
7983
+ state.labelSet["delete"](expr.name);
7793
7984
  return markerApply(marker, delegate.createLabeledStatement(expr, labeledBody));
7794
7985
  }
7795
7986
 
@@ -8190,55 +8381,25 @@ parseYieldExpression: true, parseAwaitExpression: true
8190
8381
  return markerApply(marker, delegate.createAwaitExpression(expr));
8191
8382
  }
8192
8383
 
8193
- // 14 Classes
8384
+ // 14 Functions and classes
8194
8385
 
8195
- function validateDuplicateProp(propMap, key, accessor) {
8196
- var propInfo, reversed, name, isValidDuplicateProp;
8386
+ // 14.1 Functions is defined above (13 in ES5)
8387
+ // 14.2 Arrow Functions Definitions is defined in (7.3 assignments)
8197
8388
 
8198
- name = getFieldName(key);
8199
-
8200
- if (propMap.has(name)) {
8201
- propInfo = propMap.get(name);
8202
- if (accessor === 'data') {
8203
- isValidDuplicateProp = false;
8204
- } else {
8205
- if (accessor === 'get') {
8206
- reversed = 'set';
8207
- } else {
8208
- reversed = 'get';
8209
- }
8210
-
8211
- isValidDuplicateProp =
8212
- // There isn't already a specified accessor for this prop
8213
- propInfo[accessor] === undefined
8214
- // There isn't already a data prop by this name
8215
- && propInfo.data === undefined
8216
- // The only existing prop by this name is a reversed accessor
8217
- && propInfo[reversed] !== undefined;
8218
- }
8219
- if (!isValidDuplicateProp) {
8220
- throwError(key, Messages.IllegalDuplicateClassProperty);
8221
- }
8222
- } else {
8223
- propInfo = {
8224
- get: undefined,
8225
- set: undefined,
8226
- data: undefined
8227
- };
8228
- propMap.set(name, propInfo);
8229
- }
8230
- propInfo[accessor] = true;
8389
+ // 14.3 Method Definitions
8390
+ // 14.3.7
8391
+ function specialMethod(methodDefinition) {
8392
+ return methodDefinition.kind === 'get' ||
8393
+ methodDefinition.kind === 'set' ||
8394
+ methodDefinition.value.generator;
8231
8395
  }
8232
8396
 
8233
- function parseMethodDefinition(existingPropNames, key, isStatic, generator, computed) {
8234
- var token, param, propType, isValidDuplicateProp = false,
8235
- isAsync, typeParameters, tokenValue, returnType,
8236
- annotationMarker, propMap;
8397
+ function parseMethodDefinition(key, isStatic, generator, computed) {
8398
+ var token, param, propType,
8399
+ isAsync, typeParameters, tokenValue, returnType;
8237
8400
 
8238
8401
  propType = isStatic ? ClassPropertyType["static"] : ClassPropertyType.prototype;
8239
8402
 
8240
- propMap = existingPropNames[propType];
8241
-
8242
8403
  if (generator) {
8243
8404
  return delegate.createMethodDefinition(
8244
8405
  propType,
@@ -8254,12 +8415,6 @@ parseYieldExpression: true, parseAwaitExpression: true
8254
8415
  if (tokenValue === 'get' && !match('(')) {
8255
8416
  key = parseObjectPropertyKey();
8256
8417
 
8257
- // It is a syntax error if any other properties have a name
8258
- // duplicating this one unless they are a setter
8259
- if (!computed) {
8260
- validateDuplicateProp(propMap, key, 'get');
8261
- }
8262
-
8263
8418
  expect('(');
8264
8419
  expect(')');
8265
8420
  if (match(':')) {
@@ -8276,12 +8431,6 @@ parseYieldExpression: true, parseAwaitExpression: true
8276
8431
  if (tokenValue === 'set' && !match('(')) {
8277
8432
  key = parseObjectPropertyKey();
8278
8433
 
8279
- // It is a syntax error if any other properties have a name
8280
- // duplicating this one unless they are a getter
8281
- if (!computed) {
8282
- validateDuplicateProp(propMap, key, 'set');
8283
- }
8284
-
8285
8434
  expect('(');
8286
8435
  token = lookahead;
8287
8436
  param = [ parseTypeAnnotatableIdentifier() ];
@@ -8312,12 +8461,6 @@ parseYieldExpression: true, parseAwaitExpression: true
8312
8461
  key = parseObjectPropertyKey();
8313
8462
  }
8314
8463
 
8315
- // It is a syntax error if any other properties have the same name as a
8316
- // non-getter, non-setter method
8317
- if (!computed) {
8318
- validateDuplicateProp(propMap, key, 'data');
8319
- }
8320
-
8321
8464
  return delegate.createMethodDefinition(
8322
8465
  propType,
8323
8466
  '',
@@ -8331,7 +8474,7 @@ parseYieldExpression: true, parseAwaitExpression: true
8331
8474
  );
8332
8475
  }
8333
8476
 
8334
- function parseClassProperty(existingPropNames, key, computed, isStatic) {
8477
+ function parseClassProperty(key, computed, isStatic) {
8335
8478
  var typeAnnotation;
8336
8479
 
8337
8480
  typeAnnotation = parseTypeAnnotation();
@@ -8345,12 +8488,12 @@ parseYieldExpression: true, parseAwaitExpression: true
8345
8488
  );
8346
8489
  }
8347
8490
 
8348
- function parseClassElement(existingProps) {
8491
+ function parseClassElement() {
8349
8492
  var computed = false, generator = false, key, marker = markerCreate(),
8350
8493
  isStatic = false, possiblyOpenBracketToken;
8351
8494
  if (match(';')) {
8352
8495
  lex();
8353
- return;
8496
+ return undefined;
8354
8497
  }
8355
8498
 
8356
8499
  if (lookahead.value === 'static') {
@@ -8376,11 +8519,10 @@ parseYieldExpression: true, parseAwaitExpression: true
8376
8519
  key = parseObjectPropertyKey();
8377
8520
 
8378
8521
  if (!generator && lookahead.value === ':') {
8379
- return markerApply(marker, parseClassProperty(existingProps, key, computed, isStatic));
8522
+ return markerApply(marker, parseClassProperty(key, computed, isStatic));
8380
8523
  }
8381
8524
 
8382
8525
  return markerApply(marker, parseMethodDefinition(
8383
- existingProps,
8384
8526
  key,
8385
8527
  isStatic,
8386
8528
  generator,
@@ -8389,7 +8531,8 @@ parseYieldExpression: true, parseAwaitExpression: true
8389
8531
  }
8390
8532
 
8391
8533
  function parseClassBody() {
8392
- var classElement, classElements = [], existingProps = {}, marker = markerCreate();
8534
+ var classElement, classElements = [], existingProps = {},
8535
+ marker = markerCreate(), propName, propType;
8393
8536
 
8394
8537
  existingProps[ClassPropertyType["static"]] = new StringMap();
8395
8538
  existingProps[ClassPropertyType.prototype] = new StringMap();
@@ -8404,6 +8547,25 @@ parseYieldExpression: true, parseAwaitExpression: true
8404
8547
 
8405
8548
  if (typeof classElement !== 'undefined') {
8406
8549
  classElements.push(classElement);
8550
+
8551
+ propName = !classElement.computed && getFieldName(classElement.key);
8552
+ if (propName !== false) {
8553
+ propType = classElement["static"] ?
8554
+ ClassPropertyType["static"] :
8555
+ ClassPropertyType.prototype;
8556
+
8557
+ if (classElement.type === Syntax.MethodDefinition) {
8558
+ if (propName === 'constructor' && !classElement["static"]) {
8559
+ if (specialMethod(classElement)) {
8560
+ throwError(classElement, Messages.IllegalClassConstructorProperty);
8561
+ }
8562
+ if (existingProps[ClassPropertyType.prototype].has('constructor')) {
8563
+ throwError(classElement.key, Messages.IllegalDuplicateClassProperty);
8564
+ }
8565
+ }
8566
+ existingProps[propType].set(propName, true);
8567
+ }
8568
+ }
8407
8569
  }
8408
8570
  }
8409
8571
 
@@ -8641,164 +8803,7 @@ parseYieldExpression: true, parseAwaitExpression: true
8641
8803
  return markerApply(marker, delegate.createProgram(body));
8642
8804
  }
8643
8805
 
8644
- // The following functions are needed only when the option to preserve
8645
- // the comments is active.
8646
-
8647
- function addComment(type, value, start, end, loc) {
8648
- var comment;
8649
-
8650
- assert(typeof start === 'number', 'Comment must have valid position');
8651
-
8652
- // Because the way the actual token is scanned, often the comments
8653
- // (if any) are skipped twice during the lexical analysis.
8654
- // Thus, we need to skip adding a comment if the comment array already
8655
- // handled it.
8656
- if (state.lastCommentStart >= start) {
8657
- return;
8658
- }
8659
- state.lastCommentStart = start;
8660
-
8661
- comment = {
8662
- type: type,
8663
- value: value
8664
- };
8665
- if (extra.range) {
8666
- comment.range = [start, end];
8667
- }
8668
- if (extra.loc) {
8669
- comment.loc = loc;
8670
- }
8671
- extra.comments.push(comment);
8672
- if (extra.attachComment) {
8673
- extra.leadingComments.push(comment);
8674
- extra.trailingComments.push(comment);
8675
- }
8676
- }
8677
-
8678
- function scanComment() {
8679
- var comment, ch, loc, start, blockComment, lineComment;
8680
-
8681
- comment = '';
8682
- blockComment = false;
8683
- lineComment = false;
8684
-
8685
- while (index < length) {
8686
- ch = source[index];
8687
-
8688
- if (lineComment) {
8689
- ch = source[index++];
8690
- if (isLineTerminator(ch.charCodeAt(0))) {
8691
- loc.end = {
8692
- line: lineNumber,
8693
- column: index - lineStart - 1
8694
- };
8695
- lineComment = false;
8696
- addComment('Line', comment, start, index - 1, loc);
8697
- if (ch === '\r' && source[index] === '\n') {
8698
- ++index;
8699
- }
8700
- ++lineNumber;
8701
- lineStart = index;
8702
- comment = '';
8703
- } else if (index >= length) {
8704
- lineComment = false;
8705
- comment += ch;
8706
- loc.end = {
8707
- line: lineNumber,
8708
- column: length - lineStart
8709
- };
8710
- addComment('Line', comment, start, length, loc);
8711
- } else {
8712
- comment += ch;
8713
- }
8714
- } else if (blockComment) {
8715
- if (isLineTerminator(ch.charCodeAt(0))) {
8716
- if (ch === '\r') {
8717
- ++index;
8718
- comment += '\r';
8719
- }
8720
- if (ch !== '\r' || source[index] === '\n') {
8721
- comment += source[index];
8722
- ++lineNumber;
8723
- ++index;
8724
- lineStart = index;
8725
- if (index >= length) {
8726
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
8727
- }
8728
- }
8729
- } else {
8730
- ch = source[index++];
8731
- if (index >= length) {
8732
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
8733
- }
8734
- comment += ch;
8735
- if (ch === '*') {
8736
- ch = source[index];
8737
- if (ch === '/') {
8738
- comment = comment.substr(0, comment.length - 1);
8739
- blockComment = false;
8740
- ++index;
8741
- loc.end = {
8742
- line: lineNumber,
8743
- column: index - lineStart
8744
- };
8745
- addComment('Block', comment, start, index, loc);
8746
- comment = '';
8747
- }
8748
- }
8749
- }
8750
- } else if (ch === '/') {
8751
- ch = source[index + 1];
8752
- if (ch === '/') {
8753
- loc = {
8754
- start: {
8755
- line: lineNumber,
8756
- column: index - lineStart
8757
- }
8758
- };
8759
- start = index;
8760
- index += 2;
8761
- lineComment = true;
8762
- if (index >= length) {
8763
- loc.end = {
8764
- line: lineNumber,
8765
- column: index - lineStart
8766
- };
8767
- lineComment = false;
8768
- addComment('Line', comment, start, index, loc);
8769
- }
8770
- } else if (ch === '*') {
8771
- start = index;
8772
- index += 2;
8773
- blockComment = true;
8774
- loc = {
8775
- start: {
8776
- line: lineNumber,
8777
- column: index - lineStart - 2
8778
- }
8779
- };
8780
- if (index >= length) {
8781
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
8782
- }
8783
- } else {
8784
- break;
8785
- }
8786
- } else if (isWhiteSpace(ch.charCodeAt(0))) {
8787
- ++index;
8788
- } else if (isLineTerminator(ch.charCodeAt(0))) {
8789
- ++index;
8790
- if (ch === '\r' && source[index] === '\n') {
8791
- ++index;
8792
- }
8793
- ++lineNumber;
8794
- lineStart = index;
8795
- } else {
8796
- break;
8797
- }
8798
- }
8799
- }
8800
-
8801
- // 16 XJS
8806
+ // 16 JSX
8802
8807
 
8803
8808
  XHTMLEntities = {
8804
8809
  quot: '\u0022',
@@ -9056,48 +9061,48 @@ parseYieldExpression: true, parseAwaitExpression: true
9056
9061
  diams: '\u2666'
9057
9062
  };
9058
9063
 
9059
- function getQualifiedXJSName(object) {
9060
- if (object.type === Syntax.XJSIdentifier) {
9064
+ function getQualifiedJSXName(object) {
9065
+ if (object.type === Syntax.JSXIdentifier) {
9061
9066
  return object.name;
9062
9067
  }
9063
- if (object.type === Syntax.XJSNamespacedName) {
9068
+ if (object.type === Syntax.JSXNamespacedName) {
9064
9069
  return object.namespace.name + ':' + object.name.name;
9065
9070
  }
9066
9071
  /* istanbul ignore else */
9067
- if (object.type === Syntax.XJSMemberExpression) {
9072
+ if (object.type === Syntax.JSXMemberExpression) {
9068
9073
  return (
9069
- getQualifiedXJSName(object.object) + '.' +
9070
- getQualifiedXJSName(object.property)
9074
+ getQualifiedJSXName(object.object) + '.' +
9075
+ getQualifiedJSXName(object.property)
9071
9076
  );
9072
9077
  }
9073
9078
  /* istanbul ignore next */
9074
9079
  throwUnexpected(object);
9075
9080
  }
9076
9081
 
9077
- function isXJSIdentifierStart(ch) {
9082
+ function isJSXIdentifierStart(ch) {
9078
9083
  // exclude backslash (\)
9079
9084
  return (ch !== 92) && isIdentifierStart(ch);
9080
9085
  }
9081
9086
 
9082
- function isXJSIdentifierPart(ch) {
9087
+ function isJSXIdentifierPart(ch) {
9083
9088
  // exclude backslash (\) and add hyphen (-)
9084
9089
  return (ch !== 92) && (ch === 45 || isIdentifierPart(ch));
9085
9090
  }
9086
9091
 
9087
- function scanXJSIdentifier() {
9092
+ function scanJSXIdentifier() {
9088
9093
  var ch, start, value = '';
9089
9094
 
9090
9095
  start = index;
9091
9096
  while (index < length) {
9092
9097
  ch = source.charCodeAt(index);
9093
- if (!isXJSIdentifierPart(ch)) {
9098
+ if (!isJSXIdentifierPart(ch)) {
9094
9099
  break;
9095
9100
  }
9096
9101
  value += source[index++];
9097
9102
  }
9098
9103
 
9099
9104
  return {
9100
- type: Token.XJSIdentifier,
9105
+ type: Token.JSXIdentifier,
9101
9106
  value: value,
9102
9107
  lineNumber: lineNumber,
9103
9108
  lineStart: lineStart,
@@ -9105,7 +9110,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9105
9110
  };
9106
9111
  }
9107
9112
 
9108
- function scanXJSEntity() {
9113
+ function scanJSXEntity() {
9109
9114
  var ch, str = '', start = index, count = 0, code;
9110
9115
  ch = source[index];
9111
9116
  assert(ch === '&', 'Entity must start with an ampersand');
@@ -9143,7 +9148,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9143
9148
  return '&';
9144
9149
  }
9145
9150
 
9146
- function scanXJSText(stopChars) {
9151
+ function scanJSXText(stopChars) {
9147
9152
  var ch, str = '', start;
9148
9153
  start = index;
9149
9154
  while (index < length) {
@@ -9152,7 +9157,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9152
9157
  break;
9153
9158
  }
9154
9159
  if (ch === '&') {
9155
- str += scanXJSEntity();
9160
+ str += scanJSXEntity();
9156
9161
  } else {
9157
9162
  index++;
9158
9163
  if (ch === '\r' && source[index] === '\n') {
@@ -9168,7 +9173,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9168
9173
  }
9169
9174
  }
9170
9175
  return {
9171
- type: Token.XJSText,
9176
+ type: Token.JSXText,
9172
9177
  value: str,
9173
9178
  lineNumber: lineNumber,
9174
9179
  lineStart: lineStart,
@@ -9176,7 +9181,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9176
9181
  };
9177
9182
  }
9178
9183
 
9179
- function scanXJSStringLiteral() {
9184
+ function scanJSXStringLiteral() {
9180
9185
  var innerToken, quote, start;
9181
9186
 
9182
9187
  quote = source[index];
@@ -9186,7 +9191,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9186
9191
  start = index;
9187
9192
  ++index;
9188
9193
 
9189
- innerToken = scanXJSText([quote]);
9194
+ innerToken = scanJSXText([quote]);
9190
9195
 
9191
9196
  if (quote !== source[index]) {
9192
9197
  throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
@@ -9200,256 +9205,256 @@ parseYieldExpression: true, parseAwaitExpression: true
9200
9205
  }
9201
9206
 
9202
9207
  /**
9203
- * Between XJS opening and closing tags (e.g. <foo>HERE</foo>), anything that
9204
- * is not another XJS tag and is not an expression wrapped by {} is text.
9208
+ * Between JSX opening and closing tags (e.g. <foo>HERE</foo>), anything that
9209
+ * is not another JSX tag and is not an expression wrapped by {} is text.
9205
9210
  */
9206
- function advanceXJSChild() {
9211
+ function advanceJSXChild() {
9207
9212
  var ch = source.charCodeAt(index);
9208
9213
 
9209
9214
  // '<' 60, '>' 62, '{' 123, '}' 125
9210
9215
  if (ch !== 60 && ch !== 62 && ch !== 123 && ch !== 125) {
9211
- return scanXJSText(['<', '>', '{', '}']);
9216
+ return scanJSXText(['<', '>', '{', '}']);
9212
9217
  }
9213
9218
 
9214
9219
  return scanPunctuator();
9215
9220
  }
9216
9221
 
9217
- function parseXJSIdentifier() {
9222
+ function parseJSXIdentifier() {
9218
9223
  var token, marker = markerCreate();
9219
9224
 
9220
- if (lookahead.type !== Token.XJSIdentifier) {
9225
+ if (lookahead.type !== Token.JSXIdentifier) {
9221
9226
  throwUnexpected(lookahead);
9222
9227
  }
9223
9228
 
9224
9229
  token = lex();
9225
- return markerApply(marker, delegate.createXJSIdentifier(token.value));
9230
+ return markerApply(marker, delegate.createJSXIdentifier(token.value));
9226
9231
  }
9227
9232
 
9228
- function parseXJSNamespacedName() {
9233
+ function parseJSXNamespacedName() {
9229
9234
  var namespace, name, marker = markerCreate();
9230
9235
 
9231
- namespace = parseXJSIdentifier();
9236
+ namespace = parseJSXIdentifier();
9232
9237
  expect(':');
9233
- name = parseXJSIdentifier();
9238
+ name = parseJSXIdentifier();
9234
9239
 
9235
- return markerApply(marker, delegate.createXJSNamespacedName(namespace, name));
9240
+ return markerApply(marker, delegate.createJSXNamespacedName(namespace, name));
9236
9241
  }
9237
9242
 
9238
- function parseXJSMemberExpression() {
9243
+ function parseJSXMemberExpression() {
9239
9244
  var marker = markerCreate(),
9240
- expr = parseXJSIdentifier();
9245
+ expr = parseJSXIdentifier();
9241
9246
 
9242
9247
  while (match('.')) {
9243
9248
  lex();
9244
- expr = markerApply(marker, delegate.createXJSMemberExpression(expr, parseXJSIdentifier()));
9249
+ expr = markerApply(marker, delegate.createJSXMemberExpression(expr, parseJSXIdentifier()));
9245
9250
  }
9246
9251
 
9247
9252
  return expr;
9248
9253
  }
9249
9254
 
9250
- function parseXJSElementName() {
9255
+ function parseJSXElementName() {
9251
9256
  if (lookahead2().value === ':') {
9252
- return parseXJSNamespacedName();
9257
+ return parseJSXNamespacedName();
9253
9258
  }
9254
9259
  if (lookahead2().value === '.') {
9255
- return parseXJSMemberExpression();
9260
+ return parseJSXMemberExpression();
9256
9261
  }
9257
9262
 
9258
- return parseXJSIdentifier();
9263
+ return parseJSXIdentifier();
9259
9264
  }
9260
9265
 
9261
- function parseXJSAttributeName() {
9266
+ function parseJSXAttributeName() {
9262
9267
  if (lookahead2().value === ':') {
9263
- return parseXJSNamespacedName();
9268
+ return parseJSXNamespacedName();
9264
9269
  }
9265
9270
 
9266
- return parseXJSIdentifier();
9271
+ return parseJSXIdentifier();
9267
9272
  }
9268
9273
 
9269
- function parseXJSAttributeValue() {
9274
+ function parseJSXAttributeValue() {
9270
9275
  var value, marker;
9271
9276
  if (match('{')) {
9272
- value = parseXJSExpressionContainer();
9273
- if (value.expression.type === Syntax.XJSEmptyExpression) {
9277
+ value = parseJSXExpressionContainer();
9278
+ if (value.expression.type === Syntax.JSXEmptyExpression) {
9274
9279
  throwError(
9275
9280
  value,
9276
- 'XJS attributes must only be assigned a non-empty ' +
9281
+ 'JSX attributes must only be assigned a non-empty ' +
9277
9282
  'expression'
9278
9283
  );
9279
9284
  }
9280
9285
  } else if (match('<')) {
9281
- value = parseXJSElement();
9282
- } else if (lookahead.type === Token.XJSText) {
9286
+ value = parseJSXElement();
9287
+ } else if (lookahead.type === Token.JSXText) {
9283
9288
  marker = markerCreate();
9284
9289
  value = markerApply(marker, delegate.createLiteral(lex()));
9285
9290
  } else {
9286
- throwError({}, Messages.InvalidXJSAttributeValue);
9291
+ throwError({}, Messages.InvalidJSXAttributeValue);
9287
9292
  }
9288
9293
  return value;
9289
9294
  }
9290
9295
 
9291
- function parseXJSEmptyExpression() {
9296
+ function parseJSXEmptyExpression() {
9292
9297
  var marker = markerCreatePreserveWhitespace();
9293
9298
  while (source.charAt(index) !== '}') {
9294
9299
  index++;
9295
9300
  }
9296
- return markerApply(marker, delegate.createXJSEmptyExpression());
9301
+ return markerApply(marker, delegate.createJSXEmptyExpression());
9297
9302
  }
9298
9303
 
9299
- function parseXJSExpressionContainer() {
9300
- var expression, origInXJSChild, origInXJSTag, marker = markerCreate();
9304
+ function parseJSXExpressionContainer() {
9305
+ var expression, origInJSXChild, origInJSXTag, marker = markerCreate();
9301
9306
 
9302
- origInXJSChild = state.inXJSChild;
9303
- origInXJSTag = state.inXJSTag;
9304
- state.inXJSChild = false;
9305
- state.inXJSTag = false;
9307
+ origInJSXChild = state.inJSXChild;
9308
+ origInJSXTag = state.inJSXTag;
9309
+ state.inJSXChild = false;
9310
+ state.inJSXTag = false;
9306
9311
 
9307
9312
  expect('{');
9308
9313
 
9309
9314
  if (match('}')) {
9310
- expression = parseXJSEmptyExpression();
9315
+ expression = parseJSXEmptyExpression();
9311
9316
  } else {
9312
9317
  expression = parseExpression();
9313
9318
  }
9314
9319
 
9315
- state.inXJSChild = origInXJSChild;
9316
- state.inXJSTag = origInXJSTag;
9320
+ state.inJSXChild = origInJSXChild;
9321
+ state.inJSXTag = origInJSXTag;
9317
9322
 
9318
9323
  expect('}');
9319
9324
 
9320
- return markerApply(marker, delegate.createXJSExpressionContainer(expression));
9325
+ return markerApply(marker, delegate.createJSXExpressionContainer(expression));
9321
9326
  }
9322
9327
 
9323
- function parseXJSSpreadAttribute() {
9324
- var expression, origInXJSChild, origInXJSTag, marker = markerCreate();
9328
+ function parseJSXSpreadAttribute() {
9329
+ var expression, origInJSXChild, origInJSXTag, marker = markerCreate();
9325
9330
 
9326
- origInXJSChild = state.inXJSChild;
9327
- origInXJSTag = state.inXJSTag;
9328
- state.inXJSChild = false;
9329
- state.inXJSTag = false;
9331
+ origInJSXChild = state.inJSXChild;
9332
+ origInJSXTag = state.inJSXTag;
9333
+ state.inJSXChild = false;
9334
+ state.inJSXTag = false;
9330
9335
 
9331
9336
  expect('{');
9332
9337
  expect('...');
9333
9338
 
9334
9339
  expression = parseAssignmentExpression();
9335
9340
 
9336
- state.inXJSChild = origInXJSChild;
9337
- state.inXJSTag = origInXJSTag;
9341
+ state.inJSXChild = origInJSXChild;
9342
+ state.inJSXTag = origInJSXTag;
9338
9343
 
9339
9344
  expect('}');
9340
9345
 
9341
- return markerApply(marker, delegate.createXJSSpreadAttribute(expression));
9346
+ return markerApply(marker, delegate.createJSXSpreadAttribute(expression));
9342
9347
  }
9343
9348
 
9344
- function parseXJSAttribute() {
9349
+ function parseJSXAttribute() {
9345
9350
  var name, marker;
9346
9351
 
9347
9352
  if (match('{')) {
9348
- return parseXJSSpreadAttribute();
9353
+ return parseJSXSpreadAttribute();
9349
9354
  }
9350
9355
 
9351
9356
  marker = markerCreate();
9352
9357
 
9353
- name = parseXJSAttributeName();
9358
+ name = parseJSXAttributeName();
9354
9359
 
9355
9360
  // HTML empty attribute
9356
9361
  if (match('=')) {
9357
9362
  lex();
9358
- return markerApply(marker, delegate.createXJSAttribute(name, parseXJSAttributeValue()));
9363
+ return markerApply(marker, delegate.createJSXAttribute(name, parseJSXAttributeValue()));
9359
9364
  }
9360
9365
 
9361
- return markerApply(marker, delegate.createXJSAttribute(name));
9366
+ return markerApply(marker, delegate.createJSXAttribute(name));
9362
9367
  }
9363
9368
 
9364
- function parseXJSChild() {
9369
+ function parseJSXChild() {
9365
9370
  var token, marker;
9366
9371
  if (match('{')) {
9367
- token = parseXJSExpressionContainer();
9368
- } else if (lookahead.type === Token.XJSText) {
9372
+ token = parseJSXExpressionContainer();
9373
+ } else if (lookahead.type === Token.JSXText) {
9369
9374
  marker = markerCreatePreserveWhitespace();
9370
9375
  token = markerApply(marker, delegate.createLiteral(lex()));
9371
9376
  } else if (match('<')) {
9372
- token = parseXJSElement();
9377
+ token = parseJSXElement();
9373
9378
  } else {
9374
9379
  throwUnexpected(lookahead);
9375
9380
  }
9376
9381
  return token;
9377
9382
  }
9378
9383
 
9379
- function parseXJSClosingElement() {
9380
- var name, origInXJSChild, origInXJSTag, marker = markerCreate();
9381
- origInXJSChild = state.inXJSChild;
9382
- origInXJSTag = state.inXJSTag;
9383
- state.inXJSChild = false;
9384
- state.inXJSTag = true;
9384
+ function parseJSXClosingElement() {
9385
+ var name, origInJSXChild, origInJSXTag, marker = markerCreate();
9386
+ origInJSXChild = state.inJSXChild;
9387
+ origInJSXTag = state.inJSXTag;
9388
+ state.inJSXChild = false;
9389
+ state.inJSXTag = true;
9385
9390
  expect('<');
9386
9391
  expect('/');
9387
- name = parseXJSElementName();
9392
+ name = parseJSXElementName();
9388
9393
  // Because advance() (called by lex() called by expect()) expects there
9389
9394
  // to be a valid token after >, it needs to know whether to look for a
9390
- // standard JS token or an XJS text node
9391
- state.inXJSChild = origInXJSChild;
9392
- state.inXJSTag = origInXJSTag;
9395
+ // standard JS token or an JSX text node
9396
+ state.inJSXChild = origInJSXChild;
9397
+ state.inJSXTag = origInJSXTag;
9393
9398
  expect('>');
9394
- return markerApply(marker, delegate.createXJSClosingElement(name));
9399
+ return markerApply(marker, delegate.createJSXClosingElement(name));
9395
9400
  }
9396
9401
 
9397
- function parseXJSOpeningElement() {
9398
- var name, attribute, attributes = [], selfClosing = false, origInXJSChild, origInXJSTag, marker = markerCreate();
9402
+ function parseJSXOpeningElement() {
9403
+ var name, attributes = [], selfClosing = false, origInJSXChild, origInJSXTag, marker = markerCreate();
9399
9404
 
9400
- origInXJSChild = state.inXJSChild;
9401
- origInXJSTag = state.inXJSTag;
9402
- state.inXJSChild = false;
9403
- state.inXJSTag = true;
9405
+ origInJSXChild = state.inJSXChild;
9406
+ origInJSXTag = state.inJSXTag;
9407
+ state.inJSXChild = false;
9408
+ state.inJSXTag = true;
9404
9409
 
9405
9410
  expect('<');
9406
9411
 
9407
- name = parseXJSElementName();
9412
+ name = parseJSXElementName();
9408
9413
 
9409
9414
  while (index < length &&
9410
9415
  lookahead.value !== '/' &&
9411
9416
  lookahead.value !== '>') {
9412
- attributes.push(parseXJSAttribute());
9417
+ attributes.push(parseJSXAttribute());
9413
9418
  }
9414
9419
 
9415
- state.inXJSTag = origInXJSTag;
9420
+ state.inJSXTag = origInJSXTag;
9416
9421
 
9417
9422
  if (lookahead.value === '/') {
9418
9423
  expect('/');
9419
9424
  // Because advance() (called by lex() called by expect()) expects
9420
9425
  // there to be a valid token after >, it needs to know whether to
9421
- // look for a standard JS token or an XJS text node
9422
- state.inXJSChild = origInXJSChild;
9426
+ // look for a standard JS token or an JSX text node
9427
+ state.inJSXChild = origInJSXChild;
9423
9428
  expect('>');
9424
9429
  selfClosing = true;
9425
9430
  } else {
9426
- state.inXJSChild = true;
9431
+ state.inJSXChild = true;
9427
9432
  expect('>');
9428
9433
  }
9429
- return markerApply(marker, delegate.createXJSOpeningElement(name, attributes, selfClosing));
9434
+ return markerApply(marker, delegate.createJSXOpeningElement(name, attributes, selfClosing));
9430
9435
  }
9431
9436
 
9432
- function parseXJSElement() {
9433
- var openingElement, closingElement = null, children = [], origInXJSChild, origInXJSTag, marker = markerCreate();
9437
+ function parseJSXElement() {
9438
+ var openingElement, closingElement = null, children = [], origInJSXChild, origInJSXTag, marker = markerCreate();
9434
9439
 
9435
- origInXJSChild = state.inXJSChild;
9436
- origInXJSTag = state.inXJSTag;
9437
- openingElement = parseXJSOpeningElement();
9440
+ origInJSXChild = state.inJSXChild;
9441
+ origInJSXTag = state.inJSXTag;
9442
+ openingElement = parseJSXOpeningElement();
9438
9443
 
9439
9444
  if (!openingElement.selfClosing) {
9440
9445
  while (index < length) {
9441
- state.inXJSChild = false; // Call lookahead2() with inXJSChild = false because </ should not be considered in the child
9446
+ state.inJSXChild = false; // Call lookahead2() with inJSXChild = false because </ should not be considered in the child
9442
9447
  if (lookahead.value === '<' && lookahead2().value === '/') {
9443
9448
  break;
9444
9449
  }
9445
- state.inXJSChild = true;
9446
- children.push(parseXJSChild());
9450
+ state.inJSXChild = true;
9451
+ children.push(parseJSXChild());
9447
9452
  }
9448
- state.inXJSChild = origInXJSChild;
9449
- state.inXJSTag = origInXJSTag;
9450
- closingElement = parseXJSClosingElement();
9451
- if (getQualifiedXJSName(closingElement.name) !== getQualifiedXJSName(openingElement.name)) {
9452
- throwError({}, Messages.ExpectedXJSClosingTag, getQualifiedXJSName(openingElement.name));
9453
+ state.inJSXChild = origInJSXChild;
9454
+ state.inJSXTag = origInJSXTag;
9455
+ closingElement = parseJSXClosingElement();
9456
+ if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
9457
+ throwError({}, Messages.ExpectedJSXClosingTag, getQualifiedJSXName(openingElement.name));
9453
9458
  }
9454
9459
  }
9455
9460
 
@@ -9458,15 +9463,15 @@ parseYieldExpression: true, parseAwaitExpression: true
9458
9463
  // var x = <div>one</div><div>two</div>;
9459
9464
  //
9460
9465
  // the default error message is a bit incomprehensible. Since it's
9461
- // rarely (never?) useful to write a less-than sign after an XJS
9466
+ // rarely (never?) useful to write a less-than sign after an JSX
9462
9467
  // element, we disallow it here in the parser in order to provide a
9463
9468
  // better error message. (In the rare case that the less-than operator
9464
9469
  // was intended, the left tag can be wrapped in parentheses.)
9465
- if (!origInXJSChild && match('<')) {
9466
- throwError(lookahead, Messages.AdjacentXJSElements);
9470
+ if (!origInJSXChild && match('<')) {
9471
+ throwError(lookahead, Messages.AdjacentJSXElements);
9467
9472
  }
9468
9473
 
9469
- return markerApply(marker, delegate.createXJSElement(openingElement, closingElement, children));
9474
+ return markerApply(marker, delegate.createJSXElement(openingElement, closingElement, children));
9470
9475
  }
9471
9476
 
9472
9477
  function parseTypeAlias() {
@@ -9529,8 +9534,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9529
9534
  }
9530
9535
 
9531
9536
  function parseInterface() {
9532
- var body, bodyMarker, extended = [], id, marker = markerCreate(),
9533
- typeParameters = null, previousStrict;
9537
+ var marker = markerCreate();
9534
9538
 
9535
9539
  if (strict) {
9536
9540
  expectKeyword('interface');
@@ -9648,14 +9652,13 @@ parseYieldExpression: true, parseAwaitExpression: true
9648
9652
  }
9649
9653
 
9650
9654
  function collectToken() {
9651
- var start, loc, token, range, value, entry;
9655
+ var loc, token, range, value, entry;
9652
9656
 
9653
9657
  /* istanbul ignore else */
9654
- if (!state.inXJSChild) {
9658
+ if (!state.inJSXChild) {
9655
9659
  skipComment();
9656
9660
  }
9657
9661
 
9658
- start = index;
9659
9662
  loc = {
9660
9663
  start: {
9661
9664
  line: lineNumber,
@@ -9761,11 +9764,6 @@ parseYieldExpression: true, parseAwaitExpression: true
9761
9764
  }
9762
9765
 
9763
9766
  function patch() {
9764
- if (extra.comments) {
9765
- extra.skipComment = skipComment;
9766
- skipComment = scanComment;
9767
- }
9768
-
9769
9767
  if (typeof extra.tokens !== 'undefined') {
9770
9768
  extra.advance = advance;
9771
9769
  extra.scanRegExp = scanRegExp;
@@ -9776,10 +9774,6 @@ parseYieldExpression: true, parseAwaitExpression: true
9776
9774
  }
9777
9775
 
9778
9776
  function unpatch() {
9779
- if (typeof extra.skipComment === 'function') {
9780
- skipComment = extra.skipComment;
9781
- }
9782
-
9783
9777
  if (typeof extra.scanRegExp === 'function') {
9784
9778
  advance = extra.advance;
9785
9779
  scanRegExp = extra.scanRegExp;
@@ -9923,8 +9917,8 @@ parseYieldExpression: true, parseAwaitExpression: true
9923
9917
  inFunctionBody: false,
9924
9918
  inIteration: false,
9925
9919
  inSwitch: false,
9926
- inXJSChild: false,
9927
- inXJSTag: false,
9920
+ inJSXChild: false,
9921
+ inJSXTag: false,
9928
9922
  inType: false,
9929
9923
  lastCommentStart: -1,
9930
9924
  yieldAllowed: false,
@@ -9989,7 +9983,7 @@ parseYieldExpression: true, parseAwaitExpression: true
9989
9983
  }
9990
9984
 
9991
9985
  // Sync with *.json manifests.
9992
- exports.version = '12001.1.0-dev-harmony-fb';
9986
+ exports.version = '13001.1001.0-dev-harmony-fb';
9993
9987
 
9994
9988
  exports.tokenize = tokenize;
9995
9989
 
@@ -10020,7 +10014,7 @@ parseYieldExpression: true, parseAwaitExpression: true
10020
10014
  }));
10021
10015
  /* vim: set sw=4 ts=4 et tw=80 : */
10022
10016
 
10023
- },{}],9:[function(_dereq_,module,exports){
10017
+ },{}],10:[function(_dereq_,module,exports){
10024
10018
  var Base62 = (function (my) {
10025
10019
  my.chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
10026
10020
 
@@ -10048,7 +10042,7 @@ var Base62 = (function (my) {
10048
10042
  }({}));
10049
10043
 
10050
10044
  module.exports = Base62
10051
- },{}],10:[function(_dereq_,module,exports){
10045
+ },{}],11:[function(_dereq_,module,exports){
10052
10046
  /*
10053
10047
  * Copyright 2009-2011 Mozilla Foundation and contributors
10054
10048
  * Licensed under the New BSD license. See LICENSE.txt or:
@@ -10058,7 +10052,7 @@ exports.SourceMapGenerator = _dereq_('./source-map/source-map-generator').Source
10058
10052
  exports.SourceMapConsumer = _dereq_('./source-map/source-map-consumer').SourceMapConsumer;
10059
10053
  exports.SourceNode = _dereq_('./source-map/source-node').SourceNode;
10060
10054
 
10061
- },{"./source-map/source-map-consumer":15,"./source-map/source-map-generator":16,"./source-map/source-node":17}],11:[function(_dereq_,module,exports){
10055
+ },{"./source-map/source-map-consumer":16,"./source-map/source-map-generator":17,"./source-map/source-node":18}],12:[function(_dereq_,module,exports){
10062
10056
  /* -*- Mode: js; js-indent-level: 2; -*- */
10063
10057
  /*
10064
10058
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10157,7 +10151,7 @@ define(function (_dereq_, exports, module) {
10157
10151
 
10158
10152
  });
10159
10153
 
10160
- },{"./util":18,"amdefine":19}],12:[function(_dereq_,module,exports){
10154
+ },{"./util":19,"amdefine":20}],13:[function(_dereq_,module,exports){
10161
10155
  /* -*- Mode: js; js-indent-level: 2; -*- */
10162
10156
  /*
10163
10157
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10303,7 +10297,7 @@ define(function (_dereq_, exports, module) {
10303
10297
 
10304
10298
  });
10305
10299
 
10306
- },{"./base64":13,"amdefine":19}],13:[function(_dereq_,module,exports){
10300
+ },{"./base64":14,"amdefine":20}],14:[function(_dereq_,module,exports){
10307
10301
  /* -*- Mode: js; js-indent-level: 2; -*- */
10308
10302
  /*
10309
10303
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10347,7 +10341,7 @@ define(function (_dereq_, exports, module) {
10347
10341
 
10348
10342
  });
10349
10343
 
10350
- },{"amdefine":19}],14:[function(_dereq_,module,exports){
10344
+ },{"amdefine":20}],15:[function(_dereq_,module,exports){
10351
10345
  /* -*- Mode: js; js-indent-level: 2; -*- */
10352
10346
  /*
10353
10347
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10430,7 +10424,7 @@ define(function (_dereq_, exports, module) {
10430
10424
 
10431
10425
  });
10432
10426
 
10433
- },{"amdefine":19}],15:[function(_dereq_,module,exports){
10427
+ },{"amdefine":20}],16:[function(_dereq_,module,exports){
10434
10428
  /* -*- Mode: js; js-indent-level: 2; -*- */
10435
10429
  /*
10436
10430
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10909,7 +10903,7 @@ define(function (_dereq_, exports, module) {
10909
10903
 
10910
10904
  });
10911
10905
 
10912
- },{"./array-set":11,"./base64-vlq":12,"./binary-search":14,"./util":18,"amdefine":19}],16:[function(_dereq_,module,exports){
10906
+ },{"./array-set":12,"./base64-vlq":13,"./binary-search":15,"./util":19,"amdefine":20}],17:[function(_dereq_,module,exports){
10913
10907
  /* -*- Mode: js; js-indent-level: 2; -*- */
10914
10908
  /*
10915
10909
  * Copyright 2011 Mozilla Foundation and contributors
@@ -11291,7 +11285,7 @@ define(function (_dereq_, exports, module) {
11291
11285
 
11292
11286
  });
11293
11287
 
11294
- },{"./array-set":11,"./base64-vlq":12,"./util":18,"amdefine":19}],17:[function(_dereq_,module,exports){
11288
+ },{"./array-set":12,"./base64-vlq":13,"./util":19,"amdefine":20}],18:[function(_dereq_,module,exports){
11295
11289
  /* -*- Mode: js; js-indent-level: 2; -*- */
11296
11290
  /*
11297
11291
  * Copyright 2011 Mozilla Foundation and contributors
@@ -11664,7 +11658,7 @@ define(function (_dereq_, exports, module) {
11664
11658
 
11665
11659
  });
11666
11660
 
11667
- },{"./source-map-generator":16,"./util":18,"amdefine":19}],18:[function(_dereq_,module,exports){
11661
+ },{"./source-map-generator":17,"./util":19,"amdefine":20}],19:[function(_dereq_,module,exports){
11668
11662
  /* -*- Mode: js; js-indent-level: 2; -*- */
11669
11663
  /*
11670
11664
  * Copyright 2011 Mozilla Foundation and contributors
@@ -11871,7 +11865,7 @@ define(function (_dereq_, exports, module) {
11871
11865
 
11872
11866
  });
11873
11867
 
11874
- },{"amdefine":19}],19:[function(_dereq_,module,exports){
11868
+ },{"amdefine":20}],20:[function(_dereq_,module,exports){
11875
11869
  (function (process,__filename){
11876
11870
  /** vim: et:ts=4:sw=4:sts=4
11877
11871
  * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
@@ -12174,7 +12168,7 @@ function amdefine(module, requireFn) {
12174
12168
  module.exports = amdefine;
12175
12169
 
12176
12170
  }).call(this,_dereq_('_process'),"/node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js")
12177
- },{"_process":7,"path":6}],20:[function(_dereq_,module,exports){
12171
+ },{"_process":8,"path":7}],21:[function(_dereq_,module,exports){
12178
12172
  /**
12179
12173
  * Copyright 2013 Facebook, Inc.
12180
12174
  *
@@ -12262,7 +12256,7 @@ exports.extract = extract;
12262
12256
  exports.parse = parse;
12263
12257
  exports.parseAsObject = parseAsObject;
12264
12258
 
12265
- },{}],21:[function(_dereq_,module,exports){
12259
+ },{}],22:[function(_dereq_,module,exports){
12266
12260
  /**
12267
12261
  * Copyright 2013 Facebook, Inc.
12268
12262
  *
@@ -12563,7 +12557,7 @@ function transform(visitors, source, options) {
12563
12557
  exports.transform = transform;
12564
12558
  exports.Syntax = Syntax;
12565
12559
 
12566
- },{"./utils":22,"esprima-fb":8,"source-map":10}],22:[function(_dereq_,module,exports){
12560
+ },{"./utils":23,"esprima-fb":9,"source-map":11}],23:[function(_dereq_,module,exports){
12567
12561
  /**
12568
12562
  * Copyright 2013 Facebook, Inc.
12569
12563
  *
@@ -13273,7 +13267,7 @@ exports.scopeTypes = scopeTypes;
13273
13267
  exports.updateIndent = updateIndent;
13274
13268
  exports.updateState = updateState;
13275
13269
 
13276
- },{"./docblock":20,"esprima-fb":8}],23:[function(_dereq_,module,exports){
13270
+ },{"./docblock":21,"esprima-fb":9}],24:[function(_dereq_,module,exports){
13277
13271
  /**
13278
13272
  * Copyright 2013 Facebook, Inc.
13279
13273
  *
@@ -13433,7 +13427,116 @@ exports.visitorList = [
13433
13427
  ];
13434
13428
 
13435
13429
 
13436
- },{"../src/utils":22,"./es6-destructuring-visitors":25,"./es6-rest-param-visitors":28,"esprima-fb":8}],24:[function(_dereq_,module,exports){
13430
+ },{"../src/utils":23,"./es6-destructuring-visitors":27,"./es6-rest-param-visitors":30,"esprima-fb":9}],25:[function(_dereq_,module,exports){
13431
+ /**
13432
+ * Copyright 2004-present Facebook. All Rights Reserved.
13433
+ */
13434
+ /*global exports:true*/
13435
+
13436
+ /**
13437
+ * Implements ES6 call spread.
13438
+ *
13439
+ * instance.method(a, b, c, ...d)
13440
+ *
13441
+ * instance.method.apply(instance, [a, b, c].concat(d))
13442
+ *
13443
+ */
13444
+
13445
+ var Syntax = _dereq_('esprima-fb').Syntax;
13446
+ var utils = _dereq_('../src/utils');
13447
+
13448
+ function process(traverse, node, path, state) {
13449
+ utils.move(node.range[0], state);
13450
+ traverse(node, path, state);
13451
+ utils.catchup(node.range[1], state);
13452
+ }
13453
+
13454
+ function visitCallSpread(traverse, node, path, state) {
13455
+ utils.catchup(node.range[0], state);
13456
+
13457
+ if (node.type === Syntax.NewExpression) {
13458
+ // Input = new Set(1, 2, ...list)
13459
+ // Output = new (Function.prototype.bind.apply(Set, [null, 1, 2].concat(list)))
13460
+ utils.append('new (Function.prototype.bind.apply(', state);
13461
+ process(traverse, node.callee, path, state);
13462
+ } else if (node.callee.type === Syntax.MemberExpression) {
13463
+ // Input = get().fn(1, 2, ...more)
13464
+ // Output = (_ = get()).fn.apply(_, [1, 2].apply(more))
13465
+ var tempVar = utils.injectTempVar(state);
13466
+ utils.append('(' + tempVar + ' = ', state);
13467
+ process(traverse, node.callee.object, path, state);
13468
+ utils.append(')', state);
13469
+ if (node.callee.property.type === Syntax.Identifier) {
13470
+ utils.append('.', state);
13471
+ process(traverse, node.callee.property, path, state);
13472
+ } else {
13473
+ utils.append('[', state);
13474
+ process(traverse, node.callee.property, path, state);
13475
+ utils.append(']', state);
13476
+ }
13477
+ utils.append('.apply(' + tempVar, state);
13478
+ } else {
13479
+ // Input = max(1, 2, ...list)
13480
+ // Output = max.apply(null, [1, 2].concat(list))
13481
+ var needsToBeWrappedInParenthesis =
13482
+ node.callee.type === Syntax.FunctionDeclaration ||
13483
+ node.callee.type === Syntax.FunctionExpression;
13484
+ if (needsToBeWrappedInParenthesis) {
13485
+ utils.append('(', state);
13486
+ }
13487
+ process(traverse, node.callee, path, state);
13488
+ if (needsToBeWrappedInParenthesis) {
13489
+ utils.append(')', state);
13490
+ }
13491
+ utils.append('.apply(null', state);
13492
+ }
13493
+ utils.append(', ', state);
13494
+
13495
+ var args = node.arguments.slice();
13496
+ var spread = args.pop();
13497
+ if (args.length || node.type === Syntax.NewExpression) {
13498
+ utils.append('[', state);
13499
+ if (node.type === Syntax.NewExpression) {
13500
+ utils.append('null' + (args.length ? ', ' : ''), state);
13501
+ }
13502
+ while (args.length) {
13503
+ var arg = args.shift();
13504
+ utils.move(arg.range[0], state);
13505
+ traverse(arg, path, state);
13506
+ if (args.length) {
13507
+ utils.catchup(args[0].range[0], state);
13508
+ } else {
13509
+ utils.catchup(arg.range[1], state);
13510
+ }
13511
+ }
13512
+ utils.append('].concat(', state);
13513
+ process(traverse, spread.argument, path, state);
13514
+ utils.append(')', state);
13515
+ } else {
13516
+ process(traverse, spread.argument, path, state);
13517
+ }
13518
+ utils.append(node.type === Syntax.NewExpression ? '))' : ')', state);
13519
+
13520
+ utils.move(node.range[1], state);
13521
+ return false;
13522
+ }
13523
+
13524
+ visitCallSpread.test = function(node, path, state) {
13525
+ return (
13526
+ (
13527
+ node.type === Syntax.CallExpression ||
13528
+ node.type === Syntax.NewExpression
13529
+ ) &&
13530
+ node.arguments.length > 0 &&
13531
+ node.arguments[node.arguments.length - 1].type === Syntax.SpreadElement
13532
+ );
13533
+ };
13534
+
13535
+ exports.visitorList = [
13536
+ visitCallSpread
13537
+ ];
13538
+
13539
+ },{"../src/utils":23,"esprima-fb":9}],26:[function(_dereq_,module,exports){
13437
13540
  /**
13438
13541
  * Copyright 2013 Facebook, Inc.
13439
13542
  *
@@ -14023,7 +14126,7 @@ exports.visitorList = [
14023
14126
  visitSuperMemberExpression
14024
14127
  ];
14025
14128
 
14026
- },{"../src/utils":22,"./reserved-words-helper":32,"base62":9,"esprima-fb":8}],25:[function(_dereq_,module,exports){
14129
+ },{"../src/utils":23,"./reserved-words-helper":34,"base62":10,"esprima-fb":9}],27:[function(_dereq_,module,exports){
14027
14130
  /**
14028
14131
  * Copyright 2014 Facebook, Inc.
14029
14132
  *
@@ -14305,7 +14408,7 @@ exports.visitorList = [
14305
14408
  exports.renderDestructuredComponents = renderDestructuredComponents;
14306
14409
 
14307
14410
 
14308
- },{"../src/utils":22,"./es6-rest-param-visitors":28,"./es7-rest-property-helpers":30,"./reserved-words-helper":32,"esprima-fb":8}],26:[function(_dereq_,module,exports){
14411
+ },{"../src/utils":23,"./es6-rest-param-visitors":30,"./es7-rest-property-helpers":32,"./reserved-words-helper":34,"esprima-fb":9}],28:[function(_dereq_,module,exports){
14309
14412
  /**
14310
14413
  * Copyright 2013 Facebook, Inc.
14311
14414
  *
@@ -14376,7 +14479,7 @@ exports.visitorList = [
14376
14479
  visitObjectConciseMethod
14377
14480
  ];
14378
14481
 
14379
- },{"../src/utils":22,"./reserved-words-helper":32,"esprima-fb":8}],27:[function(_dereq_,module,exports){
14482
+ },{"../src/utils":23,"./reserved-words-helper":34,"esprima-fb":9}],29:[function(_dereq_,module,exports){
14380
14483
  /**
14381
14484
  * Copyright 2013 Facebook, Inc.
14382
14485
  *
@@ -14431,7 +14534,7 @@ exports.visitorList = [
14431
14534
  ];
14432
14535
 
14433
14536
 
14434
- },{"../src/utils":22,"esprima-fb":8}],28:[function(_dereq_,module,exports){
14537
+ },{"../src/utils":23,"esprima-fb":9}],30:[function(_dereq_,module,exports){
14435
14538
  /**
14436
14539
  * Copyright 2013 Facebook, Inc.
14437
14540
  *
@@ -14539,7 +14642,7 @@ exports.visitorList = [
14539
14642
  visitFunctionBodyWithRestParam
14540
14643
  ];
14541
14644
 
14542
- },{"../src/utils":22,"esprima-fb":8}],29:[function(_dereq_,module,exports){
14645
+ },{"../src/utils":23,"esprima-fb":9}],31:[function(_dereq_,module,exports){
14543
14646
  /**
14544
14647
  * Copyright 2013 Facebook, Inc.
14545
14648
  *
@@ -14697,7 +14800,7 @@ exports.visitorList = [
14697
14800
  visitTaggedTemplateExpression
14698
14801
  ];
14699
14802
 
14700
- },{"../src/utils":22,"esprima-fb":8}],30:[function(_dereq_,module,exports){
14803
+ },{"../src/utils":23,"esprima-fb":9}],32:[function(_dereq_,module,exports){
14701
14804
  /**
14702
14805
  * Copyright 2013 Facebook, Inc.
14703
14806
  *
@@ -14779,7 +14882,7 @@ function renderRestExpression(accessorExpression, excludedProperties) {
14779
14882
 
14780
14883
  exports.renderRestExpression = renderRestExpression;
14781
14884
 
14782
- },{"esprima-fb":8}],31:[function(_dereq_,module,exports){
14885
+ },{"esprima-fb":9}],33:[function(_dereq_,module,exports){
14783
14886
  /**
14784
14887
  * Copyright 2004-present Facebook. All Rights Reserved.
14785
14888
  */
@@ -14889,7 +14992,7 @@ exports.visitorList = [
14889
14992
  visitObjectLiteralSpread
14890
14993
  ];
14891
14994
 
14892
- },{"../src/utils":22,"esprima-fb":8}],32:[function(_dereq_,module,exports){
14995
+ },{"../src/utils":23,"esprima-fb":9}],34:[function(_dereq_,module,exports){
14893
14996
  /**
14894
14997
  * Copyright 2014 Facebook, Inc.
14895
14998
  *
@@ -14936,11 +15039,106 @@ RESERVED_WORDS.forEach(function(k) {
14936
15039
  reservedWordsMap[k] = true;
14937
15040
  });
14938
15041
 
15042
+ /**
15043
+ * This list should not grow as new reserved words are introdued. This list is
15044
+ * of words that need to be quoted because ES3-ish browsers do not allow their
15045
+ * use as identifier names.
15046
+ */
15047
+ var ES3_FUTURE_RESERVED_WORDS = [
15048
+ 'enum', 'implements', 'package', 'protected', 'static', 'interface',
15049
+ 'private', 'public'
15050
+ ];
15051
+
15052
+ var ES3_RESERVED_WORDS = [].concat(
15053
+ KEYWORDS,
15054
+ ES3_FUTURE_RESERVED_WORDS,
15055
+ LITERALS
15056
+ );
15057
+
15058
+ var es3ReservedWordsMap = Object.create(null);
15059
+ ES3_RESERVED_WORDS.forEach(function(k) {
15060
+ es3ReservedWordsMap[k] = true;
15061
+ });
15062
+
14939
15063
  exports.isReservedWord = function(word) {
14940
15064
  return !!reservedWordsMap[word];
14941
15065
  };
14942
15066
 
14943
- },{}],33:[function(_dereq_,module,exports){
15067
+ exports.isES3ReservedWord = function(word) {
15068
+ return !!es3ReservedWordsMap[word];
15069
+ };
15070
+
15071
+ },{}],35:[function(_dereq_,module,exports){
15072
+ /**
15073
+ * Copyright 2014 Facebook, Inc.
15074
+ *
15075
+ * Licensed under the Apache License, Version 2.0 (the "License");
15076
+ * you may not use this file except in compliance with the License.
15077
+ * You may obtain a copy of the License at
15078
+ *
15079
+ * http://www.apache.org/licenses/LICENSE-2.0
15080
+ *
15081
+ * Unless required by applicable law or agreed to in writing, software
15082
+ * distributed under the License is distributed on an "AS IS" BASIS,
15083
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15084
+ * See the License for the specific language governing permissions and
15085
+ * limitations under the License.
15086
+ *
15087
+ */
15088
+ /*global exports:true*/
15089
+
15090
+ var Syntax = _dereq_('esprima-fb').Syntax;
15091
+ var utils = _dereq_('../src/utils');
15092
+ var reserverdWordsHelper = _dereq_('./reserved-words-helper');
15093
+
15094
+ /**
15095
+ * Code adapted from https://github.com/spicyj/es3ify
15096
+ * The MIT License (MIT)
15097
+ * Copyright (c) 2014 Ben Alpert
15098
+ */
15099
+
15100
+ function visitProperty(traverse, node, path, state) {
15101
+ utils.catchup(node.key.range[0], state);
15102
+ utils.append('"', state);
15103
+ utils.catchup(node.key.range[1], state);
15104
+ utils.append('"', state);
15105
+ utils.catchup(node.value.range[0], state);
15106
+ traverse(node.value, path, state);
15107
+ return false;
15108
+ }
15109
+
15110
+ visitProperty.test = function(node) {
15111
+ return node.type === Syntax.Property &&
15112
+ node.key.type === Syntax.Identifier &&
15113
+ !node.method &&
15114
+ !node.shorthand &&
15115
+ !node.computed &&
15116
+ reserverdWordsHelper.isES3ReservedWord(node.key.name);
15117
+ };
15118
+
15119
+ function visitMemberExpression(traverse, node, path, state) {
15120
+ traverse(node.object, path, state);
15121
+ utils.catchup(node.property.range[0] - 1, state);
15122
+ utils.append('[', state);
15123
+ utils.catchupWhiteSpace(node.property.range[0], state);
15124
+ utils.append('"', state);
15125
+ utils.catchup(node.property.range[1], state);
15126
+ utils.append('"]', state);
15127
+ return false;
15128
+ }
15129
+
15130
+ visitMemberExpression.test = function(node) {
15131
+ return node.type === Syntax.MemberExpression &&
15132
+ node.property.type === Syntax.Identifier &&
15133
+ reserverdWordsHelper.isES3ReservedWord(node.property.name);
15134
+ };
15135
+
15136
+ exports.visitorList = [
15137
+ visitProperty,
15138
+ visitMemberExpression
15139
+ ];
15140
+
15141
+ },{"../src/utils":23,"./reserved-words-helper":34,"esprima-fb":9}],36:[function(_dereq_,module,exports){
14944
15142
  var esprima = _dereq_('esprima-fb');
14945
15143
  var utils = _dereq_('../src/utils');
14946
15144
 
@@ -14970,6 +15168,10 @@ visitTypeAlias.test = function(node, path, state) {
14970
15168
  };
14971
15169
 
14972
15170
  function visitTypeCast(traverse, node, path, state) {
15171
+ path.unshift(node);
15172
+ traverse(node.expression, path, state);
15173
+ path.shift();
15174
+
14973
15175
  utils.catchup(node.typeAnnotation.range[0], state);
14974
15176
  utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
14975
15177
  return false;
@@ -15110,7 +15312,7 @@ exports.visitorList = [
15110
15312
  visitTypeAnnotatedObjectOrArrayPattern
15111
15313
  ];
15112
15314
 
15113
- },{"../src/utils":22,"esprima-fb":8}],34:[function(_dereq_,module,exports){
15315
+ },{"../src/utils":23,"esprima-fb":9}],37:[function(_dereq_,module,exports){
15114
15316
  /**
15115
15317
  * Copyright 2013-2015, Facebook, Inc.
15116
15318
  * All rights reserved.
@@ -15120,17 +15322,130 @@ exports.visitorList = [
15120
15322
  * of patent rights can be found in the PATENTS file in the same directory.
15121
15323
  */
15122
15324
  /*global exports:true*/
15123
- "use strict";
15325
+ 'use strict';
15326
+ var Syntax = _dereq_('jstransform').Syntax;
15327
+ var utils = _dereq_('jstransform/src/utils');
15328
+
15329
+ function renderJSXLiteral(object, isLast, state, start, end) {
15330
+ var lines = object.value.split(/\r\n|\n|\r/);
15331
+
15332
+ if (start) {
15333
+ utils.append(start, state);
15334
+ }
15335
+
15336
+ var lastNonEmptyLine = 0;
15337
+
15338
+ lines.forEach(function(line, index) {
15339
+ if (line.match(/[^ \t]/)) {
15340
+ lastNonEmptyLine = index;
15341
+ }
15342
+ });
15343
+
15344
+ lines.forEach(function(line, index) {
15345
+ var isFirstLine = index === 0;
15346
+ var isLastLine = index === lines.length - 1;
15347
+ var isLastNonEmptyLine = index === lastNonEmptyLine;
15348
+
15349
+ // replace rendered whitespace tabs with spaces
15350
+ var trimmedLine = line.replace(/\t/g, ' ');
15351
+
15352
+ // trim whitespace touching a newline
15353
+ if (!isFirstLine) {
15354
+ trimmedLine = trimmedLine.replace(/^[ ]+/, '');
15355
+ }
15356
+ if (!isLastLine) {
15357
+ trimmedLine = trimmedLine.replace(/[ ]+$/, '');
15358
+ }
15359
+
15360
+ if (!isFirstLine) {
15361
+ utils.append(line.match(/^[ \t]*/)[0], state);
15362
+ }
15363
+
15364
+ if (trimmedLine || isLastNonEmptyLine) {
15365
+ utils.append(
15366
+ JSON.stringify(trimmedLine) +
15367
+ (!isLastNonEmptyLine ? ' + \' \' +' : ''),
15368
+ state);
15369
+
15370
+ if (isLastNonEmptyLine) {
15371
+ if (end) {
15372
+ utils.append(end, state);
15373
+ }
15374
+ if (!isLast) {
15375
+ utils.append(', ', state);
15376
+ }
15377
+ }
15378
+
15379
+ // only restore tail whitespace if line had literals
15380
+ if (trimmedLine && !isLastLine) {
15381
+ utils.append(line.match(/[ \t]*$/)[0], state);
15382
+ }
15383
+ }
15384
+
15385
+ if (!isLastLine) {
15386
+ utils.append('\n', state);
15387
+ }
15388
+ });
15389
+
15390
+ utils.move(object.range[1], state);
15391
+ }
15392
+
15393
+ function renderJSXExpressionContainer(traverse, object, isLast, path, state) {
15394
+ // Plus 1 to skip `{`.
15395
+ utils.move(object.range[0] + 1, state);
15396
+ utils.catchup(object.expression.range[0], state);
15397
+ traverse(object.expression, path, state);
15398
+
15399
+ if (!isLast && object.expression.type !== Syntax.JSXEmptyExpression) {
15400
+ // If we need to append a comma, make sure to do so after the expression.
15401
+ utils.catchup(object.expression.range[1], state, trimLeft);
15402
+ utils.append(', ', state);
15403
+ }
15404
+
15405
+ // Minus 1 to skip `}`.
15406
+ utils.catchup(object.range[1] - 1, state, trimLeft);
15407
+ utils.move(object.range[1], state);
15408
+ return false;
15409
+ }
15410
+
15411
+ function quoteAttrName(attr) {
15412
+ // Quote invalid JS identifiers.
15413
+ if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
15414
+ return '"' + attr + '"';
15415
+ }
15416
+ return attr;
15417
+ }
15418
+
15419
+ function trimLeft(value) {
15420
+ return value.replace(/^[ ]+/, '');
15421
+ }
15422
+
15423
+ exports.renderJSXExpressionContainer = renderJSXExpressionContainer;
15424
+ exports.renderJSXLiteral = renderJSXLiteral;
15425
+ exports.quoteAttrName = quoteAttrName;
15426
+ exports.trimLeft = trimLeft;
15427
+
15428
+ },{"jstransform":22,"jstransform/src/utils":23}],38:[function(_dereq_,module,exports){
15429
+ /**
15430
+ * Copyright 2013-2015, Facebook, Inc.
15431
+ * All rights reserved.
15432
+ *
15433
+ * This source code is licensed under the BSD-style license found in the
15434
+ * LICENSE file in the root directory of this source tree. An additional grant
15435
+ * of patent rights can be found in the PATENTS file in the same directory.
15436
+ */
15437
+ /*global exports:true*/
15438
+ 'use strict';
15124
15439
 
15125
15440
  var Syntax = _dereq_('jstransform').Syntax;
15126
15441
  var utils = _dereq_('jstransform/src/utils');
15127
15442
 
15128
- var renderXJSExpressionContainer =
15129
- _dereq_('./xjs').renderXJSExpressionContainer;
15130
- var renderXJSLiteral = _dereq_('./xjs').renderXJSLiteral;
15131
- var quoteAttrName = _dereq_('./xjs').quoteAttrName;
15443
+ var renderJSXExpressionContainer =
15444
+ _dereq_('./jsx').renderJSXExpressionContainer;
15445
+ var renderJSXLiteral = _dereq_('./jsx').renderJSXLiteral;
15446
+ var quoteAttrName = _dereq_('./jsx').quoteAttrName;
15132
15447
 
15133
- var trimLeft = _dereq_('./xjs').trimLeft;
15448
+ var trimLeft = _dereq_('./jsx').trimLeft;
15134
15449
 
15135
15450
  /**
15136
15451
  * Customized desugar processor for React JSX. Currently:
@@ -15163,20 +15478,20 @@ function visitReactTag(traverse, object, path, state) {
15163
15478
 
15164
15479
  utils.catchup(openingElement.range[0], state, trimLeft);
15165
15480
 
15166
- if (nameObject.type === Syntax.XJSNamespacedName && nameObject.namespace) {
15481
+ if (nameObject.type === Syntax.JSXNamespacedName && nameObject.namespace) {
15167
15482
  throw new Error('Namespace tags are not supported. ReactJSX is not XML.');
15168
15483
  }
15169
15484
 
15170
15485
  // We assume that the React runtime is already in scope
15171
15486
  utils.append('React.createElement(', state);
15172
15487
 
15173
- if (nameObject.type === Syntax.XJSIdentifier && isTagName(nameObject.name)) {
15488
+ if (nameObject.type === Syntax.JSXIdentifier && isTagName(nameObject.name)) {
15174
15489
  utils.append('"' + nameObject.name + '"', state);
15175
15490
  utils.move(nameObject.range[1], state);
15176
15491
  } else {
15177
15492
  // Use utils.catchup in this case so we can easily handle
15178
- // XJSMemberExpressions which look like Foo.Bar.Baz. This also handles
15179
- // XJSIdentifiers that aren't fallback tags.
15493
+ // JSXMemberExpressions which look like Foo.Bar.Baz. This also handles
15494
+ // JSXIdentifiers that aren't fallback tags.
15180
15495
  utils.move(nameObject.range[0], state);
15181
15496
  utils.catchup(nameObject.range[1], state);
15182
15497
  }
@@ -15186,7 +15501,7 @@ function visitReactTag(traverse, object, path, state) {
15186
15501
  var hasAttributes = attributesObject.length;
15187
15502
 
15188
15503
  var hasAtLeastOneSpreadProperty = attributesObject.some(function(attr) {
15189
- return attr.type === Syntax.XJSSpreadAttribute;
15504
+ return attr.type === Syntax.JSXSpreadAttribute;
15190
15505
  });
15191
15506
 
15192
15507
  // if we don't have any attributes, pass in null
@@ -15205,7 +15520,7 @@ function visitReactTag(traverse, object, path, state) {
15205
15520
  attributesObject.forEach(function(attr, index) {
15206
15521
  var isLast = index === attributesObject.length - 1;
15207
15522
 
15208
- if (attr.type === Syntax.XJSSpreadAttribute) {
15523
+ if (attr.type === Syntax.JSXSpreadAttribute) {
15209
15524
  // Close the previous object or initial object
15210
15525
  if (!previousWasSpread) {
15211
15526
  utils.append('}, ', state);
@@ -15238,7 +15553,7 @@ function visitReactTag(traverse, object, path, state) {
15238
15553
 
15239
15554
  // If the next attribute is a spread, we're effective last in this object
15240
15555
  if (!isLast) {
15241
- isLast = attributesObject[index + 1].type === Syntax.XJSSpreadAttribute;
15556
+ isLast = attributesObject[index + 1].type === Syntax.JSXSpreadAttribute;
15242
15557
  }
15243
15558
 
15244
15559
  if (attr.name.namespace) {
@@ -15267,9 +15582,9 @@ function visitReactTag(traverse, object, path, state) {
15267
15582
  // Use catchupNewlines to skip over the '=' in the attribute
15268
15583
  utils.catchupNewlines(attr.value.range[0], state);
15269
15584
  if (attr.value.type === Syntax.Literal) {
15270
- renderXJSLiteral(attr.value, isLast, state);
15585
+ renderJSXLiteral(attr.value, isLast, state);
15271
15586
  } else {
15272
- renderXJSExpressionContainer(traverse, attr.value, isLast, path, state);
15587
+ renderJSXExpressionContainer(traverse, attr.value, isLast, path, state);
15273
15588
  }
15274
15589
  }
15275
15590
 
@@ -15302,8 +15617,8 @@ function visitReactTag(traverse, object, path, state) {
15302
15617
  var lastRenderableIndex;
15303
15618
 
15304
15619
  childrenToRender.forEach(function(child, index) {
15305
- if (child.type !== Syntax.XJSExpressionContainer ||
15306
- child.expression.type !== Syntax.XJSEmptyExpression) {
15620
+ if (child.type !== Syntax.JSXExpressionContainer ||
15621
+ child.expression.type !== Syntax.JSXEmptyExpression) {
15307
15622
  lastRenderableIndex = index;
15308
15623
  }
15309
15624
  });
@@ -15318,9 +15633,9 @@ function visitReactTag(traverse, object, path, state) {
15318
15633
  var isLast = index >= lastRenderableIndex;
15319
15634
 
15320
15635
  if (child.type === Syntax.Literal) {
15321
- renderXJSLiteral(child, isLast, state);
15322
- } else if (child.type === Syntax.XJSExpressionContainer) {
15323
- renderXJSExpressionContainer(traverse, child, isLast, path, state);
15636
+ renderJSXLiteral(child, isLast, state);
15637
+ } else if (child.type === Syntax.JSXExpressionContainer) {
15638
+ renderJSXExpressionContainer(traverse, child, isLast, path, state);
15324
15639
  } else {
15325
15640
  traverse(child, path, state);
15326
15641
  if (!isLast) {
@@ -15347,14 +15662,14 @@ function visitReactTag(traverse, object, path, state) {
15347
15662
  }
15348
15663
 
15349
15664
  visitReactTag.test = function(object, path, state) {
15350
- return object.type === Syntax.XJSElement;
15665
+ return object.type === Syntax.JSXElement;
15351
15666
  };
15352
15667
 
15353
15668
  exports.visitorList = [
15354
15669
  visitReactTag
15355
15670
  ];
15356
15671
 
15357
- },{"./xjs":36,"jstransform":21,"jstransform/src/utils":22}],35:[function(_dereq_,module,exports){
15672
+ },{"./jsx":37,"jstransform":22,"jstransform/src/utils":23}],39:[function(_dereq_,module,exports){
15358
15673
  /**
15359
15674
  * Copyright 2013-2015, Facebook, Inc.
15360
15675
  * All rights reserved.
@@ -15364,7 +15679,7 @@ exports.visitorList = [
15364
15679
  * of patent rights can be found in the PATENTS file in the same directory.
15365
15680
  */
15366
15681
  /*global exports:true*/
15367
- "use strict";
15682
+ 'use strict';
15368
15683
 
15369
15684
  var Syntax = _dereq_('jstransform').Syntax;
15370
15685
  var utils = _dereq_('jstransform/src/utils');
@@ -15377,10 +15692,10 @@ function addDisplayName(displayName, object, state) {
15377
15692
  object.callee.object.name === 'React' &&
15378
15693
  object.callee.property.type === Syntax.Identifier &&
15379
15694
  object.callee.property.name === 'createClass' &&
15380
- object['arguments'].length === 1 &&
15381
- object['arguments'][0].type === Syntax.ObjectExpression) {
15695
+ object.arguments.length === 1 &&
15696
+ object.arguments[0].type === Syntax.ObjectExpression) {
15382
15697
  // Verify that the displayName property isn't already set
15383
- var properties = object['arguments'][0].properties;
15698
+ var properties = object.arguments[0].properties;
15384
15699
  var safe = properties.every(function(property) {
15385
15700
  var value = property.key.type === Syntax.Identifier ?
15386
15701
  property.key.name :
@@ -15389,7 +15704,7 @@ function addDisplayName(displayName, object, state) {
15389
15704
  });
15390
15705
 
15391
15706
  if (safe) {
15392
- utils.catchup(object['arguments'][0].range[0] + 1, state);
15707
+ utils.catchup(object.arguments[0].range[0] + 1, state);
15393
15708
  utils.append('displayName: "' + displayName + '",', state);
15394
15709
  }
15395
15710
  }
@@ -15449,131 +15764,29 @@ exports.visitorList = [
15449
15764
  visitReactDisplayName
15450
15765
  ];
15451
15766
 
15452
- },{"jstransform":21,"jstransform/src/utils":22}],36:[function(_dereq_,module,exports){
15453
- /**
15454
- * Copyright 2013-2015, Facebook, Inc.
15455
- * All rights reserved.
15456
- *
15457
- * This source code is licensed under the BSD-style license found in the
15458
- * LICENSE file in the root directory of this source tree. An additional grant
15459
- * of patent rights can be found in the PATENTS file in the same directory.
15460
- */
15767
+ },{"jstransform":22,"jstransform/src/utils":23}],40:[function(_dereq_,module,exports){
15461
15768
  /*global exports:true*/
15462
- "use strict";
15463
- var Syntax = _dereq_('jstransform').Syntax;
15464
- var utils = _dereq_('jstransform/src/utils');
15465
15769
 
15466
- function renderXJSLiteral(object, isLast, state, start, end) {
15467
- var lines = object.value.split(/\r\n|\n|\r/);
15468
-
15469
- if (start) {
15470
- utils.append(start, state);
15471
- }
15472
-
15473
- var lastNonEmptyLine = 0;
15474
-
15475
- lines.forEach(function (line, index) {
15476
- if (line.match(/[^ \t]/)) {
15477
- lastNonEmptyLine = index;
15478
- }
15479
- });
15480
-
15481
- lines.forEach(function (line, index) {
15482
- var isFirstLine = index === 0;
15483
- var isLastLine = index === lines.length - 1;
15484
- var isLastNonEmptyLine = index === lastNonEmptyLine;
15485
-
15486
- // replace rendered whitespace tabs with spaces
15487
- var trimmedLine = line.replace(/\t/g, ' ');
15488
-
15489
- // trim whitespace touching a newline
15490
- if (!isFirstLine) {
15491
- trimmedLine = trimmedLine.replace(/^[ ]+/, '');
15492
- }
15493
- if (!isLastLine) {
15494
- trimmedLine = trimmedLine.replace(/[ ]+$/, '');
15495
- }
15496
-
15497
- if (!isFirstLine) {
15498
- utils.append(line.match(/^[ \t]*/)[0], state);
15499
- }
15500
-
15501
- if (trimmedLine || isLastNonEmptyLine) {
15502
- utils.append(
15503
- JSON.stringify(trimmedLine) +
15504
- (!isLastNonEmptyLine ? " + ' ' +" : ''),
15505
- state);
15506
-
15507
- if (isLastNonEmptyLine) {
15508
- if (end) {
15509
- utils.append(end, state);
15510
- }
15511
- if (!isLast) {
15512
- utils.append(', ', state);
15513
- }
15514
- }
15515
-
15516
- // only restore tail whitespace if line had literals
15517
- if (trimmedLine && !isLastLine) {
15518
- utils.append(line.match(/[ \t]*$/)[0], state);
15519
- }
15520
- }
15521
-
15522
- if (!isLastLine) {
15523
- utils.append('\n', state);
15524
- }
15525
- });
15526
-
15527
- utils.move(object.range[1], state);
15528
- }
15529
-
15530
- function renderXJSExpressionContainer(traverse, object, isLast, path, state) {
15531
- // Plus 1 to skip `{`.
15532
- utils.move(object.range[0] + 1, state);
15533
- utils.catchup(object.expression.range[0], state);
15534
- traverse(object.expression, path, state);
15535
-
15536
- if (!isLast && object.expression.type !== Syntax.XJSEmptyExpression) {
15537
- // If we need to append a comma, make sure to do so after the expression.
15538
- utils.catchup(object.expression.range[1], state, trimLeft);
15539
- utils.append(', ', state);
15540
- }
15541
-
15542
- // Minus 1 to skip `}`.
15543
- utils.catchup(object.range[1] - 1, state, trimLeft);
15544
- utils.move(object.range[1], state);
15545
- return false;
15546
- }
15547
-
15548
- function quoteAttrName(attr) {
15549
- // Quote invalid JS identifiers.
15550
- if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
15551
- return '"' + attr + '"';
15552
- }
15553
- return attr;
15554
- }
15555
-
15556
- function trimLeft(value) {
15557
- return value.replace(/^[ ]+/, '');
15558
- }
15559
-
15560
- exports.renderXJSExpressionContainer = renderXJSExpressionContainer;
15561
- exports.renderXJSLiteral = renderXJSLiteral;
15562
- exports.quoteAttrName = quoteAttrName;
15563
- exports.trimLeft = trimLeft;
15770
+ 'use strict';
15564
15771
 
15565
- },{"jstransform":21,"jstransform/src/utils":22}],37:[function(_dereq_,module,exports){
15566
- /*global exports:true*/
15567
- var es6ArrowFunctions = _dereq_('jstransform/visitors/es6-arrow-function-visitors');
15772
+ var es6ArrowFunctions =
15773
+ _dereq_('jstransform/visitors/es6-arrow-function-visitors');
15568
15774
  var es6Classes = _dereq_('jstransform/visitors/es6-class-visitors');
15569
- var es6Destructuring = _dereq_('jstransform/visitors/es6-destructuring-visitors');
15570
- var es6ObjectConciseMethod = _dereq_('jstransform/visitors/es6-object-concise-method-visitors');
15571
- var es6ObjectShortNotation = _dereq_('jstransform/visitors/es6-object-short-notation-visitors');
15775
+ var es6Destructuring =
15776
+ _dereq_('jstransform/visitors/es6-destructuring-visitors');
15777
+ var es6ObjectConciseMethod =
15778
+ _dereq_('jstransform/visitors/es6-object-concise-method-visitors');
15779
+ var es6ObjectShortNotation =
15780
+ _dereq_('jstransform/visitors/es6-object-short-notation-visitors');
15572
15781
  var es6RestParameters = _dereq_('jstransform/visitors/es6-rest-param-visitors');
15573
15782
  var es6Templates = _dereq_('jstransform/visitors/es6-template-visitors');
15574
- var es7SpreadProperty = _dereq_('jstransform/visitors/es7-spread-property-visitors');
15783
+ var es6CallSpread =
15784
+ _dereq_('jstransform/visitors/es6-call-spread-visitors');
15785
+ var es7SpreadProperty =
15786
+ _dereq_('jstransform/visitors/es7-spread-property-visitors');
15575
15787
  var react = _dereq_('./transforms/react');
15576
15788
  var reactDisplayName = _dereq_('./transforms/reactDisplayName');
15789
+ var reservedWords = _dereq_('jstransform/visitors/reserved-words-visitors');
15577
15790
 
15578
15791
  /**
15579
15792
  * Map from transformName => orderedListOfVisitors.
@@ -15586,8 +15799,10 @@ var transformVisitors = {
15586
15799
  'es6-object-short-notation': es6ObjectShortNotation.visitorList,
15587
15800
  'es6-rest-params': es6RestParameters.visitorList,
15588
15801
  'es6-templates': es6Templates.visitorList,
15802
+ 'es6-call-spread': es6CallSpread.visitorList,
15589
15803
  'es7-spread-property': es7SpreadProperty.visitorList,
15590
- 'react': react.visitorList.concat(reactDisplayName.visitorList)
15804
+ 'react': react.visitorList.concat(reactDisplayName.visitorList),
15805
+ 'reserved-words': reservedWords.visitorList
15591
15806
  };
15592
15807
 
15593
15808
  var transformSets = {
@@ -15599,8 +15814,12 @@ var transformSets = {
15599
15814
  'es6-rest-params',
15600
15815
  'es6-templates',
15601
15816
  'es6-destructuring',
15817
+ 'es6-call-spread',
15602
15818
  'es7-spread-property'
15603
15819
  ],
15820
+ 'es3': [
15821
+ 'reserved-words'
15822
+ ],
15604
15823
  'react': [
15605
15824
  'react'
15606
15825
  ]
@@ -15610,6 +15829,7 @@ var transformSets = {
15610
15829
  * Specifies the order in which each transform should run.
15611
15830
  */
15612
15831
  var transformRunOrder = [
15832
+ 'reserved-words',
15613
15833
  'es6-arrow-functions',
15614
15834
  'es6-object-concise-method',
15615
15835
  'es6-object-short-notation',
@@ -15617,6 +15837,7 @@ var transformRunOrder = [
15617
15837
  'es6-rest-params',
15618
15838
  'es6-templates',
15619
15839
  'es6-destructuring',
15840
+ 'es6-call-spread',
15620
15841
  'es7-spread-property',
15621
15842
  'react'
15622
15843
  ];
@@ -15670,5 +15891,34 @@ exports.getVisitorsBySet = getVisitorsBySet;
15670
15891
  exports.getAllVisitors = getAllVisitors;
15671
15892
  exports.transformVisitors = transformVisitors;
15672
15893
 
15673
- },{"./transforms/react":34,"./transforms/reactDisplayName":35,"jstransform/visitors/es6-arrow-function-visitors":23,"jstransform/visitors/es6-class-visitors":24,"jstransform/visitors/es6-destructuring-visitors":25,"jstransform/visitors/es6-object-concise-method-visitors":26,"jstransform/visitors/es6-object-short-notation-visitors":27,"jstransform/visitors/es6-rest-param-visitors":28,"jstransform/visitors/es6-template-visitors":29,"jstransform/visitors/es7-spread-property-visitors":31}]},{},[1])(1)
15894
+ },{"./transforms/react":38,"./transforms/reactDisplayName":39,"jstransform/visitors/es6-arrow-function-visitors":24,"jstransform/visitors/es6-call-spread-visitors":25,"jstransform/visitors/es6-class-visitors":26,"jstransform/visitors/es6-destructuring-visitors":27,"jstransform/visitors/es6-object-concise-method-visitors":28,"jstransform/visitors/es6-object-short-notation-visitors":29,"jstransform/visitors/es6-rest-param-visitors":30,"jstransform/visitors/es6-template-visitors":31,"jstransform/visitors/es7-spread-property-visitors":33,"jstransform/visitors/reserved-words-visitors":35}],41:[function(_dereq_,module,exports){
15895
+ /**
15896
+ * Copyright 2013-2015, Facebook, Inc.
15897
+ * All rights reserved.
15898
+ *
15899
+ * This source code is licensed under the BSD-style license found in the
15900
+ * LICENSE file in the root directory of this source tree. An additional grant
15901
+ * of patent rights can be found in the PATENTS file in the same directory.
15902
+ */
15903
+
15904
+ 'use strict';
15905
+ /*eslint-disable no-undef*/
15906
+ var Buffer = _dereq_('buffer').Buffer;
15907
+
15908
+ function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
15909
+ // This can be used with a sourcemap that has already has toJSON called on it.
15910
+ // Check first.
15911
+ var json = sourceMap;
15912
+ if (typeof sourceMap.toJSON === 'function') {
15913
+ json = sourceMap.toJSON();
15914
+ }
15915
+ json.sources = [sourceFilename];
15916
+ json.sourcesContent = [sourceCode];
15917
+ var base64 = Buffer(JSON.stringify(json)).toString('base64');
15918
+ return '//# sourceMappingURL=data:application/json;base64,' + base64;
15919
+ }
15920
+
15921
+ module.exports = inlineSourceMap;
15922
+
15923
+ },{"buffer":3}]},{},[1])(1)
15674
15924
  });