@@ -60,7 +60,7 @@ import {
6060} from "./common" ;
6161
6262/** Indicates whether errors are reported or not. */
63- enum ReportMode {
63+ export enum ReportMode {
6464 /** Report errors. */
6565 REPORT ,
6666 /** Swallow errors. */
@@ -72,10 +72,11 @@ export class Resolver extends DiagnosticEmitter {
7272
7373 /** The program this resolver belongs to. */
7474 program : Program ;
75+
7576 /** Target expression of the previously resolved property or element access. */
76- resolvedThisExpression : Expression | null = null ;
77+ currentThisExpression : Expression | null = null ;
7778 /** Element expression of the previously resolved element access. */
78- resolvedElementExpression : Expression | null = null ;
79+ currentElementExpression : Expression | null = null ;
7980
8081 /** Constructs the resolver for the specified program. */
8182 constructor ( program : Program ) {
@@ -306,8 +307,8 @@ export class Resolver extends DiagnosticEmitter {
306307 case ElementKind . FUNCTION : { // search locals, use prototype
307308 element = ( < Function > context ) . flow . getScopedLocal ( name ) ;
308309 if ( element ) {
309- this . resolvedThisExpression = null ;
310- this . resolvedElementExpression = null ;
310+ this . currentThisExpression = null ;
311+ this . currentElementExpression = null ;
311312 return element ;
312313 }
313314 context = ( < Function > context ) . prototype . parent ;
@@ -324,8 +325,8 @@ export class Resolver extends DiagnosticEmitter {
324325 let members = context . members ;
325326 if ( members ) {
326327 if ( element = members . get ( name ) ) {
327- this . resolvedThisExpression = null ;
328- this . resolvedElementExpression = null ;
328+ this . currentThisExpression = null ;
329+ this . currentElementExpression = null ;
329330 return element ;
330331 }
331332 }
@@ -336,15 +337,15 @@ export class Resolver extends DiagnosticEmitter {
336337 // search current file
337338 var elementsLookup = this . program . elementsLookup ;
338339 if ( element = elementsLookup . get ( identifier . range . source . internalPath + PATH_DELIMITER + name ) ) {
339- this . resolvedThisExpression = null ;
340- this . resolvedElementExpression = null ;
340+ this . currentThisExpression = null ;
341+ this . currentElementExpression = null ;
341342 return element ; // GLOBAL, FUNCTION_PROTOTYPE, CLASS_PROTOTYPE
342343 }
343344
344345 // search global scope
345346 if ( element = elementsLookup . get ( name ) ) {
346- this . resolvedThisExpression = null ;
347- this . resolvedElementExpression = null ;
347+ this . currentThisExpression = null ;
348+ this . currentElementExpression = null ;
348349 return element ; // GLOBAL, FUNCTION_PROTOTYPE, CLASS_PROTOTYPE
349350 }
350351
@@ -407,7 +408,7 @@ export class Resolver extends DiagnosticEmitter {
407408 break ;
408409 }
409410 case ElementKind . CLASS : {
410- let elementExpression = this . resolvedElementExpression ;
411+ let elementExpression = this . currentElementExpression ;
411412 if ( elementExpression ) {
412413 let indexedGet = ( < Class > target ) . lookupOverload ( OperatorKind . INDEXED_GET ) ;
413414 if ( ! indexedGet ) {
@@ -438,8 +439,8 @@ export class Resolver extends DiagnosticEmitter {
438439 let members = target . members ;
439440 let member : Element | null ;
440441 if ( members && ( member = members . get ( propertyName ) ) ) {
441- this . resolvedThisExpression = targetExpression ;
442- this . resolvedElementExpression = null ;
442+ this . currentThisExpression = targetExpression ;
443+ this . currentElementExpression = null ;
443444 return member ; // instance FIELD, static GLOBAL, FUNCTION_PROTOTYPE...
444445 }
445446 // traverse inherited static members on the base prototype if target is a class prototype
@@ -467,8 +468,8 @@ export class Resolver extends DiagnosticEmitter {
467468 if ( members ) {
468469 let member = members . get ( propertyName ) ;
469470 if ( member ) {
470- this . resolvedThisExpression = targetExpression ;
471- this . resolvedElementExpression = null ;
471+ this . currentThisExpression = targetExpression ;
472+ this . currentElementExpression = null ;
472473 return member ; // static ENUMVALUE, static GLOBAL, static FUNCTION_PROTOTYPE...
473474 }
474475 }
@@ -496,8 +497,8 @@ export class Resolver extends DiagnosticEmitter {
496497 case ElementKind . FIELD : {
497498 let type = ( < VariableLikeElement > target ) . type ;
498499 if ( target = type . classReference ) {
499- this . resolvedThisExpression = targetExpression ;
500- this . resolvedElementExpression = elementAccess . elementExpression ;
500+ this . currentThisExpression = targetExpression ;
501+ this . currentElementExpression = elementAccess . elementExpression ;
501502 return target ;
502503 }
503504 break ;
@@ -515,8 +516,8 @@ export class Resolver extends DiagnosticEmitter {
515516 }
516517 let returnType = indexedGet . signature . returnType ;
517518 if ( target = returnType . classReference ) {
518- this . resolvedThisExpression = targetExpression ;
519- this . resolvedElementExpression = elementAccess . elementExpression ;
519+ this . currentThisExpression = targetExpression ;
520+ this . currentElementExpression = elementAccess . elementExpression ;
520521 return target ;
521522 }
522523 break ;
@@ -549,8 +550,8 @@ export class Resolver extends DiagnosticEmitter {
549550 if ( type ) {
550551 let classType = type . classReference ;
551552 if ( classType ) {
552- this . resolvedThisExpression = null ;
553- this . resolvedElementExpression = null ;
553+ this . currentThisExpression = null ;
554+ this . currentElementExpression = null ;
554555 return classType ;
555556 }
556557 }
@@ -563,15 +564,15 @@ export class Resolver extends DiagnosticEmitter {
563564 if ( contextualFunction . flow . is ( FlowFlags . INLINE_CONTEXT ) ) {
564565 let explicitLocal = contextualFunction . flow . getScopedLocal ( "this" ) ;
565566 if ( explicitLocal ) {
566- this . resolvedThisExpression = null ;
567- this . resolvedElementExpression = null ;
567+ this . currentThisExpression = null ;
568+ this . currentElementExpression = null ;
568569 return explicitLocal ;
569570 }
570571 }
571572 let parent = contextualFunction . parent ;
572573 if ( parent ) {
573- this . resolvedThisExpression = null ;
574- this . resolvedElementExpression = null ;
574+ this . currentThisExpression = null ;
575+ this . currentElementExpression = null ;
575576 return parent ;
576577 }
577578 if ( reportMode == ReportMode . REPORT ) {
@@ -586,15 +587,15 @@ export class Resolver extends DiagnosticEmitter {
586587 if ( contextualFunction . flow . is ( FlowFlags . INLINE_CONTEXT ) ) {
587588 let explicitLocal = contextualFunction . flow . getScopedLocal ( "super" ) ;
588589 if ( explicitLocal ) {
589- this . resolvedThisExpression = null ;
590- this . resolvedElementExpression = null ;
590+ this . currentThisExpression = null ;
591+ this . currentElementExpression = null ;
591592 return explicitLocal ;
592593 }
593594 }
594595 let parent = contextualFunction . parent ;
595596 if ( parent && parent . kind == ElementKind . CLASS && ( parent = ( < Class > parent ) . base ) ) {
596- this . resolvedThisExpression = null ;
597- this . resolvedElementExpression = null ;
597+ this . currentThisExpression = null ;
598+ this . currentElementExpression = null ;
598599 return parent ;
599600 }
600601 if ( reportMode == ReportMode . REPORT ) {
@@ -611,8 +612,8 @@ export class Resolver extends DiagnosticEmitter {
611612 case NodeKind . LITERAL : {
612613 switch ( ( < LiteralExpression > expression ) . literalKind ) {
613614 case LiteralKind . STRING : {
614- this . resolvedThisExpression = expression ;
615- this . resolvedElementExpression = null ;
615+ this . currentThisExpression = expression ;
616+ this . currentElementExpression = null ;
616617 return this . program . stringInstance ;
617618 }
618619 // case LiteralKind.ARRAY: // TODO
0 commit comments