babel-source 5.6.4 → 5.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/lib/babel.js +75 -48
  3. data/lib/babel/source.rb +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzFjODEzNzE4NmYxNGVmODU3NDJhNGI5OTMyOWMwYTUxYzM3ZGE2ZQ==
4
+ N2MyMDM2NmZiNjMxYzM3MDE4Yzc4ZDE1ZTY0M2M5ZTA5ZDI5Nzc4Mw==
5
5
  data.tar.gz: !binary |-
6
- ZjVmZmRhNWJiNmUzNGE0NTc3OWFkNjViMjlhYzNmN2ZhY2ZhOTE4OQ==
6
+ OWY1OTI1Y2RmOThkMTliYjlhYjk5MWQ2MDU0NmRmNWZjMmZlYzRkYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGE3MGVhZTg5YzkwMTEyYjk4ZmMyMjcxYzc4M2RkNzYyOTRkZjM4YTlmZWEy
10
- Y2EzZTk4OGE2YjhjZTFmMTgxNzQwZWIyM2NlZmMwMTFkM2NmYzE4NmRhODE2
11
- MTY1ZTk4OTI0ZGJhMDMzNjkxMGIzZTQyNThmZTg5MGNkYmYwMWE=
9
+ MjlhZjFkYjJjNDY0NTgyMDdlM2IxODg1YWNjZTQxODUyMDMyNDhlMGQ2MzY2
10
+ ODRhYmMxMTczYTNmZGRjOGFkMDE5YWIwZmM3YjllYjQ1NGMzYzU4NmQ0NmEy
11
+ OTM5ZDczNDFmM2FlODljMmE5Nzg0OGY3NGFhYjhhODEyNGQyNmE=
12
12
  data.tar.gz: !binary |-
13
- NGE1NjNmY2IzMGZkY2Y3YjdiZjNiNjdmNWVhZGIxMDIzY2MxMmRkMGU2ODQ3
14
- YjU3MTQ0MmQyNWM0OTY5ZTRjMmQ2NjY1NjQ1YzFjYWNjNjJlN2Y3OTU3NGFi
15
- OTBlYWRlNWQxNDBkZTViMmI3YTQwNGQ4ZjIyYzAwNDI0YzQzMzE=
13
+ ZmIwZGZhMjQyZmIyZWIxNGFlZDUwMzdmM2FjM2NkZjI2ZWNlMGVjNjUyNTNk
14
+ YzIyMDU5NzcxZTQxMmQ5MmVmZWMzZTAxNmNiNDAyNDk5ZTAxZmQ2ZTkzZTJj
15
+ MTMxNzcyOWRkZGE3NjJkOTljNmVhYjAzOGE0ZjdlM2RjNmVlZDA=
@@ -5940,13 +5940,13 @@ function ForStatement(node, print) {
5940
5940
  this.push(";");
5941
5941
 
5942
5942
  if (node.test) {
5943
- this.push(" ");
5943
+ this.space();
5944
5944
  print.plain(node.test);
5945
5945
  }
5946
5946
  this.push(";");
5947
5947
 
5948
5948
  if (node.update) {
5949
- this.push(" ");
5949
+ this.space();
5950
5950
  print.plain(node.update);
5951
5951
  }
5952
5952
 
@@ -15120,9 +15120,10 @@ var memberExpressionOptimisationVisitor = {
15120
15120
  Function: function Function(node, parent, scope, state) {
15121
15121
  // skip over functions as whatever `arguments` we reference inside will refer
15122
15122
  // to the wrong function
15123
+ var oldNoOptimise = state.noOptimise;
15123
15124
  state.noOptimise = true;
15124
15125
  this.traverse(memberExpressionOptimisationVisitor, state);
15125
- state.noOptimise = false;
15126
+ state.noOptimise = oldNoOptimise;
15126
15127
  this.skip();
15127
15128
  },
15128
15129
 
@@ -15135,7 +15136,9 @@ var memberExpressionOptimisationVisitor = {
15135
15136
  // is this a referenced identifier and is it referencing the rest parameter?
15136
15137
  if (node.name !== state.name) return;
15137
15138
 
15138
- if (!state.noOptimise) {
15139
+ if (state.noOptimise) {
15140
+ state.deopted = true;
15141
+ } else {
15139
15142
  if (this.parentPath.isMemberExpression({ computed: true, object: node })) {
15140
15143
  // if we know that this member expression is referencing a number then we can safely
15141
15144
  // optimise it
@@ -15154,11 +15157,7 @@ var memberExpressionOptimisationVisitor = {
15154
15157
  return;
15155
15158
  }
15156
15159
  }
15157
- }
15158
15160
 
15159
- if (state.noOptimise) {
15160
- state.deopted = true;
15161
- } else {
15162
15161
  state.references.push(this);
15163
15162
  }
15164
15163
  }
@@ -19209,6 +19208,7 @@ exports.__esModule = true;
19209
19208
  exports.getTypeAnnotation = getTypeAnnotation;
19210
19209
  exports._getTypeAnnotation = _getTypeAnnotation;
19211
19210
  exports.isBaseType = isBaseType;
19211
+ exports.couldBeBaseType = couldBeBaseType;
19212
19212
  exports.isGenericType = isGenericType;
19213
19213
 
19214
19214
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
@@ -19281,9 +19281,11 @@ function _getTypeAnnotation() {
19281
19281
  * Description
19282
19282
  */
19283
19283
 
19284
- function isBaseType(baseName) {
19285
- var type = this.getTypeAnnotation();
19284
+ function isBaseType(baseName, soft) {
19285
+ return _isBaseType(baseName, this.getTypeAnnotation(), soft);
19286
+ }
19286
19287
 
19288
+ function _isBaseType(baseName, type, soft) {
19287
19289
  if (baseName === "string") {
19288
19290
  return t.isStringTypeAnnotation(type);
19289
19291
  } else if (baseName === "number") {
@@ -19295,7 +19297,34 @@ function isBaseType(baseName) {
19295
19297
  } else if (baseName === "mixed") {
19296
19298
  return t.isMixedTypeAnnotation(type);
19297
19299
  } else {
19298
- throw new Error("Unknown base type " + baseName);
19300
+ if (soft) {
19301
+ return false;
19302
+ } else {
19303
+ throw new Error("Unknown base type " + baseName);
19304
+ }
19305
+ }
19306
+ }
19307
+
19308
+ /**
19309
+ * Description
19310
+ */
19311
+
19312
+ function couldBeBaseType(name) {
19313
+ var type = this.getTypeAnnotation();
19314
+ if (t.isAnyTypeAnnotation(type)) return true;
19315
+
19316
+ if (t.isUnionTypeAnnotation(type)) {
19317
+ var _arr = type.types;
19318
+
19319
+ for (var _i = 0; _i < _arr.length; _i++) {
19320
+ var type2 = _arr[_i];
19321
+ if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
19322
+ return true;
19323
+ }
19324
+ }
19325
+ return false;
19326
+ } else {
19327
+ return _isBaseType(name, type, true);
19299
19328
  }
19300
19329
  }
19301
19330
 
@@ -23654,7 +23683,7 @@ function isReferenced(node, parent) {
23654
23683
  switch (parent.type) {
23655
23684
  // yes: PARENT[NODE]
23656
23685
  // yes: NODE.child
23657
- // no: parent.CHILD
23686
+ // no: parent.NODE
23658
23687
  case "MemberExpression":
23659
23688
  case "JSXMemberExpression":
23660
23689
  if (parent.property === node && parent.computed) {
@@ -23707,21 +23736,17 @@ function isReferenced(node, parent) {
23707
23736
  return parent.local === node;
23708
23737
  }
23709
23738
 
23710
- // no: import NODE from "foo";
23711
- case "ImportDefaultSpecifier":
23712
- return false;
23713
-
23714
- // no: import * as NODE from "foo";
23715
- case "ImportNamespaceSpecifier":
23716
- return false;
23717
-
23718
23739
  // no: <div NODE="foo" />
23719
23740
  case "JSXAttribute":
23720
23741
  return parent.name !== node;
23721
23742
 
23743
+ // no: import NODE from "foo";
23744
+ // no: import * as NODE from "foo";
23722
23745
  // no: import { NODE as foo } from "foo";
23723
23746
  // no: import { foo as NODE } from "foo";
23724
23747
  // no: import NODE from "bar";
23748
+ case "ImportDefaultSpecifier":
23749
+ case "ImportNamespaceSpecifier":
23725
23750
  case "ImportSpecifier":
23726
23751
  return false;
23727
23752
 
@@ -23746,12 +23771,16 @@ function isReferenced(node, parent) {
23746
23771
  case "RestElement":
23747
23772
  return false;
23748
23773
 
23749
- // no: [NODE = foo] = [];
23750
- // yes: [foo = NODE] = [];
23774
+ // yes: left = NODE;
23775
+ // no: NODE = right;
23751
23776
  case "AssignmentExpression":
23752
- case "AssignmentPattern":
23753
23777
  return parent.right === node;
23754
23778
 
23779
+ // no: [NODE = foo] = [];
23780
+ // no: [foo = NODE] = [];
23781
+ case "AssignmentPattern":
23782
+ return false;
23783
+
23755
23784
  // no: [NODE] = [];
23756
23785
  // no: ({ NODE }) = [];
23757
23786
  case "ObjectPattern":
@@ -23828,7 +23857,7 @@ function isImmutable(node) {
23828
23857
 
23829
23858
  if (t.isLiteral(node)) {
23830
23859
  if (node.regex) {
23831
- // regexes are mutable
23860
+ // regexs are mutable
23832
23861
  return false;
23833
23862
  } else {
23834
23863
  // immutable!
@@ -48758,7 +48787,8 @@ exports.isReference = function(path, name) {
48758
48787
  return false;
48759
48788
  }
48760
48789
 
48761
- if (parent.params === path.parentPath &&
48790
+ if (path.parentPath.name === "params" &&
48791
+ parent.params === path.parentPath.value &&
48762
48792
  parent.params[path.name] === node) {
48763
48793
  return false;
48764
48794
  }
@@ -48809,7 +48839,8 @@ var isObject = types.builtInTypes.object;
48809
48839
  var NodePath = types.NodePath;
48810
48840
  var hoist = require("./hoist").hoist;
48811
48841
  var Emitter = require("./emit").Emitter;
48812
- var runtimeProperty = require("./util").runtimeProperty;
48842
+ var util = require("./util");
48843
+ var runtimeProperty = util.runtimeProperty;
48813
48844
  var getMarkInfo = require("private").makeAccessor();
48814
48845
 
48815
48846
  exports.transform = function transform(node, options) {
@@ -48901,10 +48932,13 @@ var visitor = types.PathVisitor.fromMethodsObject({
48901
48932
  var innerFnId = b.identifier(node.id.name + "$");
48902
48933
  var contextId = path.scope.declareTemporary("context$");
48903
48934
  var argsId = path.scope.declareTemporary("args$");
48904
- var shouldAliasArguments = renameArguments(path, argsId);
48935
+
48936
+ // Turn all declarations into vars, and replace the original
48937
+ // declarations with equivalent assignment expressions.
48905
48938
  var vars = hoist(path);
48906
48939
 
48907
- if (shouldAliasArguments) {
48940
+ var didRenameArguments = renameArguments(path, argsId);
48941
+ if (didRenameArguments) {
48908
48942
  vars = vars || b.variableDeclaration("var", []);
48909
48943
  vars.declarations.push(b.variableDeclarator(
48910
48944
  argsId, b.identifier("arguments")
@@ -49123,13 +49157,11 @@ function shouldNotHoistAbove(stmtPath) {
49123
49157
  function renameArguments(funcPath, argsId) {
49124
49158
  assert.ok(funcPath instanceof types.NodePath);
49125
49159
  var func = funcPath.value;
49126
- var didReplaceArguments = false;
49127
- var hasImplicitArguments = false;
49160
+ var didRenameArguments = false;
49128
49161
 
49129
49162
  recast.visit(funcPath, {
49130
49163
  visitFunction: function(path) {
49131
49164
  if (path.value === func) {
49132
- hasImplicitArguments = !path.scope.lookup("arguments");
49133
49165
  this.traverse(path);
49134
49166
  } else {
49135
49167
  return false;
@@ -49137,27 +49169,22 @@ function renameArguments(funcPath, argsId) {
49137
49169
  },
49138
49170
 
49139
49171
  visitIdentifier: function(path) {
49140
- if (path.value.name === "arguments") {
49141
- var isMemberProperty =
49142
- n.MemberExpression.check(path.parent.node) &&
49143
- path.name === "property" &&
49144
- !path.parent.node.computed;
49145
-
49146
- if (!isMemberProperty) {
49147
- path.replace(argsId);
49148
- didReplaceArguments = true;
49149
- return false;
49150
- }
49172
+ if (path.value.name === "arguments" &&
49173
+ util.isReference(path)) {
49174
+ path.replace(argsId);
49175
+ didRenameArguments = true;
49176
+ return false;
49151
49177
  }
49152
49178
 
49153
49179
  this.traverse(path);
49154
49180
  }
49155
49181
  });
49156
49182
 
49157
- // If the traversal replaced any arguments identifiers, and those
49158
- // identifiers were free variables, then we need to alias the outer
49159
- // function's arguments object to the variable named by argsId.
49160
- return didReplaceArguments && hasImplicitArguments;
49183
+ // If the traversal replaced any arguments references, then we need to
49184
+ // alias the outer function's arguments binding (be it the implicit
49185
+ // arguments object or some other parameter or variable) to the variable
49186
+ // named by argsId.
49187
+ return didRenameArguments;
49161
49188
  }
49162
49189
 
49163
49190
  var awaitVisitor = types.PathVisitor.fromMethodsObject({
@@ -62896,7 +62923,7 @@ module.exports = function (str) {
62896
62923
  module.exports={
62897
62924
  "name": "babel-core",
62898
62925
  "description": "A compiler for writing next generation JavaScript",
62899
- "version": "5.6.4",
62926
+ "version": "5.6.5",
62900
62927
  "author": "Sebastian McKenzie <sebmck@gmail.com>",
62901
62928
  "homepage": "https://babeljs.io/",
62902
62929
  "license": "MIT",
@@ -62959,7 +62986,7 @@ module.exports={
62959
62986
  "output-file-sync": "^1.1.0",
62960
62987
  "path-is-absolute": "^1.0.0",
62961
62988
  "private": "^0.1.6",
62962
- "regenerator": "0.8.30",
62989
+ "regenerator": "0.8.31",
62963
62990
  "regexpu": "^1.1.2",
62964
62991
  "repeating": "^1.1.2",
62965
62992
  "resolve": "^1.1.6",
@@ -1,7 +1,7 @@
1
1
  module Babel
2
2
  module Source
3
- VERSION = "5.6.4"
4
- DATE = Time.at(1435001892)
3
+ VERSION = "5.6.5"
4
+ DATE = Time.at(1435150074)
5
5
  PATH = File.expand_path("../..", __FILE__)
6
6
  end
7
7
  end
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: 5.6.4
4
+ version: 5.6.5
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-06-22 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: sebmck@gmail.com