mirror of https://github.com/lukechilds/rollup.git
5 changed files with 41 additions and 30 deletions
@ -0,0 +1,30 @@ |
|||||
|
export class Reference { |
||||
|
constructor ( node, scope, statement ) { |
||||
|
this.node = node; |
||||
|
this.scope = scope; |
||||
|
this.statement = statement; |
||||
|
|
||||
|
this.declaration = null; // bound later
|
||||
|
|
||||
|
this.parts = []; |
||||
|
|
||||
|
let root = node; |
||||
|
while ( root.type === 'MemberExpression' ) { |
||||
|
this.parts.unshift( root.property.name ); |
||||
|
root = root.object; |
||||
|
} |
||||
|
|
||||
|
this.name = root.name; |
||||
|
|
||||
|
this.start = node.start; |
||||
|
this.end = node.start + this.name.length; // can be overridden in the case of namespace members
|
||||
|
this.rewritten = false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export class SyntheticReference { |
||||
|
constructor ( name ) { |
||||
|
this.name = name; |
||||
|
this.parts = []; |
||||
|
} |
||||
|
} |
@ -1,6 +1,5 @@ |
|||||
import * as second from './second'; |
import * as second from './second'; |
||||
|
|
||||
assert.equal(second.first.value, 42); |
assert.equal( second.first.value, 42 ); |
||||
assert.deepEqual(second, {first: {value: 42}}) |
console.log( 'second', second ) |
||||
//console.log("second", second)
|
assert.deepEqual( second, { first: { value: 42 } }); |
||||
//console.log("first", second.first)
|
|
||||
|
Loading…
Reference in new issue