@@ -2271,16 +2271,13 @@ namespace ts {
2271
2271
function isExportsOrModuleExportsOrAlias ( node : Node ) : boolean {
2272
2272
return isExportsIdentifier ( node ) ||
2273
2273
isModuleExportsPropertyAccessExpression ( node ) ||
2274
- isNameOfExportsOrModuleExportsAliasDeclaration ( node ) ;
2274
+ isIdentifier ( node ) && isNameOfExportsOrModuleExportsAliasDeclaration ( node ) ;
2275
2275
}
2276
2276
2277
- function isNameOfExportsOrModuleExportsAliasDeclaration ( node : Node ) {
2278
- if ( isIdentifier ( node ) ) {
2279
- const symbol = lookupSymbolForName ( node . escapedText ) ;
2280
- return symbol && symbol . valueDeclaration && isVariableDeclaration ( symbol . valueDeclaration ) &&
2281
- symbol . valueDeclaration . initializer && isExportsOrModuleExportsOrAliasOrAssignment ( symbol . valueDeclaration . initializer ) ;
2282
- }
2283
- return false ;
2277
+ function isNameOfExportsOrModuleExportsAliasDeclaration ( node : Identifier ) : boolean {
2278
+ const symbol = lookupSymbolForName ( node . escapedText ) ;
2279
+ return symbol && symbol . valueDeclaration && isVariableDeclaration ( symbol . valueDeclaration ) &&
2280
+ symbol . valueDeclaration . initializer && isExportsOrModuleExportsOrAliasOrAssignment ( symbol . valueDeclaration . initializer ) ;
2284
2281
}
2285
2282
2286
2283
function isExportsOrModuleExportsOrAliasOrAssignment ( node : Node ) : boolean {
@@ -2354,20 +2351,22 @@ namespace ts {
2354
2351
// Look up the function in the local scope, since prototype assignments should
2355
2352
// follow the function declaration
2356
2353
const leftSideOfAssignment = node . left as PropertyAccessExpression ;
2357
- const target = leftSideOfAssignment . expression as Identifier ;
2354
+ const target = leftSideOfAssignment . expression ;
2358
2355
2359
- // Fix up parent pointers since we're going to use these nodes before we bind into them
2360
- leftSideOfAssignment . parent = node ;
2361
- target . parent = leftSideOfAssignment ;
2356
+ if ( isIdentifier ( target ) ) {
2357
+ // Fix up parent pointers since we're going to use these nodes before we bind into them
2358
+ leftSideOfAssignment . parent = node ;
2359
+ target . parent = leftSideOfAssignment ;
2362
2360
2363
- if ( isNameOfExportsOrModuleExportsAliasDeclaration ( target ) ) {
2364
- // This can be an alias for the 'exports' or 'module.exports' names, e.g.
2365
- // var util = module.exports;
2366
- // util.property = function ...
2367
- bindExportsPropertyAssignment ( node ) ;
2368
- }
2369
- else {
2370
- bindPropertyAssignment ( target . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2361
+ if ( isNameOfExportsOrModuleExportsAliasDeclaration ( target ) ) {
2362
+ // This can be an alias for the 'exports' or 'module.exports' names, e.g.
2363
+ // var util = module.exports;
2364
+ // util.property = function ...
2365
+ bindExportsPropertyAssignment ( node ) ;
2366
+ }
2367
+ else {
2368
+ bindPropertyAssignment ( target . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2369
+ }
2371
2370
}
2372
2371
}
2373
2372
0 commit comments