Comparing version 0.13.1 to 0.13.2
# buble changelog | ||
## 0.13.2 | ||
* Fix spread operator when used with `new` and `this` ([#104](https://gitlab.com/Rich-Harris/buble/issues/104), [#115](https://gitlab.com/Rich-Harris/buble/issues/115)) | ||
## 0.13.1 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "The blazing fast, batteries-included ES2015 compiler", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -167,3 +167,3 @@ import wrap from './wrap.js'; | ||
} else if ( transforms.arrow ) { | ||
code.insertRight( expr.start, `{ return ` ); | ||
code.insertLeft( expr.start, `{ return ` ); | ||
code.insertLeft( expr.end, `; }` ); | ||
@@ -170,0 +170,0 @@ } |
@@ -41,4 +41,2 @@ import Node from '../Node.js'; | ||
context = this.callee.object.name; | ||
} else if ( this.callee.object.type === 'ThisExpression' ) { | ||
context = 'this'; | ||
} else { | ||
@@ -52,5 +50,5 @@ context = this.findScope( true ).createIdentifier( 'ref' ); | ||
const i0 = lastStatementInBlock.getIndentation(); | ||
code.insertLeft( callExpression.start, `(${context} = ` ); | ||
code.insertRight( callExpression.end, `)` ); | ||
code.insertRight( lastStatementInBlock.end, `\n${i0}var ${context};` ); | ||
code.insertRight( callExpression.start, `(${context} = ` ); | ||
code.insertLeft( callExpression.end, `)` ); | ||
code.insertLeft( lastStatementInBlock.end, `\n${i0}var ${context};` ); | ||
} | ||
@@ -57,0 +55,0 @@ } else { |
@@ -31,2 +31,3 @@ import ArrayExpression from './ArrayExpression.js'; | ||
import MemberExpression from './MemberExpression.js'; | ||
import NewExpression from './NewExpression.js'; | ||
import ObjectExpression from './ObjectExpression.js'; | ||
@@ -73,5 +74,6 @@ import Property from './Property.js'; | ||
JSXOpeningElement, | ||
JSXSpreadAttribute, | ||
JSXSpreadAttribute, | ||
Literal, | ||
MemberExpression, | ||
NewExpression, | ||
ObjectExpression, | ||
@@ -78,0 +80,0 @@ Property, |
@@ -5,3 +5,5 @@ export const matrix = { | ||
49: 0b1001111111111100111111111111111, | ||
50: 0b1011111111111100111111111111111 | ||
50: 0b1011111111111100111111111111111, | ||
51: 0b1011111111111100111111111111111, | ||
52: 0b1111111111111100111111111111111 | ||
}, | ||
@@ -11,3 +13,6 @@ firefox: { | ||
44: 0b1000111111101100000110111011101, | ||
45: 0b1000111111101100000110111011101 | ||
45: 0b1000111111101100000110111011101, | ||
46: 0b1010111111111100000110111011101, | ||
47: 0b1010111111111100111111111011111, | ||
48: 0b1010111111111100111111111011111 | ||
}, | ||
@@ -14,0 +19,0 @@ safari: { |
@@ -5,3 +5,3 @@ export function isArguments ( node ) { | ||
export default function spread ( code, elements, start, argumentsArrayAlias ) { | ||
export default function spread ( code, elements, start, argumentsArrayAlias, isNew ) { | ||
let i = elements.length; | ||
@@ -23,2 +23,16 @@ let firstSpreadIndex = -1; | ||
if (isNew) { | ||
for ( i = 0; i < elements.length; i += 1 ) { | ||
let element = elements[i]; | ||
if ( element.type === 'SpreadElement' ) { | ||
code.remove( element.start, element.argument.start ); | ||
} else { | ||
code.insertRight( element.start, '[' ); | ||
code.insertRight( element.end, ']' ); | ||
} | ||
} | ||
return true; // true indicates some spread elements | ||
} | ||
let element = elements[ firstSpreadIndex ]; | ||
@@ -25,0 +39,0 @@ const previousElement = elements[ firstSpreadIndex - 1 ]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2489623
80
25021
0
29