Browse Source

Take references to other scopes into account when deconflicting.

gh-109
Oskar Segersvärd 10 years ago
parent
commit
98b6176c63
  1. 12
      src/Scope.js

12
src/Scope.js

@ -48,6 +48,18 @@ export default class Scope {
deconflict ( rename = underscorePrefix ) {
const names = this.used;
this.ids.filter( ref => ref instanceof Reference ).forEach( ref => {
// Same scope.
if ( ref.scope.ids === this.ids ) return;
// Another scope!
while ( ref instanceof Reference ) {
ref = dereference( ref );
}
names[ ref.name ] = ref;
});
this.ids.filter( isntReference ).forEach( id => {
if ( typeof id === 'string' ) {
throw new Error( `Required name ${id} undefined!` );

Loading…
Cancel
Save