@@ -16,7 +16,7 @@ import { TFileId } from '../../../types.js';
1616import { StateManager , TFileDiagnostics } from '../../services/StateManager.js' ;
1717
1818export class BitloopsAnalyzer implements IAnalyzer {
19- symbolTable : ParserSyntacticErrors | TSymbolTableSemantics ;
19+ symbolTable : TSymbolTableSemantics | null ;
2020 constructor ( private stateManager : StateManager ) { }
2121
2222 analyze ( ) : TFileDiagnostics {
@@ -35,13 +35,14 @@ export class BitloopsAnalyzer implements IAnalyzer {
3535 // 'Info:',
3636 // transpilerInput.core.map((x) => ({ bc: x.boundedContext, mod: x.module })),
3737 // );
38- this . symbolTable = transpiler . getSymbolTable ( transpilerInput ) ;
38+ this . symbolTable = transpiler . getSymbolTable ( transpilerInput ) as TSymbolTableSemantics ;
3939
4040 const intermediateModelOrErrors = transpiler . bitloopsCodeToIntermediateModel ( transpilerInput ) ;
4141 if ( Transpiler . isTranspilerError ( intermediateModelOrErrors ) ) {
4242 this . mapTranspilerErrorsToLSPDiagnostics ( intermediateModelOrErrors ) ;
4343 return this . stateManager . getDiagnostics ( ) ;
4444 }
45+
4546 console . log ( 'Workspace analysis completed without errors' ) ;
4647 return this . stateManager . getDiagnostics ( ) ;
4748 } catch ( e ) {
@@ -52,6 +53,7 @@ export class BitloopsAnalyzer implements IAnalyzer {
5253
5354 private mapTranspilerErrorsToLSPDiagnostics ( transpilerErrors : TranspilerErrors ) : void {
5455 if ( isParserErrors ( transpilerErrors ) ) {
56+ this . symbolTable = null ; //symbolTable is not available if there are parser errors
5557 this . mapParserErrorsToLSPDiagnostics ( transpilerErrors ) ;
5658 return ;
5759 }
@@ -128,7 +130,10 @@ export class BitloopsAnalyzer implements IAnalyzer {
128130 ] ) ;
129131 }
130132 }
131- public getSymbolTable ( ) : ParserSyntacticErrors | TSymbolTableSemantics {
133+ public getSymbolTable ( ) : TSymbolTableSemantics | null {
134+ if ( ! this . symbolTable ) {
135+ return null ;
136+ }
132137 return this . symbolTable ;
133138 }
134139}
0 commit comments