Comparing version 0.12.3 to 0.12.4
# buble changelog | ||
## 0.12.4 | ||
* Allow references to precede declaration (inside function) in block scoping ([#87](https://gitlab.com/Rich-Harris/buble/issues/87)) | ||
## 0.12.3 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "buble", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"description": "The blazing fast, batteries-included ES2015 compiler", | ||
@@ -5,0 +5,0 @@ "main": "dist/buble.umd.js", |
@@ -42,2 +42,4 @@ import wrap from './wrap.js'; | ||
this.body.forEach( node => node.initialise( transforms ) ); | ||
this.scope.consolidate(); | ||
} | ||
@@ -44,0 +46,0 @@ |
@@ -17,2 +17,3 @@ import extractNames from './extractNames.js'; | ||
this.identifiers = []; | ||
this.declarations = Object.create( null ); | ||
@@ -45,2 +46,19 @@ this.references = Object.create( null ); | ||
addReference ( identifier ) { | ||
if ( this.consolidated ) { | ||
this.consolidateReference( identifier ); | ||
} else { | ||
this.identifiers.push( identifier ); | ||
} | ||
}, | ||
consolidate () { | ||
for ( let i = 0; i < this.identifiers.length; i += 1 ) { // we might push to the array during consolidation, so don't cache length | ||
const identifier = this.identifiers[i]; | ||
this.consolidateReference( identifier ); | ||
} | ||
this.consolidated = true; // TODO understand why this is necessary... seems bad | ||
}, | ||
consolidateReference ( identifier ) { | ||
const declaration = this.declarations[ identifier.name ]; | ||
@@ -47,0 +65,0 @@ if ( declaration ) { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2466311
24709
0