@@ -16,7 +16,7 @@ import { TFileId } from '../../../types.js';
16
16
import { StateManager , TFileDiagnostics } from '../../services/StateManager.js' ;
17
17
18
18
export class BitloopsAnalyzer implements IAnalyzer {
19
- symbolTable : ParserSyntacticErrors | TSymbolTableSemantics ;
19
+ symbolTable : TSymbolTableSemantics | null ;
20
20
constructor ( private stateManager : StateManager ) { }
21
21
22
22
analyze ( ) : TFileDiagnostics {
@@ -35,13 +35,14 @@ export class BitloopsAnalyzer implements IAnalyzer {
35
35
// 'Info:',
36
36
// transpilerInput.core.map((x) => ({ bc: x.boundedContext, mod: x.module })),
37
37
// );
38
- this . symbolTable = transpiler . getSymbolTable ( transpilerInput ) ;
38
+ this . symbolTable = transpiler . getSymbolTable ( transpilerInput ) as TSymbolTableSemantics ;
39
39
40
40
const intermediateModelOrErrors = transpiler . bitloopsCodeToIntermediateModel ( transpilerInput ) ;
41
41
if ( Transpiler . isTranspilerError ( intermediateModelOrErrors ) ) {
42
42
this . mapTranspilerErrorsToLSPDiagnostics ( intermediateModelOrErrors ) ;
43
43
return this . stateManager . getDiagnostics ( ) ;
44
44
}
45
+
45
46
console . log ( 'Workspace analysis completed without errors' ) ;
46
47
return this . stateManager . getDiagnostics ( ) ;
47
48
} catch ( e ) {
@@ -52,6 +53,7 @@ export class BitloopsAnalyzer implements IAnalyzer {
52
53
53
54
private mapTranspilerErrorsToLSPDiagnostics ( transpilerErrors : TranspilerErrors ) : void {
54
55
if ( isParserErrors ( transpilerErrors ) ) {
56
+ this . symbolTable = null ; //symbolTable is not available if there are parser errors
55
57
this . mapParserErrorsToLSPDiagnostics ( transpilerErrors ) ;
56
58
return ;
57
59
}
@@ -128,7 +130,10 @@ export class BitloopsAnalyzer implements IAnalyzer {
128
130
] ) ;
129
131
}
130
132
}
131
- public getSymbolTable ( ) : ParserSyntacticErrors | TSymbolTableSemantics {
133
+ public getSymbolTable ( ) : TSymbolTableSemantics | null {
134
+ if ( ! this . symbolTable ) {
135
+ return null ;
136
+ }
132
137
return this . symbolTable ;
133
138
}
134
139
}
0 commit comments