@@ -20,10 +20,10 @@ import { ParseTreeWalker } from 'antlr4ts/tree/ParseTreeWalker';
2020export class ApexASTParser {
2121 private apexFilePath : string ;
2222 private implementsInterface : Map < string , Token > ;
23- private callsMethods : Map < string , Token [ ] > ;
23+ // private callsMethods: Map<string, Token[]>;
2424 private interfaceName : string ;
2525 private methodName : string ;
26- private className : string ;
26+ // private className: string;
2727 private astListener : ApexParserListener ;
2828
2929 public get implemementsInterface ( ) : Map < string , Token > {
@@ -37,8 +37,8 @@ export class ApexASTParser {
3737 this . astListener = this . createASTListener ( ) ;
3838 }
3939
40- public parse ( filePath : string ) : CompilationUnitContext {
41- const fileContent = fs . readFileSync ( filePath ) . toString ( ) ;
40+ public parse ( ) : CompilationUnitContext {
41+ const fileContent = fs . readFileSync ( this . apexFilePath ) . toString ( ) ;
4242 const lexer = new ApexLexer ( new CaseInsensitiveInputStream ( CharStreams . fromString ( fileContent ) ) ) ;
4343 const tokens = new CommonTokenStream ( lexer ) ;
4444 const parser = new ApexParser ( tokens ) ;
@@ -50,8 +50,7 @@ export class ApexASTParser {
5050
5151 private createASTListener ( ) : ApexParserListener {
5252 class ApexMigrationListener implements ApexParserListener {
53- public constructor ( private parser : ApexASTParser ) { }
54-
53+ public constructor ( private parser : ApexASTParser ) { }
5554 public enterClassDeclaration ( ctx : ClassDeclarationContext ) : void {
5655 const interfaceToBeSearched = this . parser . interfaceName ;
5756 if ( ! interfaceToBeSearched ) return ;
@@ -68,7 +67,7 @@ export class ApexASTParser {
6867 public enterDotExpression ( ctx : DotExpressionContext ) : void {
6968 // console.log('*********');
7069 // console.log(ctx.expression().start.text);
71- if ( ctx . dotMethodCall ( ) ) {
70+ if ( ctx . dotMethodCall ( ) && this . parser . methodName ) {
7271 // console.log(ctx.dotMethodCall().anyId().Identifier().symbol.text);
7372 // ctx.dotMethodCall().expressionList().expression(1).children[0].children[0].children[0];
7473 // console.log(ctx.dotMethodCall().expressionList().expression(1).children[0]);
0 commit comments