babel-source 4.6.5 → 4.6.6
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.
- checksums.yaml +8 -8
- data/lib/babel.js +165 -54
- data/lib/babel/source.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTY1MDg0OTBjNzRhMTRkM2JiYzJkZWYxNWRhOTNmMzI4MjI4YmE5Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzNmYWJiZDM1ZmY0MTc3MWY3NmY1ZTk0OGJlNDkwYzZmODgyNmU4ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjVjNDIyOGI1NWZiOGU4ZjdjOGRiNDg5NWMyOGU3ZDUxMDhiM2VhNGZmYzk0
|
10
|
+
ZWM5NTQ4M2M3NDVhMDRmMjUwNjgxMTk2YTk4NGFhYmU5M2Q5OTA3YjNlMjM4
|
11
|
+
MjM2YWExMjQ5MmFmNmUyYWRjOWEyYTI1YWNlMDdjZDEzYTdiMDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTQ2MDg5MjA1MjI4ZDllMWM4YTg3MmNhMDczYmRjYTNjYzBjYzkyMDAzYmMx
|
14
|
+
ZmU1N2Y0YzA5YjY0YTU1NzJhNjFiYWYyMGQ4NGIzOTg3ZjY2YWQyYzQwODYz
|
15
|
+
YTUwN2U3ZDk0ZTJiMWQ4MmRjMzFkOTY4MWZiNTJkM2Q4OTdiNDU=
|
data/lib/babel.js
CHANGED
@@ -422,6 +422,7 @@ exports.ThisExpression = ThisExpression;
|
|
422
422
|
exports.CallExpression = CallExpression;
|
423
423
|
exports.EmptyStatement = EmptyStatement;
|
424
424
|
exports.ExpressionStatement = ExpressionStatement;
|
425
|
+
exports.AssignmentExpression = AssignmentExpression;
|
425
426
|
exports.MemberExpression = MemberExpression;
|
426
427
|
|
427
428
|
var isInteger = _interopRequire(require("is-integer"));
|
@@ -537,14 +538,18 @@ function ExpressionStatement(node, print) {
|
|
537
538
|
this.semicolon();
|
538
539
|
}
|
539
540
|
|
540
|
-
|
541
|
+
function AssignmentExpression(node, print) {
|
541
542
|
// todo: add cases where the spaces can be dropped when in compact mode
|
542
543
|
print(node.left);
|
543
544
|
this.push(" ");
|
544
545
|
this.push(node.operator);
|
545
546
|
this.push(" ");
|
546
547
|
print(node.right);
|
547
|
-
}
|
548
|
+
}
|
549
|
+
|
550
|
+
exports.BinaryExpression = AssignmentExpression;
|
551
|
+
exports.LogicalExpression = AssignmentExpression;
|
552
|
+
exports.AssignmentPattern = AssignmentExpression;
|
548
553
|
|
549
554
|
var SCIENTIFIC_NOTATION = /e/i;
|
550
555
|
|
@@ -945,6 +950,7 @@ var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["defau
|
|
945
950
|
|
946
951
|
exports._params = _params;
|
947
952
|
exports._method = _method;
|
953
|
+
exports.FunctionExpression = FunctionExpression;
|
948
954
|
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
949
955
|
|
950
956
|
var t = _interopRequire(require("../../types"));
|
@@ -995,7 +1001,7 @@ function _method(node, print) {
|
|
995
1001
|
print(value.body);
|
996
1002
|
}
|
997
1003
|
|
998
|
-
|
1004
|
+
function FunctionExpression(node, print) {
|
999
1005
|
if (node.async) this.push("async ");
|
1000
1006
|
this.push("function");
|
1001
1007
|
if (node.generator) this.push("*");
|
@@ -1010,7 +1016,9 @@ exports.FunctionDeclaration = exports.FunctionExpression = function (node, print
|
|
1010
1016
|
this._params(node, print);
|
1011
1017
|
this.space();
|
1012
1018
|
print(node.body);
|
1013
|
-
}
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
exports.FunctionDeclaration = FunctionExpression;
|
1014
1022
|
|
1015
1023
|
function ArrowFunctionExpression(node, print) {
|
1016
1024
|
if (node.async) this.push("async ");
|
@@ -1046,7 +1054,7 @@ function ImportSpecifier(node, print) {
|
|
1046
1054
|
if (t.isSpecifierDefault(node)) {
|
1047
1055
|
print(t.getSpecifierName(node));
|
1048
1056
|
} else {
|
1049
|
-
return
|
1057
|
+
return ExportSpecifier.apply(this, arguments);
|
1050
1058
|
}
|
1051
1059
|
}
|
1052
1060
|
|
@@ -1447,8 +1455,11 @@ exports.__esModule = true;
|
|
1447
1455
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
1448
1456
|
|
1449
1457
|
exports.Identifier = Identifier;
|
1458
|
+
exports.RestElement = RestElement;
|
1450
1459
|
exports.VirtualPropertyExpression = VirtualPropertyExpression;
|
1460
|
+
exports.ObjectExpression = ObjectExpression;
|
1451
1461
|
exports.Property = Property;
|
1462
|
+
exports.ArrayExpression = ArrayExpression;
|
1452
1463
|
exports.Literal = Literal;
|
1453
1464
|
exports._stringLiteral = _stringLiteral;
|
1454
1465
|
|
@@ -1458,10 +1469,13 @@ function Identifier(node) {
|
|
1458
1469
|
this.push(node.name);
|
1459
1470
|
}
|
1460
1471
|
|
1461
|
-
|
1472
|
+
function RestElement(node, print) {
|
1462
1473
|
this.push("...");
|
1463
1474
|
print(node.argument);
|
1464
|
-
}
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
exports.SpreadElement = RestElement;
|
1478
|
+
exports.SpreadProperty = RestElement;
|
1465
1479
|
|
1466
1480
|
function VirtualPropertyExpression(node, print) {
|
1467
1481
|
print(node.object);
|
@@ -1469,7 +1483,7 @@ function VirtualPropertyExpression(node, print) {
|
|
1469
1483
|
print(node.property);
|
1470
1484
|
}
|
1471
1485
|
|
1472
|
-
|
1486
|
+
function ObjectExpression(node, print) {
|
1473
1487
|
var props = node.properties;
|
1474
1488
|
|
1475
1489
|
if (props.length) {
|
@@ -1483,7 +1497,9 @@ exports.ObjectExpression = exports.ObjectPattern = function (node, print) {
|
|
1483
1497
|
} else {
|
1484
1498
|
this.push("{}");
|
1485
1499
|
}
|
1486
|
-
}
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
exports.ObjectPattern = ObjectExpression;
|
1487
1503
|
|
1488
1504
|
function Property(node, print) {
|
1489
1505
|
if (node.method || node.kind === "get" || node.kind === "set") {
|
@@ -1504,7 +1520,7 @@ function Property(node, print) {
|
|
1504
1520
|
}
|
1505
1521
|
}
|
1506
1522
|
|
1507
|
-
|
1523
|
+
function ArrayExpression(node, print) {
|
1508
1524
|
var _this = this;
|
1509
1525
|
|
1510
1526
|
var elems = node.elements;
|
@@ -1528,7 +1544,9 @@ exports.ArrayExpression = exports.ArrayPattern = function (node, print) {
|
|
1528
1544
|
});
|
1529
1545
|
|
1530
1546
|
this.push("]");
|
1531
|
-
}
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
exports.ArrayPattern = ArrayExpression;
|
1532
1550
|
|
1533
1551
|
function Literal(node) {
|
1534
1552
|
var val = node.value;
|
@@ -2752,7 +2770,7 @@ module.exports = function (lines, lineNumber, colNumber) {
|
|
2752
2770
|
return;
|
2753
2771
|
}
|
2754
2772
|
if (colNumber) {
|
2755
|
-
params.line += "\n" + params.before + repeating(" ", params.width) + params.after + repeating(" ", colNumber - 1) + "^";
|
2773
|
+
params.line += "\n" + params.before + "" + repeating(" ", params.width) + "" + params.after + "" + repeating(" ", colNumber - 1) + "^";
|
2756
2774
|
}
|
2757
2775
|
params.before = params.before.replace(/^./, ">");
|
2758
2776
|
}
|
@@ -2820,7 +2838,7 @@ module.exports = function (opts, code, callback) {
|
|
2820
2838
|
} catch (err) {
|
2821
2839
|
if (!err._babel) {
|
2822
2840
|
err._babel = true;
|
2823
|
-
var message = opts.filename + ": " + err.message;
|
2841
|
+
var message = "" + opts.filename + ": " + err.message;
|
2824
2842
|
|
2825
2843
|
var loc = err.loc;
|
2826
2844
|
if (loc) {
|
@@ -2885,14 +2903,14 @@ var messages = exports.messages = {
|
|
2885
2903
|
};
|
2886
2904
|
|
2887
2905
|
function get(key) {
|
2888
|
-
var msg =
|
2889
|
-
if (!msg) throw new ReferenceError("Unknown message
|
2906
|
+
var msg = messages[key];
|
2907
|
+
if (!msg) throw new ReferenceError("Unknown message " + JSON.stringify(key));
|
2890
2908
|
|
2891
2909
|
var args = [];
|
2892
2910
|
for (var i = 1; i < arguments.length; i++) {
|
2893
2911
|
args.push(arguments[i]);
|
2894
2912
|
}
|
2895
|
-
args =
|
2913
|
+
args = parseArgs(args);
|
2896
2914
|
|
2897
2915
|
return msg.replace(/\$(\d+)/g, function (str, i) {
|
2898
2916
|
return args[--i];
|
@@ -3379,6 +3397,13 @@ var File = (function () {
|
|
3379
3397
|
|
3380
3398
|
return _checkNodeWrapper;
|
3381
3399
|
})(function (node, scope) {
|
3400
|
+
if (Array.isArray(node)) {
|
3401
|
+
for (var i = 0; i < node.length; i++) {
|
3402
|
+
this.checkNode(node[i], scope);
|
3403
|
+
}
|
3404
|
+
return;
|
3405
|
+
}
|
3406
|
+
|
3382
3407
|
var stack = this.transformerStack;
|
3383
3408
|
if (!scope) scope = this.scope;
|
3384
3409
|
|
@@ -3422,7 +3447,7 @@ var File = (function () {
|
|
3422
3447
|
|
3423
3448
|
if (this.shebang) {
|
3424
3449
|
// add back shebang
|
3425
|
-
result.code = this.shebang + "\n" + result.code;
|
3450
|
+
result.code = "" + this.shebang + "\n" + result.code;
|
3426
3451
|
}
|
3427
3452
|
|
3428
3453
|
if (opts.sourceMap === "inline") {
|
@@ -4567,7 +4592,7 @@ function has(node) {
|
|
4567
4592
|
|
4568
4593
|
function wrap(node, callback) {
|
4569
4594
|
var useStrictNode;
|
4570
|
-
if (
|
4595
|
+
if (has(node)) {
|
4571
4596
|
useStrictNode = node.body.shift();
|
4572
4597
|
}
|
4573
4598
|
|
@@ -5913,12 +5938,10 @@ function BlockStatement(node, parent, scope, file) {
|
|
5913
5938
|
var letRefs = node._letReferences;
|
5914
5939
|
if (!letRefs) return;
|
5915
5940
|
|
5916
|
-
|
5941
|
+
scope.traverse(node, visitor, {
|
5917
5942
|
letRefs: letRefs,
|
5918
5943
|
file: file
|
5919
|
-
};
|
5920
|
-
|
5921
|
-
scope.traverse(node, visitor, state);
|
5944
|
+
});
|
5922
5945
|
}
|
5923
5946
|
|
5924
5947
|
exports.Program = BlockStatement;
|
@@ -6135,7 +6158,7 @@ var loopVisitor = {
|
|
6135
6158
|
return;
|
6136
6159
|
}
|
6137
6160
|
|
6138
|
-
loopText = loopText + "|" + node.label.name;
|
6161
|
+
loopText = "" + loopText + "|" + node.label.name;
|
6139
6162
|
} else {
|
6140
6163
|
// we shouldn't be transforming these statements because
|
6141
6164
|
// they don't refer to the actual loop we're scopifying
|
@@ -6696,7 +6719,7 @@ var ClassTransformer = (function () {
|
|
6696
6719
|
}
|
6697
6720
|
|
6698
6721
|
// we have no constructor, we have a super, and the super doesn't appear to be falsy
|
6699
|
-
if (!this.hasConstructor && this.hasSuper && t.evaluateTruthy(superName) !== false) {
|
6722
|
+
if (!this.hasConstructor && this.hasSuper && t.evaluateTruthy(superName, this.scope) !== false) {
|
6700
6723
|
var helperName = "class-super-constructor-call";
|
6701
6724
|
if (this.isLoose) helperName += "-loose";
|
6702
6725
|
constructor.body.body.push(util.template(helperName, {
|
@@ -6946,12 +6969,12 @@ exports.ForInStatement = ForOfStatement;
|
|
6946
6969
|
exports.Function = function (node, parent, scope, file) {
|
6947
6970
|
var nodes = [];
|
6948
6971
|
|
6949
|
-
var
|
6972
|
+
var hasDestructuring = false;
|
6950
6973
|
|
6951
6974
|
node.params = node.params.map(function (pattern, i) {
|
6952
6975
|
if (!t.isPattern(pattern)) return pattern;
|
6953
6976
|
|
6954
|
-
|
6977
|
+
hasDestructuring = true;
|
6955
6978
|
var ref = scope.generateUidIdentifier("ref");
|
6956
6979
|
|
6957
6980
|
var destructuring = new DestructuringTransformer({
|
@@ -6959,14 +6982,16 @@ exports.Function = function (node, parent, scope, file) {
|
|
6959
6982
|
nodes: nodes,
|
6960
6983
|
scope: scope,
|
6961
6984
|
file: file,
|
6962
|
-
kind: "
|
6985
|
+
kind: "let"
|
6986
|
+
});
|
6963
6987
|
destructuring.init(pattern, ref);
|
6964
6988
|
|
6965
6989
|
return ref;
|
6966
6990
|
});
|
6967
6991
|
|
6968
|
-
if (!
|
6992
|
+
if (!hasDestructuring) return;
|
6969
6993
|
|
6994
|
+
file.checkNode(nodes);
|
6970
6995
|
t.ensureBlock(node);
|
6971
6996
|
|
6972
6997
|
var block = node.body;
|
@@ -7487,7 +7512,6 @@ var loose = function loose(node, parent, scope, file) {
|
|
7487
7512
|
};
|
7488
7513
|
|
7489
7514
|
var spec = function spec(node, parent, scope, file) {
|
7490
|
-
|
7491
7515
|
var left = node.left;
|
7492
7516
|
var declar;
|
7493
7517
|
|
@@ -7726,7 +7750,7 @@ exports.Function = function (node, parent, scope, file) {
|
|
7726
7750
|
scope.traverse(param, iifeVisitor, state);
|
7727
7751
|
}
|
7728
7752
|
|
7729
|
-
if (file.transformers["es6.blockScopingTDZ"].canRun()) {
|
7753
|
+
if (file.transformers["es6.blockScopingTDZ"].canRun() && t.isIdentifier(param)) {
|
7730
7754
|
pushDefNode(param, t.identifier("undefined"), i);
|
7731
7755
|
}
|
7732
7756
|
|
@@ -7833,7 +7857,7 @@ var hasRest = function hasRest(node) {
|
|
7833
7857
|
return t.isRestElement(node.params[node.params.length - 1]);
|
7834
7858
|
};
|
7835
7859
|
|
7836
|
-
exports.Function = function (node, parent, scope) {
|
7860
|
+
exports.Function = function (node, parent, scope, file) {
|
7837
7861
|
if (!hasRest(node)) return;
|
7838
7862
|
|
7839
7863
|
var rest = node.params.pop().argument;
|
@@ -7847,10 +7871,12 @@ exports.Function = function (node, parent, scope) {
|
|
7847
7871
|
if (t.isPattern(rest)) {
|
7848
7872
|
var pattern = rest;
|
7849
7873
|
rest = scope.generateUidIdentifier("ref");
|
7850
|
-
|
7874
|
+
|
7875
|
+
var declar = t.variableDeclaration("let", pattern.elements.map(function (elem, index) {
|
7851
7876
|
var accessExpr = t.memberExpression(rest, t.literal(index), true);
|
7852
7877
|
return t.variableDeclarator(elem, accessExpr);
|
7853
7878
|
}));
|
7879
|
+
file.checkNode(declar);
|
7854
7880
|
node.body.body.unshift(declar);
|
7855
7881
|
}
|
7856
7882
|
|
@@ -10094,8 +10120,8 @@ function toStatements(node) {
|
|
10094
10120
|
|
10095
10121
|
var optional = exports.optional = true;
|
10096
10122
|
|
10097
|
-
function ConditionalExpression(node) {
|
10098
|
-
var evaluateTest = t.evaluateTruthy(node.test);
|
10123
|
+
function ConditionalExpression(node, parent, scope) {
|
10124
|
+
var evaluateTest = t.evaluateTruthy(node.test, scope);
|
10099
10125
|
if (evaluateTest === true) {
|
10100
10126
|
return node.consequent;
|
10101
10127
|
} else if (evaluateTest === false) {
|
@@ -10104,12 +10130,12 @@ function ConditionalExpression(node) {
|
|
10104
10130
|
}
|
10105
10131
|
|
10106
10132
|
var IfStatement = exports.IfStatement = {
|
10107
|
-
exit: function exit(node) {
|
10133
|
+
exit: function exit(node, parent, scope) {
|
10108
10134
|
var consequent = node.consequent;
|
10109
10135
|
var alternate = node.alternate;
|
10110
10136
|
var test = node.test;
|
10111
10137
|
|
10112
|
-
var evaluateTest = t.evaluateTruthy(test);
|
10138
|
+
var evaluateTest = t.evaluateTruthy(test, scope);
|
10113
10139
|
|
10114
10140
|
// we can check if a test will be truthy 100% and if so then we can inline
|
10115
10141
|
// the consequent and completely ignore the alternate
|
@@ -10152,7 +10178,7 @@ var IfStatement = exports.IfStatement = {
|
|
10152
10178
|
// if (foo) {} else { bar; } -> if (!foo) { bar; }
|
10153
10179
|
//
|
10154
10180
|
|
10155
|
-
if (t.
|
10181
|
+
if (t.isBlockStatement(consequent) && !consequent.body.length && t.isBlockStatement(alternate) && alternate.body.length) {
|
10156
10182
|
node.consequent = node.alternate;
|
10157
10183
|
node.alternate = null;
|
10158
10184
|
node.test = t.unaryExpression("!", test, true);
|
@@ -10191,17 +10217,22 @@ exports.__esModule = true;
|
|
10191
10217
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
10192
10218
|
|
10193
10219
|
exports.Expression = Expression;
|
10220
|
+
exports.Identifier = Identifier;
|
10194
10221
|
|
10195
10222
|
var t = _interopRequire(require("../../../types"));
|
10196
10223
|
|
10197
10224
|
var optional = exports.optional = true;
|
10198
10225
|
|
10199
|
-
function Expression(node) {
|
10200
|
-
var res = t.evaluate(node);
|
10226
|
+
function Expression(node, parent, scope) {
|
10227
|
+
var res = t.evaluate(node, scope);
|
10201
10228
|
if (res.confident) return t.valueToNode(res.value);
|
10202
10229
|
}
|
10203
10230
|
|
10231
|
+
function Identifier() {}
|
10232
|
+
|
10204
10233
|
exports.__esModule = true;
|
10234
|
+
|
10235
|
+
// override Expression
|
10205
10236
|
},{"../../../types":124}],112:[function(require,module,exports){
|
10206
10237
|
"use strict";
|
10207
10238
|
|
@@ -11205,7 +11236,7 @@ var Scope = (function () {
|
|
11205
11236
|
Scope.prototype.registerVariableDeclaration = function registerVariableDeclaration(declar) {
|
11206
11237
|
var declars = declar.declarations;
|
11207
11238
|
for (var i = 0; i < declars.length; i++) {
|
11208
|
-
this.registerBinding(declars[i]
|
11239
|
+
this.registerBinding(declar.kind, declars[i]);
|
11209
11240
|
}
|
11210
11241
|
};
|
11211
11242
|
|
@@ -11418,6 +11449,36 @@ var Scope = (function () {
|
|
11418
11449
|
return binding && binding.identifier;
|
11419
11450
|
};
|
11420
11451
|
|
11452
|
+
Scope.prototype.getOwnImmutableBindingValue = function getOwnImmutableBindingValue(name) {
|
11453
|
+
return this._immutableBindingInfoToValue(this.getOwnBindingInfo(name));
|
11454
|
+
};
|
11455
|
+
|
11456
|
+
Scope.prototype.getImmutableBindingValue = function getImmutableBindingValue(name) {
|
11457
|
+
return this._immutableBindingInfoToValue(this.getBindingInfo(name));
|
11458
|
+
};
|
11459
|
+
|
11460
|
+
Scope.prototype._immutableBindingInfoToValue = function _immutableBindingInfoToValue(info) {
|
11461
|
+
if (!info) return;
|
11462
|
+
|
11463
|
+
// can't guarantee this value is the same
|
11464
|
+
if (info.reassigned) return;
|
11465
|
+
|
11466
|
+
var node = info.node;
|
11467
|
+
if (t.isVariableDeclarator(node)) {
|
11468
|
+
if (t.isIdentifier(node.id)) {
|
11469
|
+
node = node.init;
|
11470
|
+
} else {
|
11471
|
+
// otherwise it's probably a destructuring like:
|
11472
|
+
// var { foo } = "foo";
|
11473
|
+
return;
|
11474
|
+
}
|
11475
|
+
}
|
11476
|
+
|
11477
|
+
if (t.isImmutable(node)) {
|
11478
|
+
return node;
|
11479
|
+
}
|
11480
|
+
};
|
11481
|
+
|
11421
11482
|
// has
|
11422
11483
|
|
11423
11484
|
Scope.prototype.hasOwnBinding = function hasOwnBinding(name) {
|
@@ -12564,6 +12625,35 @@ t.isScope = function (node, parent) {
|
|
12564
12625
|
return t.isScopable(node);
|
12565
12626
|
};
|
12566
12627
|
|
12628
|
+
/**
|
12629
|
+
* Description
|
12630
|
+
*
|
12631
|
+
* @param {Node} node
|
12632
|
+
* @returns {Boolean}
|
12633
|
+
*/
|
12634
|
+
|
12635
|
+
t.isImmutable = function (node) {
|
12636
|
+
if (t.isLiteral(node)) {
|
12637
|
+
if (node.regex) {
|
12638
|
+
// regexes are mutable
|
12639
|
+
return false;
|
12640
|
+
} else {
|
12641
|
+
// immutable!
|
12642
|
+
return true;
|
12643
|
+
}
|
12644
|
+
} else if (t.isIdentifier(node)) {
|
12645
|
+
if (node.name === "undefined") {
|
12646
|
+
// immutable!
|
12647
|
+
return true;
|
12648
|
+
} else {
|
12649
|
+
// no idea...
|
12650
|
+
return false;
|
12651
|
+
}
|
12652
|
+
}
|
12653
|
+
|
12654
|
+
return false;
|
12655
|
+
};
|
12656
|
+
|
12567
12657
|
/**
|
12568
12658
|
* Walk the input `node` and statically evaluate if it's truthy.
|
12569
12659
|
*
|
@@ -12581,11 +12671,12 @@ t.isScope = function (node, parent) {
|
|
12581
12671
|
* if (!t.evaluateTruthy(node)) falsyLogic();
|
12582
12672
|
*
|
12583
12673
|
* @param {Node} node
|
12674
|
+
* @param {Scope} scope
|
12584
12675
|
* @returns {Boolean}
|
12585
12676
|
*/
|
12586
12677
|
|
12587
|
-
t.evaluateTruthy = function (node) {
|
12588
|
-
var res = t.evaluate(node);
|
12678
|
+
t.evaluateTruthy = function (node, scope) {
|
12679
|
+
var res = t.evaluate(node, scope);
|
12589
12680
|
if (res.confident) return !!res.value;
|
12590
12681
|
};
|
12591
12682
|
|
@@ -12603,10 +12694,11 @@ t.evaluateTruthy = function (node) {
|
|
12603
12694
|
* t.evaluate(parse("foo + foo")) // { confident: false, value: undefined }
|
12604
12695
|
*
|
12605
12696
|
* @param {Node} node
|
12697
|
+
* @param {Scope} scope
|
12606
12698
|
* @returns {Object}
|
12607
12699
|
*/
|
12608
12700
|
|
12609
|
-
t.evaluate = function (node) {
|
12701
|
+
t.evaluate = function (node, scope) {
|
12610
12702
|
var confident = true;
|
12611
12703
|
|
12612
12704
|
var value = evaluate(node);
|
@@ -12637,8 +12729,12 @@ t.evaluate = function (node) {
|
|
12637
12729
|
}
|
12638
12730
|
}
|
12639
12731
|
|
12640
|
-
if (t.isIdentifier(node
|
12641
|
-
|
12732
|
+
if (t.isIdentifier(node)) {
|
12733
|
+
if (node.name === "undefined") {
|
12734
|
+
return undefined;
|
12735
|
+
} else {
|
12736
|
+
return evaluate(scope.getImmutableBindingValue(node.name));
|
12737
|
+
}
|
12642
12738
|
}
|
12643
12739
|
|
12644
12740
|
if (t.isUnaryExpression(node, { prefix: true })) {
|
@@ -12921,7 +13017,7 @@ exports.inspect = _util.inspect;
|
|
12921
13017
|
var debug = exports.debug = buildDebug("babel");
|
12922
13018
|
|
12923
13019
|
function canCompile(filename, altExts) {
|
12924
|
-
var exts = altExts ||
|
13020
|
+
var exts = altExts || canCompile.EXTENSIONS;
|
12925
13021
|
var ext = path.extname(filename);
|
12926
13022
|
return contains(exts, ext);
|
12927
13023
|
}
|
@@ -12951,7 +13047,7 @@ function regexify(val) {
|
|
12951
13047
|
function arrayify(val) {
|
12952
13048
|
if (!val) return [];
|
12953
13049
|
if (isBoolean(val)) return [val];
|
12954
|
-
if (isString(val)) return
|
13050
|
+
if (isString(val)) return list(val);
|
12955
13051
|
if (Array.isArray(val)) return val;
|
12956
13052
|
throw new TypeError("illegal type for arrayify");
|
12957
13053
|
}
|
@@ -18347,7 +18443,7 @@ def("ArrowFunctionExpression")
|
|
18347
18443
|
.field("id", null, defaults["null"])
|
18348
18444
|
// The current spec forbids arrow generators, so I have taken the
|
18349
18445
|
// liberty of enforcing that. TODO Report this.
|
18350
|
-
.field("generator", false);
|
18446
|
+
.field("generator", false, defaults["false"]);
|
18351
18447
|
|
18352
18448
|
def("YieldExpression")
|
18353
18449
|
.bases("Expression")
|
@@ -43046,8 +43142,23 @@ define(function (require, exports, module) {
|
|
43046
43142
|
return -1;
|
43047
43143
|
}
|
43048
43144
|
|
43049
|
-
|
43050
|
-
|
43145
|
+
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
|
43146
|
+
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
|
43147
|
+
if (index < 0) {
|
43148
|
+
return -1;
|
43149
|
+
}
|
43150
|
+
|
43151
|
+
// We have found either the exact element, or the next-closest element than
|
43152
|
+
// the one we are searching for. However, there may be more than one such
|
43153
|
+
// element. Make sure we always return the smallest of these.
|
43154
|
+
while (index - 1 >= 0) {
|
43155
|
+
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
43156
|
+
break;
|
43157
|
+
}
|
43158
|
+
--index;
|
43159
|
+
}
|
43160
|
+
|
43161
|
+
return index;
|
43051
43162
|
};
|
43052
43163
|
|
43053
43164
|
});
|
@@ -43495,7 +43606,7 @@ define(function (require, exports, module) {
|
|
43495
43606
|
var index = 0;
|
43496
43607
|
var cachedValues = {};
|
43497
43608
|
var temp = {};
|
43498
|
-
var mapping, str, values, end;
|
43609
|
+
var mapping, str, values, end, value;
|
43499
43610
|
|
43500
43611
|
while (index < length) {
|
43501
43612
|
if (aStr.charAt(index) === ';') {
|
@@ -45172,7 +45283,7 @@ define(function (require, exports, module) {
|
|
45172
45283
|
return cmp;
|
45173
45284
|
}
|
45174
45285
|
|
45175
|
-
cmp =
|
45286
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
45176
45287
|
if (cmp) {
|
45177
45288
|
return cmp;
|
45178
45289
|
}
|
@@ -45182,7 +45293,7 @@ define(function (require, exports, module) {
|
|
45182
45293
|
return cmp;
|
45183
45294
|
}
|
45184
45295
|
|
45185
|
-
return mappingA.
|
45296
|
+
return strcmp(mappingA.name, mappingB.name);
|
45186
45297
|
};
|
45187
45298
|
exports.compareByOriginalPositions = compareByOriginalPositions;
|
45188
45299
|
|
@@ -45542,7 +45653,7 @@ module.exports = function (str) {
|
|
45542
45653
|
module.exports={
|
45543
45654
|
"name": "babel",
|
45544
45655
|
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
45545
|
-
"version": "4.6.
|
45656
|
+
"version": "4.6.6",
|
45546
45657
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
45547
45658
|
"homepage": "https://babeljs.io/",
|
45548
45659
|
"repository": "babel/babel",
|
data/lib/babel/source.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babel-source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian McKenzie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: sebmck@gmail.com
|