File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ export class AstDeclaration {
9494 throw new Error ( 'Program Bug: Invalid call to notifyChildAttach()' ) ;
9595 }
9696
97+ if ( this . astSymbol . analyzed ) {
98+ throw new Error ( 'Program Bug: _notifyChildAttach() called after analysis is already complete' ) ;
99+ }
100+
97101 this . _analyzedChildren . push ( child ) ;
98102 }
99103
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ export class AstSymbol {
5959
6060 private readonly _rootAstSymbol : AstSymbol ;
6161
62+ // This flag is unused if this is not the root symbol.
63+ // Being "analyzed" is a property of the root symbol.
6264 private _analyzed : boolean = false ;
6365
6466 public constructor ( parameters : IAstSymbolParameters ) {
@@ -83,9 +85,12 @@ export class AstSymbol {
8385 /**
8486 * Returns true if the AstSymbolTable.analyze() was called for this object.
8587 * See that function for details.
88+ * @remarks
89+ * AstSymbolTable.analyze() is always performed on the root AstSymbol. This function
90+ * returns true if-and-only-if the root symbol was analyzed.
8691 */
8792 public get analyzed ( ) : boolean {
88- return this . _analyzed ;
93+ return this . rootAstSymbol . _analyzed ;
8994 }
9095
9196 /**
@@ -108,6 +113,9 @@ export class AstSymbol {
108113 * @internal
109114 */
110115 public _notifyDeclarationAttach ( astDeclaration : AstDeclaration ) : void {
116+ if ( this . analyzed ) {
117+ throw new Error ( 'Program Bug: _notifyDeclarationAttach() called after analysis is already complete' ) ;
118+ }
111119 this . _astDeclarations . push ( astDeclaration ) ;
112120 }
113121
@@ -117,6 +125,9 @@ export class AstSymbol {
117125 * @internal
118126 */
119127 public _notifyAnalyzed ( ) : void {
128+ if ( this . parentAstSymbol ) {
129+ throw new Error ( 'Program Bug: _notifyAnalyzed() called for an AstSymbol which is not the root' ) ;
130+ }
120131 this . _analyzed = true ;
121132 }
122133
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ export class AstSymbolTable {
139139 this . _analyzeChildTree ( astDeclaration . declaration , astDeclaration ) ;
140140 }
141141
142- astSymbol . _notifyAnalyzed ( ) ;
142+ rootAstSymbol . _notifyAnalyzed ( ) ;
143143
144144 if ( ! astSymbol . astImport ) {
145145 // If this symbol is not imported, then we also analyze any referencedAstSymbols
@@ -224,10 +224,6 @@ export class AstSymbolTable {
224224 for ( const childNode of node . getChildren ( ) ) {
225225 this . _analyzeChildTree ( childNode , newGoverningAstDeclaration || governingAstDeclaration ) ;
226226 }
227-
228- if ( newGoverningAstDeclaration ) {
229- newGoverningAstDeclaration . astSymbol . _notifyAnalyzed ( ) ;
230- }
231227 }
232228
233229 // tslint:disable-next-line:no-unused-variable
Original file line number Diff line number Diff line change @@ -87,6 +87,18 @@ interface IInterfaceAsDefaultExport {
8787 member : string ;
8888}
8989
90+ // @alpha
91+ interface IMergedInterface {
92+ // (undocumented)
93+ reference : IMergedInterfaceReferencee ;
94+ // (undocumented)
95+ type : string ;
96+ }
97+
98+ // @alpha (undocumented)
99+ interface IMergedInterfaceReferencee {
100+ }
101+
90102// @public
91103interface ISimpleInterface {
92104}
You can’t perform that action at this time.
0 commit comments