babel-plugin-transform-es2015-parameters
Advanced tools
Comparing version 7.0.0-alpha.14 to 7.0.0-alpha.15
@@ -20,5 +20,5 @@ "use strict"; | ||
var restIndex = (0, _babelTemplate2.default)("\n ARGUMENTS.length <= INDEX ? undefined : ARGUMENTS[INDEX]\n"); | ||
var restIndex = (0, _babelTemplate2.default)("\n (INDEX < OFFSET || ARGUMENTS.length <= INDEX) ? undefined : ARGUMENTS[INDEX]\n"); | ||
var restIndexImpure = (0, _babelTemplate2.default)("\n REF = INDEX, ARGUMENTS.length <= REF ? undefined : ARGUMENTS[REF]\n"); | ||
var restIndexImpure = (0, _babelTemplate2.default)("\n REF = INDEX, (REF < OFFSET || ARGUMENTS.length <= REF) ? undefined : ARGUMENTS[REF]\n"); | ||
@@ -115,2 +115,3 @@ var restLength = (0, _babelTemplate2.default)("\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n"); | ||
function optimiseIndexGetter(path, argsId, offset) { | ||
var offsetLiteral = t.numericLiteral(offset); | ||
var index = void 0; | ||
@@ -123,3 +124,3 @@ | ||
} else { | ||
index = t.binaryExpression("+", path.parent.property, t.numericLiteral(offset)); | ||
index = t.binaryExpression("+", path.parent.property, offsetLiteral); | ||
} | ||
@@ -134,2 +135,3 @@ | ||
ARGUMENTS: argsId, | ||
OFFSET: offsetLiteral, | ||
INDEX: index, | ||
@@ -139,6 +141,18 @@ REF: temp | ||
} else { | ||
path.parentPath.replaceWith(restIndex({ | ||
var parentPath = path.parentPath; | ||
parentPath.replaceWith(restIndex({ | ||
ARGUMENTS: argsId, | ||
OFFSET: offsetLiteral, | ||
INDEX: index | ||
})); | ||
var offsetTestPath = parentPath.get("test").get("left"); | ||
var valRes = offsetTestPath.evaluate(); | ||
if (valRes.confident) { | ||
if (valRes.value === true) { | ||
parentPath.replaceWith(parentPath.scope.buildUndefinedNode()); | ||
} else { | ||
parentPath.get("test").replaceWith(parentPath.get("test").get("right")); | ||
} | ||
} | ||
} | ||
@@ -145,0 +159,0 @@ } |
{ | ||
"name": "babel-plugin-transform-es2015-parameters", | ||
"version": "7.0.0-alpha.14", | ||
"version": "7.0.0-alpha.15", | ||
"description": "Compile ES2015 default and rest parameters to ES5", | ||
@@ -9,7 +9,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-parameters", | ||
"dependencies": { | ||
"babel-helper-call-delegate": "7.0.0-alpha.14", | ||
"babel-helper-get-function-arity": "7.0.0-alpha.14", | ||
"babel-template": "7.0.0-alpha.14", | ||
"babel-traverse": "7.0.0-alpha.14", | ||
"babel-types": "7.0.0-alpha.14" | ||
"babel-helper-call-delegate": "7.0.0-alpha.15", | ||
"babel-helper-get-function-arity": "7.0.0-alpha.15", | ||
"babel-template": "7.0.0-alpha.15", | ||
"babel-traverse": "7.0.0-alpha.15", | ||
"babel-types": "7.0.0-alpha.15" | ||
}, | ||
@@ -20,4 +20,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.14" | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.15" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17485
387
+ Addedbabel-code-frame@7.0.0-alpha.15(transitive)
+ Addedbabel-helper-call-delegate@7.0.0-alpha.15(transitive)
+ Addedbabel-helper-function-name@7.0.0-alpha.15(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-alpha.15(transitive)
+ Addedbabel-helper-hoist-variables@7.0.0-alpha.15(transitive)
+ Addedbabel-messages@7.0.0-alpha.15(transitive)
+ Addedbabel-template@7.0.0-alpha.15(transitive)
+ Addedbabel-traverse@7.0.0-alpha.15(transitive)
+ Addedbabel-types@7.0.0-alpha.15(transitive)
- Removedbabel-code-frame@7.0.0-alpha.14(transitive)
- Removedbabel-helper-call-delegate@7.0.0-alpha.14(transitive)
- Removedbabel-helper-function-name@7.0.0-alpha.14(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-alpha.14(transitive)
- Removedbabel-helper-hoist-variables@7.0.0-alpha.14(transitive)
- Removedbabel-messages@7.0.0-alpha.14(transitive)
- Removedbabel-template@7.0.0-alpha.14(transitive)
- Removedbabel-traverse@7.0.0-alpha.14(transitive)
- Removedbabel-types@7.0.0-alpha.14(transitive)
Updatedbabel-types@7.0.0-alpha.15