@grafema/core 0.2.5-beta → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -23
- package/dist/DiscoveryManager.d.ts +59 -0
- package/dist/DiscoveryManager.d.ts.map +1 -0
- package/dist/DiscoveryManager.js +249 -0
- package/dist/DiscoveryManager.js.map +1 -0
- package/dist/GraphInitializer.d.ts +44 -0
- package/dist/GraphInitializer.d.ts.map +1 -0
- package/dist/GraphInitializer.js +121 -0
- package/dist/GraphInitializer.js.map +1 -0
- package/dist/GuaranteeChecker.d.ts +35 -0
- package/dist/GuaranteeChecker.d.ts.map +1 -0
- package/dist/GuaranteeChecker.js +81 -0
- package/dist/GuaranteeChecker.js.map +1 -0
- package/dist/Orchestrator.d.ts +34 -151
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +173 -741
- package/dist/Orchestrator.js.map +1 -1
- package/dist/OrchestratorTypes.d.ts +115 -0
- package/dist/OrchestratorTypes.d.ts.map +1 -0
- package/dist/OrchestratorTypes.js +6 -0
- package/dist/OrchestratorTypes.js.map +1 -0
- package/dist/ParallelAnalysisRunner.d.ts +43 -0
- package/dist/ParallelAnalysisRunner.d.ts.map +1 -0
- package/dist/ParallelAnalysisRunner.js +161 -0
- package/dist/ParallelAnalysisRunner.js.map +1 -0
- package/dist/PhaseRunner.d.ts +94 -0
- package/dist/PhaseRunner.d.ts.map +1 -0
- package/dist/PhaseRunner.js +332 -0
- package/dist/PhaseRunner.js.map +1 -0
- package/dist/config/ConfigLoader.d.ts +51 -1
- package/dist/config/ConfigLoader.d.ts.map +1 -1
- package/dist/config/ConfigLoader.js +121 -1
- package/dist/config/ConfigLoader.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/core/ASTWorker.d.ts +2 -0
- package/dist/core/ASTWorker.d.ts.map +1 -1
- package/dist/core/ASTWorker.js +6 -2
- package/dist/core/ASTWorker.js.map +1 -1
- package/dist/core/FileOverview.d.ts +124 -0
- package/dist/core/FileOverview.d.ts.map +1 -0
- package/dist/core/FileOverview.js +257 -0
- package/dist/core/FileOverview.js.map +1 -0
- package/dist/core/GraphFreshnessChecker.d.ts +1 -1
- package/dist/core/GraphFreshnessChecker.d.ts.map +1 -1
- package/dist/core/GraphFreshnessChecker.js +7 -5
- package/dist/core/GraphFreshnessChecker.js.map +1 -1
- package/dist/core/GuaranteeManager.d.ts +13 -0
- package/dist/core/GuaranteeManager.d.ts.map +1 -1
- package/dist/core/GuaranteeManager.js +63 -2
- package/dist/core/GuaranteeManager.js.map +1 -1
- package/dist/core/IncrementalReanalyzer.d.ts.map +1 -1
- package/dist/core/IncrementalReanalyzer.js +6 -3
- package/dist/core/IncrementalReanalyzer.js.map +1 -1
- package/dist/core/NodeFactory.d.ts +81 -415
- package/dist/core/NodeFactory.d.ts.map +1 -1
- package/dist/core/NodeFactory.js +139 -336
- package/dist/core/NodeFactory.js.map +1 -1
- package/dist/core/ResourceRegistry.d.ts +17 -0
- package/dist/core/ResourceRegistry.d.ts.map +1 -0
- package/dist/core/ResourceRegistry.js +32 -0
- package/dist/core/ResourceRegistry.js.map +1 -0
- package/dist/core/ScopeTracker.d.ts +12 -0
- package/dist/core/ScopeTracker.d.ts.map +1 -1
- package/dist/core/ScopeTracker.js +24 -0
- package/dist/core/ScopeTracker.js.map +1 -1
- package/dist/core/SemanticId.d.ts +69 -0
- package/dist/core/SemanticId.d.ts.map +1 -1
- package/dist/core/SemanticId.js +134 -0
- package/dist/core/SemanticId.js.map +1 -1
- package/dist/core/brandNodeInternal.d.ts +14 -0
- package/dist/core/brandNodeInternal.d.ts.map +1 -0
- package/dist/core/brandNodeInternal.js +4 -0
- package/dist/core/brandNodeInternal.js.map +1 -0
- package/dist/core/buildDependencyGraph.d.ts +36 -0
- package/dist/core/buildDependencyGraph.d.ts.map +1 -0
- package/dist/core/buildDependencyGraph.js +78 -0
- package/dist/core/buildDependencyGraph.js.map +1 -0
- package/dist/core/factories/CoreFactory.d.ts +223 -0
- package/dist/core/factories/CoreFactory.d.ts.map +1 -0
- package/dist/core/factories/CoreFactory.js +127 -0
- package/dist/core/factories/CoreFactory.js.map +1 -0
- package/dist/core/factories/DatabaseFactory.d.ts +29 -0
- package/dist/core/factories/DatabaseFactory.d.ts.map +1 -0
- package/dist/core/factories/DatabaseFactory.js +25 -0
- package/dist/core/factories/DatabaseFactory.js.map +1 -0
- package/dist/core/factories/ExternalFactory.d.ts +11 -0
- package/dist/core/factories/ExternalFactory.d.ts.map +1 -0
- package/dist/core/factories/ExternalFactory.js +16 -0
- package/dist/core/factories/ExternalFactory.js.map +1 -0
- package/dist/core/factories/HttpFactory.d.ts +22 -0
- package/dist/core/factories/HttpFactory.d.ts.map +1 -0
- package/dist/core/factories/HttpFactory.js +32 -0
- package/dist/core/factories/HttpFactory.js.map +1 -0
- package/dist/core/factories/ReactFactory.d.ts +14 -0
- package/dist/core/factories/ReactFactory.d.ts.map +1 -0
- package/dist/core/factories/ReactFactory.js +13 -0
- package/dist/core/factories/ReactFactory.js.map +1 -0
- package/dist/core/factories/RustFactory.d.ts +62 -0
- package/dist/core/factories/RustFactory.d.ts.map +1 -0
- package/dist/core/factories/RustFactory.js +32 -0
- package/dist/core/factories/RustFactory.js.map +1 -0
- package/dist/core/factories/ServiceFactory.d.ts +12 -0
- package/dist/core/factories/ServiceFactory.d.ts.map +1 -0
- package/dist/core/factories/ServiceFactory.js +22 -0
- package/dist/core/factories/ServiceFactory.js.map +1 -0
- package/dist/core/factories/SocketFactory.d.ts +31 -0
- package/dist/core/factories/SocketFactory.d.ts.map +1 -0
- package/dist/core/factories/SocketFactory.js +35 -0
- package/dist/core/factories/SocketFactory.js.map +1 -0
- package/dist/core/nodes/DatabaseNode.d.ts +85 -0
- package/dist/core/nodes/DatabaseNode.d.ts.map +1 -0
- package/dist/core/nodes/DatabaseNode.js +118 -0
- package/dist/core/nodes/DatabaseNode.js.map +1 -0
- package/dist/core/nodes/ExpressMiddlewareNode.d.ts +47 -0
- package/dist/core/nodes/ExpressMiddlewareNode.d.ts.map +1 -0
- package/dist/core/nodes/ExpressMiddlewareNode.js +63 -0
- package/dist/core/nodes/ExpressMiddlewareNode.js.map +1 -0
- package/dist/core/nodes/ExpressMountNode.d.ts +44 -0
- package/dist/core/nodes/ExpressMountNode.d.ts.map +1 -0
- package/dist/core/nodes/ExpressMountNode.js +61 -0
- package/dist/core/nodes/ExpressMountNode.js.map +1 -0
- package/dist/core/nodes/ExternalApiNode.d.ts +29 -0
- package/dist/core/nodes/ExternalApiNode.d.ts.map +1 -0
- package/dist/core/nodes/ExternalApiNode.js +41 -0
- package/dist/core/nodes/ExternalApiNode.js.map +1 -0
- package/dist/core/nodes/ExternalFunctionNode.d.ts +40 -0
- package/dist/core/nodes/ExternalFunctionNode.d.ts.map +1 -0
- package/dist/core/nodes/ExternalFunctionNode.js +54 -0
- package/dist/core/nodes/ExternalFunctionNode.js.map +1 -0
- package/dist/core/nodes/FetchRequestNode.d.ts +54 -0
- package/dist/core/nodes/FetchRequestNode.d.ts.map +1 -0
- package/dist/core/nodes/FetchRequestNode.js +67 -0
- package/dist/core/nodes/FetchRequestNode.js.map +1 -0
- package/dist/core/nodes/HttpRouteNode.d.ts +58 -0
- package/dist/core/nodes/HttpRouteNode.d.ts.map +1 -0
- package/dist/core/nodes/HttpRouteNode.js +72 -0
- package/dist/core/nodes/HttpRouteNode.js.map +1 -0
- package/dist/core/nodes/NodeKind.d.ts +1 -0
- package/dist/core/nodes/NodeKind.d.ts.map +1 -1
- package/dist/core/nodes/NodeKind.js +1 -0
- package/dist/core/nodes/NodeKind.js.map +1 -1
- package/dist/core/nodes/ReactNode.d.ts +53 -0
- package/dist/core/nodes/ReactNode.d.ts.map +1 -0
- package/dist/core/nodes/ReactNode.js +70 -0
- package/dist/core/nodes/ReactNode.js.map +1 -0
- package/dist/core/nodes/RustCallNode.d.ts +46 -0
- package/dist/core/nodes/RustCallNode.d.ts.map +1 -0
- package/dist/core/nodes/RustCallNode.js +62 -0
- package/dist/core/nodes/RustCallNode.js.map +1 -0
- package/dist/core/nodes/RustFunctionNode.d.ts +58 -0
- package/dist/core/nodes/RustFunctionNode.d.ts.map +1 -0
- package/dist/core/nodes/RustFunctionNode.js +67 -0
- package/dist/core/nodes/RustFunctionNode.js.map +1 -0
- package/dist/core/nodes/RustImplNode.d.ts +35 -0
- package/dist/core/nodes/RustImplNode.d.ts.map +1 -0
- package/dist/core/nodes/RustImplNode.js +55 -0
- package/dist/core/nodes/RustImplNode.js.map +1 -0
- package/dist/core/nodes/RustMethodNode.d.ts +64 -0
- package/dist/core/nodes/RustMethodNode.d.ts.map +1 -0
- package/dist/core/nodes/RustMethodNode.js +76 -0
- package/dist/core/nodes/RustMethodNode.js.map +1 -0
- package/dist/core/nodes/RustModuleNode.d.ts +40 -0
- package/dist/core/nodes/RustModuleNode.d.ts.map +1 -0
- package/dist/core/nodes/RustModuleNode.js +57 -0
- package/dist/core/nodes/RustModuleNode.js.map +1 -0
- package/dist/core/nodes/RustStructNode.d.ts +38 -0
- package/dist/core/nodes/RustStructNode.d.ts.map +1 -0
- package/dist/core/nodes/RustStructNode.js +54 -0
- package/dist/core/nodes/RustStructNode.js.map +1 -0
- package/dist/core/nodes/RustTraitNode.d.ts +40 -0
- package/dist/core/nodes/RustTraitNode.d.ts.map +1 -0
- package/dist/core/nodes/RustTraitNode.js +52 -0
- package/dist/core/nodes/RustTraitNode.js.map +1 -0
- package/dist/core/nodes/ServiceLayerNode.d.ts +85 -0
- package/dist/core/nodes/ServiceLayerNode.d.ts.map +1 -0
- package/dist/core/nodes/ServiceLayerNode.js +122 -0
- package/dist/core/nodes/ServiceLayerNode.js.map +1 -0
- package/dist/core/nodes/SocketIONode.d.ts +71 -0
- package/dist/core/nodes/SocketIONode.d.ts.map +1 -0
- package/dist/core/nodes/SocketIONode.js +111 -0
- package/dist/core/nodes/SocketIONode.js.map +1 -0
- package/dist/core/nodes/SocketNode.d.ts +87 -0
- package/dist/core/nodes/SocketNode.d.ts.map +1 -0
- package/dist/core/nodes/SocketNode.js +124 -0
- package/dist/core/nodes/SocketNode.js.map +1 -0
- package/dist/core/nodes/TypeNode.d.ts +26 -1
- package/dist/core/nodes/TypeNode.d.ts.map +1 -1
- package/dist/core/nodes/TypeNode.js +21 -3
- package/dist/core/nodes/TypeNode.js.map +1 -1
- package/dist/core/nodes/TypeParameterNode.d.ts +44 -0
- package/dist/core/nodes/TypeParameterNode.d.ts.map +1 -0
- package/dist/core/nodes/TypeParameterNode.js +64 -0
- package/dist/core/nodes/TypeParameterNode.js.map +1 -0
- package/dist/core/nodes/index.d.ts +19 -0
- package/dist/core/nodes/index.d.ts.map +1 -1
- package/dist/core/nodes/index.js +26 -0
- package/dist/core/nodes/index.js.map +1 -1
- package/dist/index.d.ts +33 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/plugins/InfraAnalyzer.d.ts +110 -0
- package/dist/plugins/InfraAnalyzer.d.ts.map +1 -0
- package/dist/plugins/InfraAnalyzer.js +170 -0
- package/dist/plugins/InfraAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/DatabaseAnalyzer.js +18 -15
- package/dist/plugins/analysis/DatabaseAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressAnalyzer.js +27 -26
- package/dist/plugins/analysis/ExpressAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/ExpressResponseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressResponseAnalyzer.js +5 -3
- package/dist/plugins/analysis/ExpressResponseAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +36 -39
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/FetchAnalyzer.js +23 -39
- package/dist/plugins/analysis/FetchAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -1
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +3 -2
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js.map +1 -1
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +23 -85
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/JSASTAnalyzer.js +351 -1887
- package/dist/plugins/analysis/JSASTAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/NestJSRouteAnalyzer.d.ts +28 -0
- package/dist/plugins/analysis/NestJSRouteAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/NestJSRouteAnalyzer.js +196 -0
- package/dist/plugins/analysis/NestJSRouteAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ReactAnalyzer.d.ts +1 -61
- package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ReactAnalyzer.js +24 -915
- package/dist/plugins/analysis/ReactAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/RustAnalyzer.js +31 -66
- package/dist/plugins/analysis/RustAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SQLiteAnalyzer.js +13 -6
- package/dist/plugins/analysis/SQLiteAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js +10 -7
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/SocketAnalyzer.d.ts +81 -0
- package/dist/plugins/analysis/SocketAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SocketAnalyzer.js +475 -0
- package/dist/plugins/analysis/SocketAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SocketIOAnalyzer.js +13 -18
- package/dist/plugins/analysis/SocketIOAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SystemDbAnalyzer.js +8 -5
- package/dist/plugins/analysis/SystemDbAnalyzer.js.map +1 -1
- package/dist/plugins/analysis/ast/CollisionResolver.d.ts +65 -0
- package/dist/plugins/analysis/ast/CollisionResolver.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/CollisionResolver.js +106 -0
- package/dist/plugins/analysis/ast/CollisionResolver.js.map +1 -0
- package/dist/plugins/analysis/ast/FunctionBodyContext.d.ts +124 -0
- package/dist/plugins/analysis/ast/FunctionBodyContext.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/FunctionBodyContext.js +151 -0
- package/dist/plugins/analysis/ast/FunctionBodyContext.js.map +1 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +26 -261
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/GraphBuilder.js +251 -2494
- package/dist/plugins/analysis/ast/GraphBuilder.js.map +1 -1
- package/dist/plugins/analysis/ast/IdGenerator.d.ts +42 -0
- package/dist/plugins/analysis/ast/IdGenerator.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/IdGenerator.js +61 -1
- package/dist/plugins/analysis/ast/IdGenerator.js.map +1 -1
- package/dist/plugins/analysis/ast/builders/AssignmentBuilder.d.ts +15 -0
- package/dist/plugins/analysis/ast/builders/AssignmentBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/AssignmentBuilder.js +274 -0
- package/dist/plugins/analysis/ast/builders/AssignmentBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/CallFlowBuilder.d.ts +22 -0
- package/dist/plugins/analysis/ast/builders/CallFlowBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/CallFlowBuilder.js +178 -0
- package/dist/plugins/analysis/ast/builders/CallFlowBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.d.ts +76 -0
- package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.js +387 -0
- package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/CoreBuilder.d.ts +38 -0
- package/dist/plugins/analysis/ast/builders/CoreBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/CoreBuilder.js +240 -0
- package/dist/plugins/analysis/ast/builders/CoreBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.d.ts +53 -0
- package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.js +355 -0
- package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/MutationBuilder.d.ts +46 -0
- package/dist/plugins/analysis/ast/builders/MutationBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/MutationBuilder.js +264 -0
- package/dist/plugins/analysis/ast/builders/MutationBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/ReturnBuilder.d.ts +23 -0
- package/dist/plugins/analysis/ast/builders/ReturnBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/ReturnBuilder.js +206 -0
- package/dist/plugins/analysis/ast/builders/ReturnBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.d.ts +64 -0
- package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.js +370 -0
- package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.d.ts +46 -0
- package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.js +191 -0
- package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/YieldBuilder.d.ts +30 -0
- package/dist/plugins/analysis/ast/builders/YieldBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/YieldBuilder.js +214 -0
- package/dist/plugins/analysis/ast/builders/YieldBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/index.d.ts +12 -0
- package/dist/plugins/analysis/ast/builders/index.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/index.js +11 -0
- package/dist/plugins/analysis/ast/builders/index.js.map +1 -0
- package/dist/plugins/analysis/ast/builders/types.d.ts +30 -0
- package/dist/plugins/analysis/ast/builders/types.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/builders/types.js +8 -0
- package/dist/plugins/analysis/ast/builders/types.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.d.ts +50 -0
- package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.js +2 -0
- package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/BranchHandler.d.ts +18 -0
- package/dist/plugins/analysis/ast/handlers/BranchHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/BranchHandler.js +244 -0
- package/dist/plugins/analysis/ast/handlers/BranchHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.d.ts +7 -0
- package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.js +295 -0
- package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.d.ts +22 -0
- package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.js +9 -0
- package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/LoopHandler.d.ts +13 -0
- package/dist/plugins/analysis/ast/handlers/LoopHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/LoopHandler.js +207 -0
- package/dist/plugins/analysis/ast/handlers/LoopHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.d.ts +13 -0
- package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.js +174 -0
- package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.d.ts +12 -0
- package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.js +135 -0
- package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.d.ts +13 -0
- package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.js +71 -0
- package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.d.ts +12 -0
- package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.js +135 -0
- package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/ThrowHandler.d.ts +12 -0
- package/dist/plugins/analysis/ast/handlers/ThrowHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/ThrowHandler.js +82 -0
- package/dist/plugins/analysis/ast/handlers/ThrowHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/TryCatchHandler.d.ts +14 -0
- package/dist/plugins/analysis/ast/handlers/TryCatchHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/TryCatchHandler.js +220 -0
- package/dist/plugins/analysis/ast/handlers/TryCatchHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/VariableHandler.d.ts +12 -0
- package/dist/plugins/analysis/ast/handlers/VariableHandler.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/VariableHandler.js +57 -0
- package/dist/plugins/analysis/ast/handlers/VariableHandler.js.map +1 -0
- package/dist/plugins/analysis/ast/handlers/index.d.ts +13 -0
- package/dist/plugins/analysis/ast/handlers/index.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/handlers/index.js +12 -0
- package/dist/plugins/analysis/ast/handlers/index.js.map +1 -0
- package/dist/plugins/analysis/ast/types.d.ts +57 -6
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts +5 -4
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/utils/createParameterNodes.js +94 -13
- package/dist/plugins/analysis/ast/utils/createParameterNodes.js.map +1 -1
- package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.d.ts +81 -0
- package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.js +140 -0
- package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/getExpressionValue.d.ts +22 -0
- package/dist/plugins/analysis/ast/utils/getExpressionValue.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/getExpressionValue.js +35 -0
- package/dist/plugins/analysis/ast/utils/getExpressionValue.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/getMemberExpressionName.d.ts +25 -0
- package/dist/plugins/analysis/ast/utils/getMemberExpressionName.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/getMemberExpressionName.js +21 -0
- package/dist/plugins/analysis/ast/utils/getMemberExpressionName.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/index.d.ts +2 -0
- package/dist/plugins/analysis/ast/utils/index.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/utils/index.js +2 -0
- package/dist/plugins/analysis/ast/utils/index.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.d.ts +23 -0
- package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.js +241 -0
- package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.d.ts +20 -0
- package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.js +110 -0
- package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +15 -142
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +304 -937
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +26 -11
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +21 -6
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/MutationDetector.d.ts +25 -0
- package/dist/plugins/analysis/ast/visitors/MutationDetector.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/MutationDetector.js +181 -0
- package/dist/plugins/analysis/ast/visitors/MutationDetector.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.d.ts +20 -0
- package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.js +155 -0
- package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.d.ts +9 -1
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.js +51 -3
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +20 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +188 -12
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +6 -4
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js.map +1 -1
- package/dist/plugins/analysis/ast/visitors/call-expression-helpers.d.ts +19 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-helpers.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-helpers.js +57 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-helpers.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-types.d.ts +168 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-types.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-types.js +7 -0
- package/dist/plugins/analysis/ast/visitors/call-expression-types.js.map +1 -0
- package/dist/plugins/analysis/react-internal/browser-api.d.ts +20 -0
- package/dist/plugins/analysis/react-internal/browser-api.d.ts.map +1 -0
- package/dist/plugins/analysis/react-internal/browser-api.js +140 -0
- package/dist/plugins/analysis/react-internal/browser-api.js.map +1 -0
- package/dist/plugins/analysis/react-internal/hooks.d.ts +31 -0
- package/dist/plugins/analysis/react-internal/hooks.d.ts.map +1 -0
- package/dist/plugins/analysis/react-internal/hooks.js +465 -0
- package/dist/plugins/analysis/react-internal/hooks.js.map +1 -0
- package/dist/plugins/analysis/react-internal/jsx.d.ts +43 -0
- package/dist/plugins/analysis/react-internal/jsx.d.ts.map +1 -0
- package/dist/plugins/analysis/react-internal/jsx.js +231 -0
- package/dist/plugins/analysis/react-internal/jsx.js.map +1 -0
- package/dist/plugins/analysis/react-internal/types.d.ts +116 -0
- package/dist/plugins/analysis/react-internal/types.d.ts.map +1 -0
- package/dist/plugins/analysis/react-internal/types.js +83 -0
- package/dist/plugins/analysis/react-internal/types.js.map +1 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js +6 -13
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js.map +1 -1
- package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -1
- package/dist/plugins/enrichment/AliasTracker.js +3 -1
- package/dist/plugins/enrichment/AliasTracker.js.map +1 -1
- package/dist/plugins/enrichment/ArgumentParameterLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ArgumentParameterLinker.js +3 -1
- package/dist/plugins/enrichment/ArgumentParameterLinker.js.map +1 -1
- package/dist/plugins/enrichment/CallbackCallResolver.d.ts +42 -0
- package/dist/plugins/enrichment/CallbackCallResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/CallbackCallResolver.js +311 -0
- package/dist/plugins/enrichment/CallbackCallResolver.js.map +1 -0
- package/dist/plugins/enrichment/ClosureCaptureEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/ClosureCaptureEnricher.js +3 -1
- package/dist/plugins/enrichment/ClosureCaptureEnricher.js.map +1 -1
- package/dist/plugins/enrichment/ConfigRoutingMapBuilder.d.ts +17 -0
- package/dist/plugins/enrichment/ConfigRoutingMapBuilder.d.ts.map +1 -0
- package/dist/plugins/enrichment/ConfigRoutingMapBuilder.js +55 -0
- package/dist/plugins/enrichment/ConfigRoutingMapBuilder.js.map +1 -0
- package/dist/plugins/enrichment/ExpressHandlerLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ExpressHandlerLinker.js +3 -1
- package/dist/plugins/enrichment/ExpressHandlerLinker.js.map +1 -1
- package/dist/plugins/enrichment/ExternalCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/ExternalCallResolver.js +5 -8
- package/dist/plugins/enrichment/ExternalCallResolver.js.map +1 -1
- package/dist/plugins/enrichment/FunctionCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/FunctionCallResolver.js +6 -9
- package/dist/plugins/enrichment/FunctionCallResolver.js.map +1 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +3 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js.map +1 -1
- package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ImportExportLinker.js +5 -3
- package/dist/plugins/enrichment/ImportExportLinker.js.map +1 -1
- package/dist/plugins/enrichment/InstanceOfResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/InstanceOfResolver.js +3 -1
- package/dist/plugins/enrichment/InstanceOfResolver.js.map +1 -1
- package/dist/plugins/enrichment/MethodCallResolver.d.ts +17 -68
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MethodCallResolver.js +42 -517
- package/dist/plugins/enrichment/MethodCallResolver.js.map +1 -1
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MountPointResolver.js +9 -2
- package/dist/plugins/enrichment/MountPointResolver.js.map +1 -1
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.js +7 -16
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.js.map +1 -1
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -1
- package/dist/plugins/enrichment/PrefixEvaluator.js +6 -2
- package/dist/plugins/enrichment/PrefixEvaluator.js.map +1 -1
- package/dist/plugins/enrichment/RejectionPropagationEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/RejectionPropagationEnricher.js +3 -1
- package/dist/plugins/enrichment/RejectionPropagationEnricher.js.map +1 -1
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/RustFFIEnricher.js +3 -1
- package/dist/plugins/enrichment/RustFFIEnricher.js.map +1 -1
- package/dist/plugins/enrichment/ServiceConnectionEnricher.d.ts +76 -0
- package/dist/plugins/enrichment/ServiceConnectionEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/ServiceConnectionEnricher.js +355 -0
- package/dist/plugins/enrichment/ServiceConnectionEnricher.js.map +1 -0
- package/dist/plugins/enrichment/SocketConnectionEnricher.d.ts +42 -0
- package/dist/plugins/enrichment/SocketConnectionEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/SocketConnectionEnricher.js +166 -0
- package/dist/plugins/enrichment/SocketConnectionEnricher.js.map +1 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +3 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js.map +1 -1
- package/dist/plugins/enrichment/method-call/MethodCallData.d.ts +68 -0
- package/dist/plugins/enrichment/method-call/MethodCallData.d.ts.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallData.js +227 -0
- package/dist/plugins/enrichment/method-call/MethodCallData.js.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallDetectors.d.ts +21 -0
- package/dist/plugins/enrichment/method-call/MethodCallDetectors.d.ts.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallDetectors.js +52 -0
- package/dist/plugins/enrichment/method-call/MethodCallDetectors.js.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.d.ts +22 -0
- package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.d.ts.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.js +105 -0
- package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.js.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallIndexers.d.ts +19 -0
- package/dist/plugins/enrichment/method-call/MethodCallIndexers.d.ts.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallIndexers.js +63 -0
- package/dist/plugins/enrichment/method-call/MethodCallIndexers.js.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallResolution.d.ts +30 -0
- package/dist/plugins/enrichment/method-call/MethodCallResolution.d.ts.map +1 -0
- package/dist/plugins/enrichment/method-call/MethodCallResolution.js +138 -0
- package/dist/plugins/enrichment/method-call/MethodCallResolution.js.map +1 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/IncrementalModuleIndexer.js +2 -8
- package/dist/plugins/indexing/IncrementalModuleIndexer.js.map +1 -1
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/JSModuleIndexer.js +13 -20
- package/dist/plugins/indexing/JSModuleIndexer.js.map +1 -1
- package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/RustModuleIndexer.js +4 -8
- package/dist/plugins/indexing/RustModuleIndexer.js.map +1 -1
- package/dist/plugins/validation/AwaitInLoopValidator.d.ts +24 -0
- package/dist/plugins/validation/AwaitInLoopValidator.d.ts.map +1 -0
- package/dist/plugins/validation/AwaitInLoopValidator.js +69 -0
- package/dist/plugins/validation/AwaitInLoopValidator.js.map +1 -0
- package/dist/plugins/validation/PackageCoverageValidator.d.ts +33 -0
- package/dist/plugins/validation/PackageCoverageValidator.d.ts.map +1 -0
- package/dist/plugins/validation/PackageCoverageValidator.js +149 -0
- package/dist/plugins/validation/PackageCoverageValidator.js.map +1 -0
- package/dist/plugins/validation/UnconnectedRouteValidator.d.ts +18 -0
- package/dist/plugins/validation/UnconnectedRouteValidator.d.ts.map +1 -0
- package/dist/plugins/validation/UnconnectedRouteValidator.js +68 -0
- package/dist/plugins/validation/UnconnectedRouteValidator.js.map +1 -0
- package/dist/queries/NodeContext.d.ts +81 -0
- package/dist/queries/NodeContext.d.ts.map +1 -0
- package/dist/queries/NodeContext.js +193 -0
- package/dist/queries/NodeContext.js.map +1 -0
- package/dist/queries/findCallsInFunction.d.ts.map +1 -1
- package/dist/queries/findCallsInFunction.js +10 -2
- package/dist/queries/findCallsInFunction.js.map +1 -1
- package/dist/queries/findContainingFunction.d.ts +3 -2
- package/dist/queries/findContainingFunction.d.ts.map +1 -1
- package/dist/queries/findContainingFunction.js +13 -3
- package/dist/queries/findContainingFunction.js.map +1 -1
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/index.js +1 -0
- package/dist/queries/index.js.map +1 -1
- package/dist/resources/InfraResourceMapImpl.d.ts +31 -0
- package/dist/resources/InfraResourceMapImpl.d.ts.map +1 -0
- package/dist/resources/InfraResourceMapImpl.js +110 -0
- package/dist/resources/InfraResourceMapImpl.js.map +1 -0
- package/dist/resources/RoutingMapImpl.d.ts +33 -0
- package/dist/resources/RoutingMapImpl.d.ts.map +1 -0
- package/dist/resources/RoutingMapImpl.js +115 -0
- package/dist/resources/RoutingMapImpl.js.map +1 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts +35 -6
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
- package/dist/storage/backends/RFDBServerBackend.js +102 -70
- package/dist/storage/backends/RFDBServerBackend.js.map +1 -1
- package/dist/utils/findRfdbBinary.d.ts +3 -2
- package/dist/utils/findRfdbBinary.d.ts.map +1 -1
- package/dist/utils/findRfdbBinary.js +22 -7
- package/dist/utils/findRfdbBinary.js.map +1 -1
- package/dist/utils/moduleResolution.d.ts.map +1 -1
- package/dist/utils/moduleResolution.js +26 -1
- package/dist/utils/moduleResolution.js.map +1 -1
- package/dist/utils/resolveNodeFile.d.ts +13 -0
- package/dist/utils/resolveNodeFile.d.ts.map +1 -0
- package/dist/utils/resolveNodeFile.js +18 -0
- package/dist/utils/resolveNodeFile.js.map +1 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +26 -0
- package/dist/version.js.map +1 -0
- package/package.json +3 -3
- package/src/DiscoveryManager.ts +279 -0
- package/src/GraphInitializer.ts +131 -0
- package/src/GuaranteeChecker.ts +90 -0
- package/src/Orchestrator.ts +222 -963
- package/src/OrchestratorTypes.ts +122 -0
- package/src/ParallelAnalysisRunner.ts +188 -0
- package/src/PhaseRunner.ts +450 -0
- package/src/config/ConfigLoader.ts +176 -2
- package/src/config/index.ts +2 -0
- package/src/core/ASTWorker.ts +9 -2
- package/src/core/FileOverview.ts +374 -0
- package/src/core/GraphFreshnessChecker.ts +7 -5
- package/src/core/GuaranteeManager.ts +70 -2
- package/src/core/IncrementalReanalyzer.ts +6 -3
- package/src/core/NodeFactory.ts +173 -652
- package/src/core/ResourceRegistry.ts +39 -0
- package/src/core/ScopeTracker.ts +23 -0
- package/src/core/SemanticId.ts +183 -0
- package/src/core/brandNodeInternal.ts +16 -0
- package/src/core/buildDependencyGraph.ts +98 -0
- package/src/core/factories/CoreFactory.ts +489 -0
- package/src/core/factories/DatabaseFactory.ts +63 -0
- package/src/core/factories/ExternalFactory.ts +23 -0
- package/src/core/factories/HttpFactory.ts +57 -0
- package/src/core/factories/ReactFactory.ts +15 -0
- package/src/core/factories/RustFactory.ts +128 -0
- package/src/core/factories/ServiceFactory.ts +27 -0
- package/src/core/factories/SocketFactory.ts +94 -0
- package/src/core/nodes/DatabaseNode.ts +175 -0
- package/src/core/nodes/ExpressMiddlewareNode.ts +98 -0
- package/src/core/nodes/ExpressMountNode.ts +94 -0
- package/src/core/nodes/ExternalApiNode.ts +53 -0
- package/src/core/nodes/ExternalFunctionNode.ts +77 -0
- package/src/core/nodes/FetchRequestNode.ts +105 -0
- package/src/core/nodes/HttpRouteNode.ts +113 -0
- package/src/core/nodes/NodeKind.ts +1 -0
- package/src/core/nodes/ReactNode.ts +78 -0
- package/src/core/nodes/RustCallNode.ts +96 -0
- package/src/core/nodes/RustFunctionNode.ts +112 -0
- package/src/core/nodes/RustImplNode.ts +78 -0
- package/src/core/nodes/RustMethodNode.ts +125 -0
- package/src/core/nodes/RustModuleNode.ts +84 -0
- package/src/core/nodes/RustStructNode.ts +80 -0
- package/src/core/nodes/RustTraitNode.ts +82 -0
- package/src/core/nodes/ServiceLayerNode.ts +183 -0
- package/src/core/nodes/SocketIONode.ts +177 -0
- package/src/core/nodes/SocketNode.ts +206 -0
- package/src/core/nodes/TypeNode.ts +46 -3
- package/src/core/nodes/TypeParameterNode.ts +91 -0
- package/src/core/nodes/index.ts +57 -0
- package/src/index.ts +60 -4
- package/src/plugins/InfraAnalyzer.ts +208 -0
- package/src/plugins/analysis/DatabaseAnalyzer.ts +27 -17
- package/src/plugins/analysis/ExpressAnalyzer.ts +51 -38
- package/src/plugins/analysis/ExpressResponseAnalyzer.ts +15 -12
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +56 -56
- package/src/plugins/analysis/FetchAnalyzer.ts +42 -52
- package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +3 -2
- package/src/plugins/analysis/JSASTAnalyzer.ts +391 -2304
- package/src/plugins/analysis/NestJSRouteAnalyzer.ts +241 -0
- package/src/plugins/analysis/ReactAnalyzer.ts +33 -1085
- package/src/plugins/analysis/RustAnalyzer.ts +112 -116
- package/src/plugins/analysis/SQLiteAnalyzer.ts +23 -9
- package/src/plugins/analysis/ServiceLayerAnalyzer.ts +32 -10
- package/src/plugins/analysis/SocketAnalyzer.ts +601 -0
- package/src/plugins/analysis/SocketIOAnalyzer.ts +25 -34
- package/src/plugins/analysis/SystemDbAnalyzer.ts +15 -12
- package/src/plugins/analysis/ast/CollisionResolver.ts +137 -0
- package/src/plugins/analysis/ast/FunctionBodyContext.ts +291 -0
- package/src/plugins/analysis/ast/GraphBuilder.ts +274 -3180
- package/src/plugins/analysis/ast/IdGenerator.ts +81 -1
- package/src/plugins/analysis/ast/builders/AssignmentBuilder.ts +407 -0
- package/src/plugins/analysis/ast/builders/CallFlowBuilder.ts +255 -0
- package/src/plugins/analysis/ast/builders/ControlFlowBuilder.ts +470 -0
- package/src/plugins/analysis/ast/builders/CoreBuilder.ts +306 -0
- package/src/plugins/analysis/ast/builders/ModuleRuntimeBuilder.ts +452 -0
- package/src/plugins/analysis/ast/builders/MutationBuilder.ts +372 -0
- package/src/plugins/analysis/ast/builders/ReturnBuilder.ts +279 -0
- package/src/plugins/analysis/ast/builders/TypeSystemBuilder.ts +475 -0
- package/src/plugins/analysis/ast/builders/UpdateExpressionBuilder.ts +262 -0
- package/src/plugins/analysis/ast/builders/YieldBuilder.ts +287 -0
- package/src/plugins/analysis/ast/builders/index.ts +11 -0
- package/src/plugins/analysis/ast/builders/types.ts +65 -0
- package/src/plugins/analysis/ast/handlers/AnalyzerDelegate.ts +183 -0
- package/src/plugins/analysis/ast/handlers/BranchHandler.ts +313 -0
- package/src/plugins/analysis/ast/handlers/CallExpressionHandler.ts +347 -0
- package/src/plugins/analysis/ast/handlers/FunctionBodyHandler.ts +24 -0
- package/src/plugins/analysis/ast/handlers/LoopHandler.ts +240 -0
- package/src/plugins/analysis/ast/handlers/NestedFunctionHandler.ts +201 -0
- package/src/plugins/analysis/ast/handlers/NewExpressionHandler.ts +159 -0
- package/src/plugins/analysis/ast/handlers/PropertyAccessHandler.ts +112 -0
- package/src/plugins/analysis/ast/handlers/ReturnYieldHandler.ts +166 -0
- package/src/plugins/analysis/ast/handlers/ThrowHandler.ts +101 -0
- package/src/plugins/analysis/ast/handlers/TryCatchHandler.ts +262 -0
- package/src/plugins/analysis/ast/handlers/VariableHandler.ts +93 -0
- package/src/plugins/analysis/ast/handlers/index.ts +12 -0
- package/src/plugins/analysis/ast/types.ts +68 -9
- package/src/plugins/analysis/ast/utils/createParameterNodes.ts +118 -13
- package/src/plugins/analysis/ast/utils/extractNamesFromPattern.ts +166 -0
- package/src/plugins/analysis/ast/utils/getExpressionValue.ts +34 -0
- package/src/plugins/analysis/ast/utils/getMemberExpressionName.ts +33 -0
- package/src/plugins/analysis/ast/utils/index.ts +2 -0
- package/src/plugins/analysis/ast/visitors/ArgumentExtractor.ts +307 -0
- package/src/plugins/analysis/ast/visitors/ArrayElementExtractor.ts +172 -0
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +425 -1374
- package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +43 -12
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +39 -8
- package/src/plugins/analysis/ast/visitors/MutationDetector.ts +211 -0
- package/src/plugins/analysis/ast/visitors/ObjectPropertyExtractor.ts +217 -0
- package/src/plugins/analysis/ast/visitors/PropertyAccessVisitor.ts +69 -4
- package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +232 -13
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +8 -11
- package/src/plugins/analysis/ast/visitors/call-expression-helpers.ts +65 -0
- package/src/plugins/analysis/ast/visitors/call-expression-types.ts +179 -0
- package/src/plugins/analysis/react-internal/browser-api.ts +168 -0
- package/src/plugins/analysis/react-internal/hooks.ts +517 -0
- package/src/plugins/analysis/react-internal/jsx.ts +279 -0
- package/src/plugins/analysis/react-internal/types.ts +183 -0
- package/src/plugins/discovery/MonorepoServiceDiscovery.ts +6 -14
- package/src/plugins/enrichment/AliasTracker.ts +3 -1
- package/src/plugins/enrichment/ArgumentParameterLinker.ts +3 -1
- package/src/plugins/enrichment/CallbackCallResolver.ts +398 -0
- package/src/plugins/enrichment/ClosureCaptureEnricher.ts +3 -1
- package/src/plugins/enrichment/ConfigRoutingMapBuilder.ts +67 -0
- package/src/plugins/enrichment/ExpressHandlerLinker.ts +3 -1
- package/src/plugins/enrichment/ExternalCallResolver.ts +5 -8
- package/src/plugins/enrichment/FunctionCallResolver.ts +6 -9
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +3 -1
- package/src/plugins/enrichment/ImportExportLinker.ts +5 -3
- package/src/plugins/enrichment/InstanceOfResolver.ts +3 -1
- package/src/plugins/enrichment/MethodCallResolver.ts +48 -659
- package/src/plugins/enrichment/MountPointResolver.ts +9 -2
- package/src/plugins/enrichment/NodejsBuiltinsResolver.ts +13 -18
- package/src/plugins/enrichment/PrefixEvaluator.ts +6 -2
- package/src/plugins/enrichment/RejectionPropagationEnricher.ts +3 -1
- package/src/plugins/enrichment/RustFFIEnricher.ts +3 -1
- package/src/plugins/enrichment/ServiceConnectionEnricher.ts +472 -0
- package/src/plugins/enrichment/SocketConnectionEnricher.ts +228 -0
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +3 -1
- package/src/plugins/enrichment/method-call/MethodCallData.ts +299 -0
- package/src/plugins/enrichment/method-call/MethodCallDetectors.ts +70 -0
- package/src/plugins/enrichment/method-call/MethodCallErrorAnalysis.ts +131 -0
- package/src/plugins/enrichment/method-call/MethodCallIndexers.ts +83 -0
- package/src/plugins/enrichment/method-call/MethodCallResolution.ts +181 -0
- package/src/plugins/indexing/IncrementalModuleIndexer.ts +5 -10
- package/src/plugins/indexing/JSModuleIndexer.ts +17 -21
- package/src/plugins/indexing/RustModuleIndexer.ts +14 -13
- package/src/plugins/validation/AwaitInLoopValidator.ts +91 -0
- package/src/plugins/validation/PackageCoverageValidator.ts +181 -0
- package/src/plugins/validation/UnconnectedRouteValidator.ts +93 -0
- package/src/queries/NodeContext.ts +277 -0
- package/src/queries/findCallsInFunction.ts +11 -2
- package/src/queries/findContainingFunction.ts +14 -3
- package/src/queries/index.ts +13 -0
- package/src/resources/InfraResourceMapImpl.ts +119 -0
- package/src/resources/RoutingMapImpl.ts +133 -0
- package/src/storage/backends/RFDBServerBackend.ts +106 -77
- package/src/utils/findRfdbBinary.ts +22 -7
- package/src/utils/moduleResolution.ts +28 -1
- package/src/utils/resolveNodeFile.ts +18 -0
- package/src/version.ts +28 -0
|
@@ -8,706 +8,35 @@
|
|
|
8
8
|
* - Constructor calls: new Foo(), new Function()
|
|
9
9
|
*/
|
|
10
10
|
import { ASTVisitor } from './ASTVisitor.js';
|
|
11
|
-
import {
|
|
12
|
-
import { computeSemanticId } from '../../../../core/SemanticId.js';
|
|
11
|
+
import { MutationDetector } from './MutationDetector.js';
|
|
13
12
|
import { IdGenerator } from '../IdGenerator.js';
|
|
14
|
-
import {
|
|
15
|
-
import { ObjectLiteralNode } from '../../../../core/nodes/ObjectLiteralNode.js';
|
|
16
|
-
import { ArrayLiteralNode } from '../../../../core/nodes/ArrayLiteralNode.js';
|
|
13
|
+
import { ExpressionEvaluator } from '../ExpressionEvaluator.js';
|
|
17
14
|
import { getLine, getColumn } from '../utils/location.js';
|
|
15
|
+
import { getGrafemaIgnore } from './call-expression-helpers.js';
|
|
16
|
+
import { ArgumentExtractor } from './ArgumentExtractor.js';
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
* Matches:
|
|
21
|
-
* // grafema-ignore STRICT_UNRESOLVED_METHOD
|
|
22
|
-
* // grafema-ignore STRICT_UNRESOLVED_METHOD - known library call
|
|
23
|
-
* /* grafema-ignore STRICT_UNRESOLVED_METHOD * / (block comments)
|
|
24
|
-
*/
|
|
25
|
-
const GRAFEMA_IGNORE_PATTERN = /grafema-ignore(?:-next-line)?\s+([\w_]+)(?:\s+-\s+(.+))?/;
|
|
26
|
-
/**
|
|
27
|
-
* Check node's leadingComments for grafema-ignore annotation.
|
|
18
|
+
* Extract the first literal argument value from a CallExpression for content hash hints.
|
|
28
19
|
*/
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
code: match[1],
|
|
41
|
-
reason: match[2]?.trim(),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
20
|
+
function extractFirstLiteralArg(node) {
|
|
21
|
+
if (node.arguments.length === 0)
|
|
22
|
+
return undefined;
|
|
23
|
+
const firstArg = node.arguments[0];
|
|
24
|
+
if (!firstArg)
|
|
25
|
+
return undefined;
|
|
26
|
+
const actualArg = firstArg.type === 'SpreadElement' ? firstArg.argument : firstArg;
|
|
27
|
+
const literalValue = ExpressionEvaluator.extractLiteralValue(actualArg);
|
|
28
|
+
if (literalValue !== null) {
|
|
29
|
+
return String(literalValue);
|
|
44
30
|
}
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Check if a call has a grafema-ignore comment for suppressing strict mode errors.
|
|
49
|
-
* Babel attaches leading comments to statements (VariableDeclaration, ExpressionStatement),
|
|
50
|
-
* not to nested CallExpression nodes. So we check:
|
|
51
|
-
* 1. The call node itself (rare, but possible for standalone calls)
|
|
52
|
-
* 2. The parent statement (VariableDeclaration, ExpressionStatement, etc.)
|
|
53
|
-
*
|
|
54
|
-
* @param path - Babel NodePath for the CallExpression
|
|
55
|
-
* @returns GrafemaIgnoreAnnotation if found, null otherwise
|
|
56
|
-
*/
|
|
57
|
-
function getGrafemaIgnore(path) {
|
|
58
|
-
// First check the call node itself
|
|
59
|
-
const callResult = checkNodeComments(path.node);
|
|
60
|
-
if (callResult)
|
|
61
|
-
return callResult;
|
|
62
|
-
// Then check parent statement (where Babel typically attaches comments)
|
|
63
|
-
const statementPath = path.getStatementParent();
|
|
64
|
-
if (statementPath) {
|
|
65
|
-
return checkNodeComments(statementPath.node);
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
31
|
+
return undefined;
|
|
68
32
|
}
|
|
69
33
|
export class CallExpressionVisitor extends ASTVisitor {
|
|
70
34
|
scopeTracker;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* @param collections - Must contain arrays and counter refs
|
|
74
|
-
* @param scopeTracker - Optional ScopeTracker for semantic ID generation
|
|
75
|
-
*/
|
|
76
|
-
constructor(module, collections, scopeTracker) {
|
|
35
|
+
sharedIdGenerator;
|
|
36
|
+
constructor(module, collections, scopeTracker, sharedIdGenerator) {
|
|
77
37
|
super(module, collections);
|
|
78
38
|
this.scopeTracker = scopeTracker;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Extract argument information for PASSES_ARGUMENT edges
|
|
82
|
-
*/
|
|
83
|
-
extractArguments(args, callId, module, callArguments, literals, literalCounterRef) {
|
|
84
|
-
args.forEach((arg, index) => {
|
|
85
|
-
const argInfo = {
|
|
86
|
-
callId,
|
|
87
|
-
argIndex: index,
|
|
88
|
-
file: module.file,
|
|
89
|
-
line: arg.loc?.start.line || 0,
|
|
90
|
-
column: arg.loc?.start.column || 0
|
|
91
|
-
};
|
|
92
|
-
// Check for spread: ...arg
|
|
93
|
-
let actualArg = arg;
|
|
94
|
-
if (arg.type === 'SpreadElement') {
|
|
95
|
-
argInfo.isSpread = true;
|
|
96
|
-
actualArg = arg.argument; // Get the actual argument
|
|
97
|
-
}
|
|
98
|
-
// Object literal - check BEFORE extractLiteralValue to handle object-typed args properly
|
|
99
|
-
if (actualArg.type === 'ObjectExpression') {
|
|
100
|
-
const objectExpr = actualArg;
|
|
101
|
-
// Initialize collections if not exist (must assign back to this.collections!)
|
|
102
|
-
if (!this.collections.objectLiteralCounterRef) {
|
|
103
|
-
this.collections.objectLiteralCounterRef = { value: 0 };
|
|
104
|
-
}
|
|
105
|
-
if (!this.collections.objectLiterals) {
|
|
106
|
-
this.collections.objectLiterals = [];
|
|
107
|
-
}
|
|
108
|
-
if (!this.collections.objectProperties) {
|
|
109
|
-
this.collections.objectProperties = [];
|
|
110
|
-
}
|
|
111
|
-
const objectLiteralCounterRef = this.collections.objectLiteralCounterRef;
|
|
112
|
-
// Use factory to create OBJECT_LITERAL node
|
|
113
|
-
const objectNode = ObjectLiteralNode.create(module.file, argInfo.line, argInfo.column, {
|
|
114
|
-
parentCallId: callId,
|
|
115
|
-
argIndex: index,
|
|
116
|
-
counter: objectLiteralCounterRef.value++
|
|
117
|
-
});
|
|
118
|
-
// Factory guarantees line is set, cast to ObjectLiteralInfo
|
|
119
|
-
this.collections.objectLiterals.push(objectNode);
|
|
120
|
-
const objectId = objectNode.id;
|
|
121
|
-
// Extract properties
|
|
122
|
-
this.extractObjectProperties(objectExpr, objectId, module, this.collections.objectProperties, this.collections.objectLiterals, objectLiteralCounterRef, literals, literalCounterRef);
|
|
123
|
-
argInfo.targetType = 'OBJECT_LITERAL';
|
|
124
|
-
argInfo.targetId = objectId;
|
|
125
|
-
}
|
|
126
|
-
// Array literal - check BEFORE extractLiteralValue to handle array-typed args properly
|
|
127
|
-
else if (actualArg.type === 'ArrayExpression') {
|
|
128
|
-
const arrayExpr = actualArg;
|
|
129
|
-
// Initialize collections if not exist (must assign back to this.collections!)
|
|
130
|
-
if (!this.collections.arrayLiteralCounterRef) {
|
|
131
|
-
this.collections.arrayLiteralCounterRef = { value: 0 };
|
|
132
|
-
}
|
|
133
|
-
if (!this.collections.arrayLiterals) {
|
|
134
|
-
this.collections.arrayLiterals = [];
|
|
135
|
-
}
|
|
136
|
-
if (!this.collections.arrayElements) {
|
|
137
|
-
this.collections.arrayElements = [];
|
|
138
|
-
}
|
|
139
|
-
if (!this.collections.objectLiteralCounterRef) {
|
|
140
|
-
this.collections.objectLiteralCounterRef = { value: 0 };
|
|
141
|
-
}
|
|
142
|
-
if (!this.collections.objectLiterals) {
|
|
143
|
-
this.collections.objectLiterals = [];
|
|
144
|
-
}
|
|
145
|
-
if (!this.collections.objectProperties) {
|
|
146
|
-
this.collections.objectProperties = [];
|
|
147
|
-
}
|
|
148
|
-
const arrayLiteralCounterRef = this.collections.arrayLiteralCounterRef;
|
|
149
|
-
// Use factory to create ARRAY_LITERAL node
|
|
150
|
-
const arrayNode = ArrayLiteralNode.create(module.file, argInfo.line, argInfo.column, {
|
|
151
|
-
parentCallId: callId,
|
|
152
|
-
argIndex: index,
|
|
153
|
-
counter: arrayLiteralCounterRef.value++
|
|
154
|
-
});
|
|
155
|
-
// Factory guarantees line is set, cast to ArrayLiteralInfo
|
|
156
|
-
this.collections.arrayLiterals.push(arrayNode);
|
|
157
|
-
const arrayId = arrayNode.id;
|
|
158
|
-
// Extract elements
|
|
159
|
-
this.extractArrayElements(arrayExpr, arrayId, module, this.collections.arrayElements, this.collections.arrayLiterals, arrayLiteralCounterRef, this.collections.objectLiterals, this.collections.objectLiteralCounterRef, this.collections.objectProperties, literals, literalCounterRef);
|
|
160
|
-
argInfo.targetType = 'ARRAY_LITERAL';
|
|
161
|
-
argInfo.targetId = arrayId;
|
|
162
|
-
}
|
|
163
|
-
// Literal value (primitives only - objects/arrays handled above)
|
|
164
|
-
else {
|
|
165
|
-
const literalValue = ExpressionEvaluator.extractLiteralValue(actualArg);
|
|
166
|
-
if (literalValue !== null) {
|
|
167
|
-
const literalId = `LITERAL#arg${index}#${module.file}#${argInfo.line}:${argInfo.column}:${literalCounterRef.value++}`;
|
|
168
|
-
literals.push({
|
|
169
|
-
id: literalId,
|
|
170
|
-
type: 'LITERAL',
|
|
171
|
-
value: literalValue,
|
|
172
|
-
valueType: typeof literalValue,
|
|
173
|
-
file: module.file,
|
|
174
|
-
line: argInfo.line,
|
|
175
|
-
column: argInfo.column,
|
|
176
|
-
parentCallId: callId,
|
|
177
|
-
argIndex: index
|
|
178
|
-
});
|
|
179
|
-
argInfo.targetType = 'LITERAL';
|
|
180
|
-
argInfo.targetId = literalId;
|
|
181
|
-
argInfo.literalValue = literalValue;
|
|
182
|
-
}
|
|
183
|
-
// Variable reference
|
|
184
|
-
else if (actualArg.type === 'Identifier') {
|
|
185
|
-
argInfo.targetType = 'VARIABLE';
|
|
186
|
-
argInfo.targetName = actualArg.name; // Will be resolved in GraphBuilder
|
|
187
|
-
}
|
|
188
|
-
// Function expression (callback)
|
|
189
|
-
else if (actualArg.type === 'ArrowFunctionExpression' || actualArg.type === 'FunctionExpression') {
|
|
190
|
-
argInfo.targetType = 'FUNCTION';
|
|
191
|
-
argInfo.functionLine = actualArg.loc?.start.line;
|
|
192
|
-
argInfo.functionColumn = actualArg.loc?.start.column;
|
|
193
|
-
}
|
|
194
|
-
// Call expression (nested call)
|
|
195
|
-
else if (actualArg.type === 'CallExpression') {
|
|
196
|
-
argInfo.targetType = 'CALL';
|
|
197
|
-
// Nested calls will be processed separately, link by position
|
|
198
|
-
argInfo.nestedCallLine = actualArg.loc?.start.line;
|
|
199
|
-
argInfo.nestedCallColumn = actualArg.loc?.start.column;
|
|
200
|
-
}
|
|
201
|
-
// Member expression: obj.prop or obj[x]
|
|
202
|
-
else if (actualArg.type === 'MemberExpression') {
|
|
203
|
-
const memberExpr = actualArg;
|
|
204
|
-
argInfo.targetType = 'EXPRESSION';
|
|
205
|
-
argInfo.expressionType = 'MemberExpression';
|
|
206
|
-
if (memberExpr.object.type === 'Identifier') {
|
|
207
|
-
argInfo.objectName = memberExpr.object.name;
|
|
208
|
-
}
|
|
209
|
-
if (!memberExpr.computed && memberExpr.property.type === 'Identifier') {
|
|
210
|
-
argInfo.propertyName = memberExpr.property.name;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// Binary/Logical expression: a + b, a && b
|
|
214
|
-
else if (actualArg.type === 'BinaryExpression' || actualArg.type === 'LogicalExpression') {
|
|
215
|
-
const expr = actualArg;
|
|
216
|
-
const operator = expr.operator || '?';
|
|
217
|
-
const counter = literalCounterRef.value++;
|
|
218
|
-
// Create EXPRESSION node via NodeFactory
|
|
219
|
-
const expressionNode = NodeFactory.createArgumentExpression(actualArg.type, module.file, argInfo.line, argInfo.column, {
|
|
220
|
-
parentCallId: callId,
|
|
221
|
-
argIndex: index,
|
|
222
|
-
operator,
|
|
223
|
-
counter
|
|
224
|
-
});
|
|
225
|
-
literals.push(expressionNode);
|
|
226
|
-
argInfo.targetType = 'EXPRESSION';
|
|
227
|
-
argInfo.targetId = expressionNode.id;
|
|
228
|
-
argInfo.expressionType = actualArg.type;
|
|
229
|
-
// Track DERIVES_FROM edges for identifiers in expression
|
|
230
|
-
const identifiers = this.extractIdentifiers(actualArg);
|
|
231
|
-
const { variableAssignments } = this.collections;
|
|
232
|
-
if (variableAssignments) {
|
|
233
|
-
for (const identName of identifiers) {
|
|
234
|
-
variableAssignments.push({
|
|
235
|
-
variableId: expressionNode.id,
|
|
236
|
-
sourceId: null,
|
|
237
|
-
sourceName: identName,
|
|
238
|
-
sourceType: 'DERIVES_FROM_VARIABLE',
|
|
239
|
-
file: module.file
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
// Other expression types (fallback for unhandled expression types)
|
|
245
|
-
else {
|
|
246
|
-
argInfo.targetType = 'EXPRESSION';
|
|
247
|
-
argInfo.expressionType = actualArg.type;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
callArguments.push(argInfo);
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Extract all Identifier names from an expression (recursively)
|
|
255
|
-
* Used for BinaryExpression/LogicalExpression to track DERIVES_FROM edges
|
|
256
|
-
*/
|
|
257
|
-
extractIdentifiers(node, identifiers = new Set()) {
|
|
258
|
-
if (!node)
|
|
259
|
-
return Array.from(identifiers);
|
|
260
|
-
if (node.type === 'Identifier') {
|
|
261
|
-
identifiers.add(node.name);
|
|
262
|
-
}
|
|
263
|
-
else if (node.type === 'BinaryExpression' || node.type === 'LogicalExpression') {
|
|
264
|
-
const expr = node;
|
|
265
|
-
this.extractIdentifiers(expr.left, identifiers);
|
|
266
|
-
this.extractIdentifiers(expr.right, identifiers);
|
|
267
|
-
}
|
|
268
|
-
else if (node.type === 'UnaryExpression') {
|
|
269
|
-
const expr = node;
|
|
270
|
-
this.extractIdentifiers(expr.argument, identifiers);
|
|
271
|
-
}
|
|
272
|
-
else if (node.type === 'ConditionalExpression') {
|
|
273
|
-
const expr = node;
|
|
274
|
-
this.extractIdentifiers(expr.test, identifiers);
|
|
275
|
-
this.extractIdentifiers(expr.consequent, identifiers);
|
|
276
|
-
this.extractIdentifiers(expr.alternate, identifiers);
|
|
277
|
-
}
|
|
278
|
-
else if (node.type === 'MemberExpression') {
|
|
279
|
-
const memberExpr = node;
|
|
280
|
-
// For obj.prop - track obj (but not prop as it's a property name)
|
|
281
|
-
if (memberExpr.object.type === 'Identifier') {
|
|
282
|
-
identifiers.add(memberExpr.object.name);
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
this.extractIdentifiers(memberExpr.object, identifiers);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
else if (node.type === 'CallExpression') {
|
|
289
|
-
const callExpr = node;
|
|
290
|
-
// For func() - track func if identifier, and all arguments
|
|
291
|
-
if (callExpr.callee.type === 'Identifier') {
|
|
292
|
-
identifiers.add(callExpr.callee.name);
|
|
293
|
-
}
|
|
294
|
-
for (const arg of callExpr.arguments) {
|
|
295
|
-
if (arg.type !== 'SpreadElement') {
|
|
296
|
-
this.extractIdentifiers(arg, identifiers);
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
this.extractIdentifiers(arg.argument, identifiers);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return Array.from(identifiers);
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Extract object properties and create ObjectPropertyInfo records
|
|
307
|
-
*/
|
|
308
|
-
extractObjectProperties(objectExpr, objectId, module, objectProperties, objectLiterals, objectLiteralCounterRef, literals, literalCounterRef) {
|
|
309
|
-
for (const prop of objectExpr.properties) {
|
|
310
|
-
const propLine = prop.loc?.start.line || 0;
|
|
311
|
-
const propColumn = prop.loc?.start.column || 0;
|
|
312
|
-
// Handle spread properties: { ...other }
|
|
313
|
-
if (prop.type === 'SpreadElement') {
|
|
314
|
-
const spreadArg = prop.argument;
|
|
315
|
-
const propertyInfo = {
|
|
316
|
-
objectId,
|
|
317
|
-
propertyName: '<spread>',
|
|
318
|
-
valueType: 'SPREAD',
|
|
319
|
-
file: module.file,
|
|
320
|
-
line: propLine,
|
|
321
|
-
column: propColumn
|
|
322
|
-
};
|
|
323
|
-
if (spreadArg.type === 'Identifier') {
|
|
324
|
-
propertyInfo.valueName = spreadArg.name;
|
|
325
|
-
propertyInfo.valueType = 'VARIABLE';
|
|
326
|
-
// REG-329: Capture scope path for spread variable resolution
|
|
327
|
-
propertyInfo.valueScopePath = this.scopeTracker?.getContext().scopePath ?? [];
|
|
328
|
-
}
|
|
329
|
-
objectProperties.push(propertyInfo);
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
// Handle regular properties
|
|
333
|
-
if (prop.type === 'ObjectProperty') {
|
|
334
|
-
const objProp = prop;
|
|
335
|
-
let propertyName;
|
|
336
|
-
// Get property name
|
|
337
|
-
if (objProp.key.type === 'Identifier') {
|
|
338
|
-
propertyName = objProp.key.name;
|
|
339
|
-
}
|
|
340
|
-
else if (objProp.key.type === 'StringLiteral') {
|
|
341
|
-
propertyName = objProp.key.value;
|
|
342
|
-
}
|
|
343
|
-
else if (objProp.key.type === 'NumericLiteral') {
|
|
344
|
-
propertyName = String(objProp.key.value);
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
propertyName = '<computed>';
|
|
348
|
-
}
|
|
349
|
-
const propertyInfo = {
|
|
350
|
-
objectId,
|
|
351
|
-
propertyName,
|
|
352
|
-
file: module.file,
|
|
353
|
-
line: propLine,
|
|
354
|
-
column: propColumn,
|
|
355
|
-
valueType: 'EXPRESSION'
|
|
356
|
-
};
|
|
357
|
-
const value = objProp.value;
|
|
358
|
-
// Nested object literal - check BEFORE extractLiteralValue
|
|
359
|
-
if (value.type === 'ObjectExpression') {
|
|
360
|
-
// Use factory - do NOT pass argIndex for nested literals (uses 'obj' suffix)
|
|
361
|
-
const nestedObjectNode = ObjectLiteralNode.create(module.file, value.loc?.start.line || 0, value.loc?.start.column || 0, {
|
|
362
|
-
counter: objectLiteralCounterRef.value++
|
|
363
|
-
});
|
|
364
|
-
objectLiterals.push(nestedObjectNode);
|
|
365
|
-
const nestedObjectId = nestedObjectNode.id;
|
|
366
|
-
// Recursively extract nested properties
|
|
367
|
-
this.extractObjectProperties(value, nestedObjectId, module, objectProperties, objectLiterals, objectLiteralCounterRef, literals, literalCounterRef);
|
|
368
|
-
propertyInfo.valueType = 'OBJECT_LITERAL';
|
|
369
|
-
propertyInfo.nestedObjectId = nestedObjectId;
|
|
370
|
-
propertyInfo.valueNodeId = nestedObjectId;
|
|
371
|
-
}
|
|
372
|
-
// Nested array literal - check BEFORE extractLiteralValue
|
|
373
|
-
else if (value.type === 'ArrayExpression') {
|
|
374
|
-
const arrayLiteralCounterRef = (this.collections.arrayLiteralCounterRef ?? { value: 0 });
|
|
375
|
-
const arrayLiterals = this.collections.arrayLiterals ?? [];
|
|
376
|
-
const arrayElements = this.collections.arrayElements ?? [];
|
|
377
|
-
// Use factory - do NOT pass argIndex for nested literals (uses 'arr' suffix)
|
|
378
|
-
const nestedArrayNode = ArrayLiteralNode.create(module.file, value.loc?.start.line || 0, value.loc?.start.column || 0, {
|
|
379
|
-
counter: arrayLiteralCounterRef.value++
|
|
380
|
-
});
|
|
381
|
-
arrayLiterals.push(nestedArrayNode);
|
|
382
|
-
const nestedArrayId = nestedArrayNode.id;
|
|
383
|
-
// Recursively extract array elements
|
|
384
|
-
this.extractArrayElements(value, nestedArrayId, module, arrayElements, arrayLiterals, arrayLiteralCounterRef, objectLiterals, objectLiteralCounterRef, objectProperties, literals, literalCounterRef);
|
|
385
|
-
propertyInfo.valueType = 'ARRAY_LITERAL';
|
|
386
|
-
propertyInfo.nestedArrayId = nestedArrayId;
|
|
387
|
-
propertyInfo.valueNodeId = nestedArrayId;
|
|
388
|
-
}
|
|
389
|
-
// Literal value (primitives only - objects/arrays handled above)
|
|
390
|
-
else {
|
|
391
|
-
const literalValue = ExpressionEvaluator.extractLiteralValue(value);
|
|
392
|
-
// Handle both non-null literals AND explicit null literals (NullLiteral)
|
|
393
|
-
if (literalValue !== null || value.type === 'NullLiteral') {
|
|
394
|
-
const literalId = `LITERAL#${propertyName}#${module.file}#${propLine}:${propColumn}:${literalCounterRef.value++}`;
|
|
395
|
-
literals.push({
|
|
396
|
-
id: literalId,
|
|
397
|
-
type: 'LITERAL',
|
|
398
|
-
value: literalValue,
|
|
399
|
-
valueType: typeof literalValue,
|
|
400
|
-
file: module.file,
|
|
401
|
-
line: propLine,
|
|
402
|
-
column: propColumn,
|
|
403
|
-
parentCallId: objectId,
|
|
404
|
-
argIndex: 0
|
|
405
|
-
});
|
|
406
|
-
propertyInfo.valueType = 'LITERAL';
|
|
407
|
-
propertyInfo.valueNodeId = literalId;
|
|
408
|
-
propertyInfo.literalValue = literalValue;
|
|
409
|
-
}
|
|
410
|
-
// Variable reference
|
|
411
|
-
else if (value.type === 'Identifier') {
|
|
412
|
-
propertyInfo.valueType = 'VARIABLE';
|
|
413
|
-
propertyInfo.valueName = value.name;
|
|
414
|
-
// REG-329: Capture scope path for scope-aware variable resolution
|
|
415
|
-
propertyInfo.valueScopePath = this.scopeTracker?.getContext().scopePath ?? [];
|
|
416
|
-
}
|
|
417
|
-
// Call expression
|
|
418
|
-
else if (value.type === 'CallExpression') {
|
|
419
|
-
propertyInfo.valueType = 'CALL';
|
|
420
|
-
propertyInfo.callLine = value.loc?.start.line;
|
|
421
|
-
propertyInfo.callColumn = value.loc?.start.column;
|
|
422
|
-
}
|
|
423
|
-
// Other expressions
|
|
424
|
-
else {
|
|
425
|
-
propertyInfo.valueType = 'EXPRESSION';
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
objectProperties.push(propertyInfo);
|
|
429
|
-
}
|
|
430
|
-
// Handle object methods: { foo() {} }
|
|
431
|
-
else if (prop.type === 'ObjectMethod') {
|
|
432
|
-
const propertyName = prop.key.type === 'Identifier' ? prop.key.name : '<computed>';
|
|
433
|
-
objectProperties.push({
|
|
434
|
-
objectId,
|
|
435
|
-
propertyName,
|
|
436
|
-
valueType: 'EXPRESSION',
|
|
437
|
-
file: module.file,
|
|
438
|
-
line: propLine,
|
|
439
|
-
column: propColumn
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Extract array elements and create ArrayElementInfo records
|
|
446
|
-
*/
|
|
447
|
-
extractArrayElements(arrayExpr, arrayId, module, arrayElements, arrayLiterals, arrayLiteralCounterRef, objectLiterals, objectLiteralCounterRef, objectProperties, literals, literalCounterRef) {
|
|
448
|
-
arrayExpr.elements.forEach((element, index) => {
|
|
449
|
-
if (!element)
|
|
450
|
-
return; // Skip holes in arrays
|
|
451
|
-
const elemLine = element.loc?.start.line || 0;
|
|
452
|
-
const elemColumn = element.loc?.start.column || 0;
|
|
453
|
-
const elementInfo = {
|
|
454
|
-
arrayId,
|
|
455
|
-
index,
|
|
456
|
-
file: module.file,
|
|
457
|
-
line: elemLine,
|
|
458
|
-
column: elemColumn,
|
|
459
|
-
valueType: 'EXPRESSION'
|
|
460
|
-
};
|
|
461
|
-
// Handle spread elements: [...arr]
|
|
462
|
-
if (element.type === 'SpreadElement') {
|
|
463
|
-
const spreadArg = element.argument;
|
|
464
|
-
elementInfo.valueType = 'SPREAD';
|
|
465
|
-
if (spreadArg.type === 'Identifier') {
|
|
466
|
-
elementInfo.valueName = spreadArg.name;
|
|
467
|
-
}
|
|
468
|
-
arrayElements.push(elementInfo);
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
// Nested object literal - check BEFORE extractLiteralValue
|
|
472
|
-
if (element.type === 'ObjectExpression') {
|
|
473
|
-
// Use factory - do NOT pass argIndex for nested literals (uses 'obj' suffix)
|
|
474
|
-
const nestedObjectNode = ObjectLiteralNode.create(module.file, elemLine, elemColumn, {
|
|
475
|
-
counter: objectLiteralCounterRef.value++
|
|
476
|
-
});
|
|
477
|
-
objectLiterals.push(nestedObjectNode);
|
|
478
|
-
const nestedObjectId = nestedObjectNode.id;
|
|
479
|
-
// Recursively extract properties
|
|
480
|
-
this.extractObjectProperties(element, nestedObjectId, module, objectProperties, objectLiterals, objectLiteralCounterRef, literals, literalCounterRef);
|
|
481
|
-
elementInfo.valueType = 'OBJECT_LITERAL';
|
|
482
|
-
elementInfo.nestedObjectId = nestedObjectId;
|
|
483
|
-
elementInfo.valueNodeId = nestedObjectId;
|
|
484
|
-
}
|
|
485
|
-
// Nested array literal - check BEFORE extractLiteralValue
|
|
486
|
-
else if (element.type === 'ArrayExpression') {
|
|
487
|
-
// Use factory - do NOT pass argIndex for nested literals (uses 'arr' suffix)
|
|
488
|
-
const nestedArrayNode = ArrayLiteralNode.create(module.file, elemLine, elemColumn, {
|
|
489
|
-
counter: arrayLiteralCounterRef.value++
|
|
490
|
-
});
|
|
491
|
-
arrayLiterals.push(nestedArrayNode);
|
|
492
|
-
const nestedArrayId = nestedArrayNode.id;
|
|
493
|
-
// Recursively extract elements
|
|
494
|
-
this.extractArrayElements(element, nestedArrayId, module, arrayElements, arrayLiterals, arrayLiteralCounterRef, objectLiterals, objectLiteralCounterRef, objectProperties, literals, literalCounterRef);
|
|
495
|
-
elementInfo.valueType = 'ARRAY_LITERAL';
|
|
496
|
-
elementInfo.nestedArrayId = nestedArrayId;
|
|
497
|
-
elementInfo.valueNodeId = nestedArrayId;
|
|
498
|
-
}
|
|
499
|
-
// Literal value (primitives only - objects/arrays handled above)
|
|
500
|
-
else {
|
|
501
|
-
const literalValue = ExpressionEvaluator.extractLiteralValue(element);
|
|
502
|
-
if (literalValue !== null) {
|
|
503
|
-
const literalId = `LITERAL#elem${index}#${module.file}#${elemLine}:${elemColumn}:${literalCounterRef.value++}`;
|
|
504
|
-
literals.push({
|
|
505
|
-
id: literalId,
|
|
506
|
-
type: 'LITERAL',
|
|
507
|
-
value: literalValue,
|
|
508
|
-
valueType: typeof literalValue,
|
|
509
|
-
file: module.file,
|
|
510
|
-
line: elemLine,
|
|
511
|
-
column: elemColumn,
|
|
512
|
-
parentCallId: arrayId,
|
|
513
|
-
argIndex: index
|
|
514
|
-
});
|
|
515
|
-
elementInfo.valueType = 'LITERAL';
|
|
516
|
-
elementInfo.valueNodeId = literalId;
|
|
517
|
-
elementInfo.literalValue = literalValue;
|
|
518
|
-
}
|
|
519
|
-
// Variable reference
|
|
520
|
-
else if (element.type === 'Identifier') {
|
|
521
|
-
elementInfo.valueType = 'VARIABLE';
|
|
522
|
-
elementInfo.valueName = element.name;
|
|
523
|
-
}
|
|
524
|
-
// Call expression
|
|
525
|
-
else if (element.type === 'CallExpression') {
|
|
526
|
-
elementInfo.valueType = 'CALL';
|
|
527
|
-
elementInfo.callLine = element.loc?.start.line;
|
|
528
|
-
elementInfo.callColumn = element.loc?.start.column;
|
|
529
|
-
}
|
|
530
|
-
// Other expressions
|
|
531
|
-
else {
|
|
532
|
-
elementInfo.valueType = 'EXPRESSION';
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
arrayElements.push(elementInfo);
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Detect array mutation calls (push, unshift, splice) and collect mutation info
|
|
540
|
-
* for later FLOWS_INTO edge creation in GraphBuilder
|
|
541
|
-
*
|
|
542
|
-
* REG-117: Added isNested, baseObjectName, propertyName for nested mutations
|
|
543
|
-
*/
|
|
544
|
-
detectArrayMutation(callNode, arrayName, method, module, isNested, baseObjectName, propertyName) {
|
|
545
|
-
// Initialize collection if not exists
|
|
546
|
-
if (!this.collections.arrayMutations) {
|
|
547
|
-
this.collections.arrayMutations = [];
|
|
548
|
-
}
|
|
549
|
-
const arrayMutations = this.collections.arrayMutations;
|
|
550
|
-
const mutationArgs = [];
|
|
551
|
-
// For splice, only arguments from index 2 onwards are insertions
|
|
552
|
-
// splice(start, deleteCount, item1, item2, ...)
|
|
553
|
-
callNode.arguments.forEach((arg, index) => {
|
|
554
|
-
// Skip start and deleteCount for splice
|
|
555
|
-
if (method === 'splice' && index < 2)
|
|
556
|
-
return;
|
|
557
|
-
const argInfo = {
|
|
558
|
-
argIndex: method === 'splice' ? index - 2 : index,
|
|
559
|
-
isSpread: arg.type === 'SpreadElement',
|
|
560
|
-
valueType: 'EXPRESSION' // Default
|
|
561
|
-
};
|
|
562
|
-
let actualArg = arg;
|
|
563
|
-
if (arg.type === 'SpreadElement') {
|
|
564
|
-
actualArg = arg.argument;
|
|
565
|
-
}
|
|
566
|
-
// Determine value type and store coordinates for node lookup in GraphBuilder.
|
|
567
|
-
// IMPORTANT: Check ObjectExpression/ArrayExpression BEFORE extractLiteralValue
|
|
568
|
-
// to match the order in extractArguments (which creates the actual nodes).
|
|
569
|
-
// extractLiteralValue returns objects/arrays with all-literal properties as
|
|
570
|
-
// literal values, but extractArguments creates OBJECT_LITERAL/ARRAY_LITERAL nodes.
|
|
571
|
-
if (actualArg.type === 'ObjectExpression') {
|
|
572
|
-
argInfo.valueType = 'OBJECT_LITERAL';
|
|
573
|
-
argInfo.valueLine = actualArg.loc?.start.line;
|
|
574
|
-
argInfo.valueColumn = actualArg.loc?.start.column;
|
|
575
|
-
}
|
|
576
|
-
else if (actualArg.type === 'ArrayExpression') {
|
|
577
|
-
argInfo.valueType = 'ARRAY_LITERAL';
|
|
578
|
-
argInfo.valueLine = actualArg.loc?.start.line;
|
|
579
|
-
argInfo.valueColumn = actualArg.loc?.start.column;
|
|
580
|
-
}
|
|
581
|
-
else if (actualArg.type === 'Identifier') {
|
|
582
|
-
argInfo.valueType = 'VARIABLE';
|
|
583
|
-
argInfo.valueName = actualArg.name;
|
|
584
|
-
}
|
|
585
|
-
else if (actualArg.type === 'CallExpression') {
|
|
586
|
-
argInfo.valueType = 'CALL';
|
|
587
|
-
argInfo.callLine = actualArg.loc?.start.line;
|
|
588
|
-
argInfo.callColumn = actualArg.loc?.start.column;
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
const literalValue = ExpressionEvaluator.extractLiteralValue(actualArg);
|
|
592
|
-
if (literalValue !== null) {
|
|
593
|
-
argInfo.valueType = 'LITERAL';
|
|
594
|
-
argInfo.literalValue = literalValue;
|
|
595
|
-
argInfo.valueLine = actualArg.loc?.start.line;
|
|
596
|
-
argInfo.valueColumn = actualArg.loc?.start.column;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
mutationArgs.push(argInfo);
|
|
600
|
-
});
|
|
601
|
-
// Only record if there are actual insertions
|
|
602
|
-
if (mutationArgs.length > 0) {
|
|
603
|
-
const line = callNode.loc?.start.line ?? 0;
|
|
604
|
-
const column = callNode.loc?.start.column ?? 0;
|
|
605
|
-
// Generate semantic ID for array mutation if scopeTracker available
|
|
606
|
-
const scopeTracker = this.scopeTracker;
|
|
607
|
-
let mutationId;
|
|
608
|
-
// Capture scope path for scope-aware lookup (REG-309)
|
|
609
|
-
const scopePath = scopeTracker?.getContext().scopePath ?? [];
|
|
610
|
-
if (scopeTracker) {
|
|
611
|
-
const discriminator = scopeTracker.getItemCounter(`ARRAY_MUTATION:${arrayName}.${method}`);
|
|
612
|
-
mutationId = computeSemanticId('ARRAY_MUTATION', `${arrayName}.${method}`, scopeTracker.getContext(), { discriminator });
|
|
613
|
-
}
|
|
614
|
-
arrayMutations.push({
|
|
615
|
-
id: mutationId,
|
|
616
|
-
arrayName,
|
|
617
|
-
mutationScopePath: scopePath,
|
|
618
|
-
mutationMethod: method,
|
|
619
|
-
file: module.file,
|
|
620
|
-
line,
|
|
621
|
-
column,
|
|
622
|
-
insertedValues: mutationArgs,
|
|
623
|
-
// REG-117: Nested mutation fields
|
|
624
|
-
isNested,
|
|
625
|
-
baseObjectName,
|
|
626
|
-
propertyName
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Detect Object.assign(target, source1, source2, ...) calls
|
|
632
|
-
* Creates ObjectMutationInfo for FLOWS_INTO edge generation in GraphBuilder
|
|
633
|
-
*
|
|
634
|
-
* @param callNode - The call expression node
|
|
635
|
-
* @param module - Current module being analyzed
|
|
636
|
-
*/
|
|
637
|
-
detectObjectAssign(callNode, module) {
|
|
638
|
-
// Need at least 2 arguments: target and at least one source
|
|
639
|
-
if (callNode.arguments.length < 2)
|
|
640
|
-
return;
|
|
641
|
-
// Initialize object mutations collection if not exists
|
|
642
|
-
if (!this.collections.objectMutations) {
|
|
643
|
-
this.collections.objectMutations = [];
|
|
644
|
-
}
|
|
645
|
-
const objectMutations = this.collections.objectMutations;
|
|
646
|
-
// First argument is target
|
|
647
|
-
const targetArg = callNode.arguments[0];
|
|
648
|
-
let targetName;
|
|
649
|
-
if (targetArg.type === 'Identifier') {
|
|
650
|
-
targetName = targetArg.name;
|
|
651
|
-
}
|
|
652
|
-
else if (targetArg.type === 'ObjectExpression') {
|
|
653
|
-
targetName = '<anonymous>';
|
|
654
|
-
}
|
|
655
|
-
else {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
const line = callNode.loc?.start.line ?? 0;
|
|
659
|
-
const column = callNode.loc?.start.column ?? 0;
|
|
660
|
-
for (let i = 1; i < callNode.arguments.length; i++) {
|
|
661
|
-
let arg = callNode.arguments[i];
|
|
662
|
-
let isSpread = false;
|
|
663
|
-
if (arg.type === 'SpreadElement') {
|
|
664
|
-
isSpread = true;
|
|
665
|
-
arg = arg.argument;
|
|
666
|
-
}
|
|
667
|
-
const valueInfo = {
|
|
668
|
-
valueType: 'EXPRESSION',
|
|
669
|
-
argIndex: i - 1,
|
|
670
|
-
isSpread
|
|
671
|
-
};
|
|
672
|
-
const literalValue = ExpressionEvaluator.extractLiteralValue(arg);
|
|
673
|
-
if (literalValue !== null) {
|
|
674
|
-
valueInfo.valueType = 'LITERAL';
|
|
675
|
-
valueInfo.literalValue = literalValue;
|
|
676
|
-
}
|
|
677
|
-
else if (arg.type === 'Identifier') {
|
|
678
|
-
valueInfo.valueType = 'VARIABLE';
|
|
679
|
-
valueInfo.valueName = arg.name;
|
|
680
|
-
}
|
|
681
|
-
else if (arg.type === 'ObjectExpression') {
|
|
682
|
-
valueInfo.valueType = 'OBJECT_LITERAL';
|
|
683
|
-
}
|
|
684
|
-
else if (arg.type === 'ArrayExpression') {
|
|
685
|
-
valueInfo.valueType = 'ARRAY_LITERAL';
|
|
686
|
-
}
|
|
687
|
-
else if (arg.type === 'CallExpression') {
|
|
688
|
-
valueInfo.valueType = 'CALL';
|
|
689
|
-
valueInfo.callLine = arg.loc?.start.line;
|
|
690
|
-
valueInfo.callColumn = arg.loc?.start.column;
|
|
691
|
-
}
|
|
692
|
-
// Capture scope path for scope-aware lookup (REG-309)
|
|
693
|
-
const scopePath = this.scopeTracker?.getContext().scopePath ?? [];
|
|
694
|
-
let mutationId;
|
|
695
|
-
if (this.scopeTracker) {
|
|
696
|
-
const discriminator = this.scopeTracker.getItemCounter(`OBJECT_MUTATION:Object.assign:${targetName}`);
|
|
697
|
-
mutationId = computeSemanticId('OBJECT_MUTATION', `Object.assign:${targetName}`, this.scopeTracker.getContext(), { discriminator });
|
|
698
|
-
}
|
|
699
|
-
objectMutations.push({
|
|
700
|
-
id: mutationId,
|
|
701
|
-
objectName: targetName,
|
|
702
|
-
mutationScopePath: scopePath,
|
|
703
|
-
propertyName: '<assign>',
|
|
704
|
-
mutationType: 'assign',
|
|
705
|
-
file: module.file,
|
|
706
|
-
line,
|
|
707
|
-
column,
|
|
708
|
-
value: valueInfo
|
|
709
|
-
});
|
|
710
|
-
}
|
|
39
|
+
this.sharedIdGenerator = sharedIdGenerator;
|
|
711
40
|
}
|
|
712
41
|
/**
|
|
713
42
|
* Extract full dotted name from a MemberExpression chain.
|
|
@@ -790,268 +119,306 @@ export class CallExpressionVisitor extends ASTVisitor {
|
|
|
790
119
|
return `${module.file}->${scopePath.join('->')}->FUNCTION->${funcName}`;
|
|
791
120
|
}
|
|
792
121
|
getHandlers() {
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
122
|
+
const s = {
|
|
123
|
+
module: this.module,
|
|
124
|
+
callSites: (this.collections.callSites ?? []),
|
|
125
|
+
methodCalls: (this.collections.methodCalls ?? []),
|
|
126
|
+
eventListeners: (this.collections.eventListeners ?? []),
|
|
127
|
+
methodCallbacks: (this.collections.methodCallbacks ?? []),
|
|
128
|
+
literals: (this.collections.literals ?? []),
|
|
129
|
+
callArguments: (this.collections.callArguments ?? []),
|
|
130
|
+
callSiteCounterRef: (this.collections.callSiteCounterRef ?? { value: 0 }),
|
|
131
|
+
literalCounterRef: (this.collections.literalCounterRef ?? { value: 0 }),
|
|
132
|
+
processedNodes: this.collections.processedNodes ?? { callSites: new Set(), methodCalls: new Set(), eventListeners: new Set() },
|
|
133
|
+
scopeTracker: this.scopeTracker,
|
|
134
|
+
};
|
|
804
135
|
return {
|
|
805
136
|
CallExpression: (path) => {
|
|
806
137
|
const callNode = path.node;
|
|
807
138
|
const functionParent = path.getFunctionParent();
|
|
808
|
-
//
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
139
|
+
// Skip if inside function - handled by analyzeFunctionBody
|
|
140
|
+
if (functionParent)
|
|
141
|
+
return;
|
|
142
|
+
const parentScopeId = s.module.id;
|
|
143
|
+
const isAwaited = path.parentPath?.isAwaitExpression() ?? false;
|
|
812
144
|
if (callNode.callee.type === 'Identifier') {
|
|
813
|
-
|
|
814
|
-
return;
|
|
815
|
-
}
|
|
816
|
-
const callee = callNode.callee;
|
|
817
|
-
const line = getLine(callNode);
|
|
818
|
-
const column = getColumn(callNode);
|
|
819
|
-
// Generate ID using centralized IdGenerator
|
|
820
|
-
const idGenerator = new IdGenerator(scopeTracker);
|
|
821
|
-
const callId = idGenerator.generate('CALL', callee.name, module.file, line, column, callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:${callee.name}` });
|
|
822
|
-
callSites.push({
|
|
823
|
-
id: callId,
|
|
824
|
-
type: 'CALL',
|
|
825
|
-
name: callee.name,
|
|
826
|
-
file: module.file,
|
|
827
|
-
line,
|
|
828
|
-
column,
|
|
829
|
-
parentScopeId,
|
|
830
|
-
targetFunctionName: callee.name
|
|
831
|
-
});
|
|
832
|
-
// Extract arguments for PASSES_ARGUMENT edges
|
|
833
|
-
if (callNode.arguments.length > 0) {
|
|
834
|
-
this.extractArguments(callNode.arguments, callId, module, callArguments, literals, literalCounterRef);
|
|
835
|
-
}
|
|
145
|
+
this.handleDirectCall(callNode, s, parentScopeId, isAwaited);
|
|
836
146
|
}
|
|
837
|
-
// MemberExpression calls (method calls)
|
|
838
|
-
// Skip if inside function - they will be processed by analyzeFunctionBody with proper scope tracking
|
|
839
147
|
else if (callNode.callee.type === 'MemberExpression') {
|
|
840
|
-
|
|
841
|
-
return;
|
|
842
|
-
}
|
|
843
|
-
const memberCallee = callNode.callee;
|
|
844
|
-
const object = memberCallee.object;
|
|
845
|
-
const property = memberCallee.property;
|
|
846
|
-
const isComputed = memberCallee.computed;
|
|
847
|
-
if ((object.type === 'Identifier' || object.type === 'ThisExpression') && property.type === 'Identifier') {
|
|
848
|
-
const objectName = object.type === 'Identifier' ? object.name : 'this';
|
|
849
|
-
// For computed access obj[x](), methodName is '<computed>' but we save the variable name
|
|
850
|
-
const methodName = isComputed ? '<computed>' : property.name;
|
|
851
|
-
const computedPropertyVar = isComputed ? property.name : null;
|
|
852
|
-
// Special handling for .on() event handlers
|
|
853
|
-
if (methodName === 'on' && callNode.arguments.length >= 2) {
|
|
854
|
-
const firstArg = callNode.arguments[0];
|
|
855
|
-
const secondArg = callNode.arguments[1];
|
|
856
|
-
if (firstArg.type === 'StringLiteral') {
|
|
857
|
-
const eventName = firstArg.value;
|
|
858
|
-
// Dedup check
|
|
859
|
-
const nodeKey = `${callNode.start}:${callNode.end}`;
|
|
860
|
-
if (processedNodes.eventListeners.has(nodeKey)) {
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
processedNodes.eventListeners.add(nodeKey);
|
|
864
|
-
const eventLine = getLine(callNode);
|
|
865
|
-
const eventColumn = getColumn(callNode);
|
|
866
|
-
eventListeners.push({
|
|
867
|
-
id: `event:listener#${eventName}#${module.file}#${eventLine}:${eventColumn}:${callSiteCounterRef.value++}`,
|
|
868
|
-
type: 'event:listener',
|
|
869
|
-
name: eventName,
|
|
870
|
-
object: objectName,
|
|
871
|
-
file: module.file,
|
|
872
|
-
line: eventLine,
|
|
873
|
-
parentScopeId,
|
|
874
|
-
callbackArg: secondArg
|
|
875
|
-
});
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
879
|
-
// Regular method call
|
|
880
|
-
const nodeKey = `${callNode.start}:${callNode.end}`;
|
|
881
|
-
if (processedNodes.methodCalls.has(nodeKey)) {
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
processedNodes.methodCalls.add(nodeKey);
|
|
885
|
-
const fullName = `${objectName}.${methodName}`;
|
|
886
|
-
const methodLine = getLine(callNode);
|
|
887
|
-
const methodColumn = getColumn(callNode);
|
|
888
|
-
// Generate ID using centralized IdGenerator
|
|
889
|
-
const idGenerator = new IdGenerator(scopeTracker);
|
|
890
|
-
const methodCallId = idGenerator.generate('CALL', fullName, module.file, methodLine, methodColumn, callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:${fullName}` });
|
|
891
|
-
// REG-332: Check for grafema-ignore comment
|
|
892
|
-
const grafemaIgnore = getGrafemaIgnore(path);
|
|
893
|
-
methodCalls.push({
|
|
894
|
-
id: methodCallId,
|
|
895
|
-
type: 'CALL',
|
|
896
|
-
name: fullName,
|
|
897
|
-
object: objectName,
|
|
898
|
-
method: methodName,
|
|
899
|
-
computed: isComputed,
|
|
900
|
-
computedPropertyVar, // Variable name used in obj[x]() calls
|
|
901
|
-
file: module.file,
|
|
902
|
-
line: methodLine,
|
|
903
|
-
column: methodColumn,
|
|
904
|
-
parentScopeId,
|
|
905
|
-
grafemaIgnore: grafemaIgnore ?? undefined,
|
|
906
|
-
});
|
|
907
|
-
// Check for array mutation methods (push, unshift, splice)
|
|
908
|
-
const ARRAY_MUTATION_METHODS = ['push', 'unshift', 'splice'];
|
|
909
|
-
if (ARRAY_MUTATION_METHODS.includes(methodName)) {
|
|
910
|
-
this.detectArrayMutation(callNode, objectName, methodName, module);
|
|
911
|
-
}
|
|
912
|
-
// Check for Object.assign() calls
|
|
913
|
-
if (objectName === 'Object' && methodName === 'assign') {
|
|
914
|
-
this.detectObjectAssign(callNode, module);
|
|
915
|
-
}
|
|
916
|
-
// Extract arguments for PASSES_ARGUMENT edges
|
|
917
|
-
if (callNode.arguments.length > 0) {
|
|
918
|
-
this.extractArguments(callNode.arguments, methodCallId, module, callArguments, literals, literalCounterRef);
|
|
919
|
-
// Also track callbacks for HAS_CALLBACK edges
|
|
920
|
-
callNode.arguments.forEach((arg) => {
|
|
921
|
-
if (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression') {
|
|
922
|
-
methodCallbacks.push({
|
|
923
|
-
methodCallId,
|
|
924
|
-
callbackLine: getLine(arg),
|
|
925
|
-
callbackColumn: getColumn(arg),
|
|
926
|
-
callbackType: arg.type
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
// REG-117: Nested array mutations like obj.arr.push(item)
|
|
934
|
-
// REG-395: General nested method calls like a.b.c() or obj.nested.method()
|
|
935
|
-
// object is MemberExpression, property is the method name
|
|
936
|
-
else if (object.type === 'MemberExpression' && property.type === 'Identifier') {
|
|
937
|
-
const nestedMember = object;
|
|
938
|
-
const methodName = isComputed ? '<computed>' : property.name;
|
|
939
|
-
const ARRAY_MUTATION_METHODS = ['push', 'unshift', 'splice'];
|
|
940
|
-
if (ARRAY_MUTATION_METHODS.includes(methodName)) {
|
|
941
|
-
// Extract base object and property from nested MemberExpression
|
|
942
|
-
const base = nestedMember.object;
|
|
943
|
-
const prop = nestedMember.property;
|
|
944
|
-
// Only handle single-level nesting: obj.arr.push() or this.items.push()
|
|
945
|
-
if ((base.type === 'Identifier' || base.type === 'ThisExpression') &&
|
|
946
|
-
!nestedMember.computed &&
|
|
947
|
-
prop.type === 'Identifier') {
|
|
948
|
-
const baseObjectName = base.type === 'Identifier' ? base.name : 'this';
|
|
949
|
-
const propertyName = prop.name;
|
|
950
|
-
this.detectArrayMutation(callNode, `${baseObjectName}.${propertyName}`, // arrayName for ID purposes
|
|
951
|
-
methodName, module, true, // isNested
|
|
952
|
-
baseObjectName, propertyName);
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
// REG-395: Create CALL node for nested method calls like a.b.c()
|
|
956
|
-
// Extract full object name by walking the MemberExpression chain
|
|
957
|
-
const objectName = CallExpressionVisitor.extractMemberExpressionName(nestedMember);
|
|
958
|
-
if (objectName) {
|
|
959
|
-
const nodeKey = `${callNode.start}:${callNode.end}`;
|
|
960
|
-
if (!processedNodes.methodCalls.has(nodeKey)) {
|
|
961
|
-
processedNodes.methodCalls.add(nodeKey);
|
|
962
|
-
const fullName = `${objectName}.${methodName}`;
|
|
963
|
-
const methodLine = getLine(callNode);
|
|
964
|
-
const methodColumn = getColumn(callNode);
|
|
965
|
-
const idGenerator = new IdGenerator(scopeTracker);
|
|
966
|
-
const methodCallId = idGenerator.generate('CALL', fullName, module.file, methodLine, methodColumn, callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:${fullName}` });
|
|
967
|
-
const grafemaIgnore = getGrafemaIgnore(path);
|
|
968
|
-
methodCalls.push({
|
|
969
|
-
id: methodCallId,
|
|
970
|
-
type: 'CALL',
|
|
971
|
-
name: fullName,
|
|
972
|
-
object: objectName,
|
|
973
|
-
method: methodName,
|
|
974
|
-
file: module.file,
|
|
975
|
-
line: methodLine,
|
|
976
|
-
column: methodColumn,
|
|
977
|
-
parentScopeId,
|
|
978
|
-
grafemaIgnore: grafemaIgnore ?? undefined,
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
}
|
|
148
|
+
this.handleMemberCall(path, callNode, s, parentScopeId, isAwaited);
|
|
983
149
|
}
|
|
984
150
|
},
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
151
|
+
NewExpression: (path) => this.handleNewExpression(path, s),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/** Handle direct function calls: foo() */
|
|
155
|
+
handleDirectCall(callNode, s, parentScopeId, isAwaited) {
|
|
156
|
+
const callee = callNode.callee;
|
|
157
|
+
const line = getLine(callNode);
|
|
158
|
+
const column = getColumn(callNode);
|
|
159
|
+
const callInfo = {
|
|
160
|
+
id: '', // Placeholder — resolved by generateV2 or set below
|
|
161
|
+
type: 'CALL',
|
|
162
|
+
name: callee.name,
|
|
163
|
+
file: s.module.file,
|
|
164
|
+
line,
|
|
165
|
+
column,
|
|
166
|
+
parentScopeId,
|
|
167
|
+
targetFunctionName: callee.name,
|
|
168
|
+
isAwaited: isAwaited || undefined
|
|
169
|
+
};
|
|
170
|
+
if (this.sharedIdGenerator) {
|
|
171
|
+
const contentHints = {
|
|
172
|
+
arity: callNode.arguments.length,
|
|
173
|
+
firstLiteralArg: extractFirstLiteralArg(callNode)
|
|
174
|
+
};
|
|
175
|
+
this.sharedIdGenerator.generateV2('CALL', callee.name, s.module.file, contentHints, callInfo);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const idGenerator = new IdGenerator(s.scopeTracker);
|
|
179
|
+
callInfo.id = idGenerator.generate('CALL', callee.name, s.module.file, line, column, s.callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:${callee.name}` });
|
|
180
|
+
}
|
|
181
|
+
const callId = callInfo.id;
|
|
182
|
+
s.callSites.push(callInfo);
|
|
183
|
+
if (callNode.arguments.length > 0) {
|
|
184
|
+
ArgumentExtractor.extract(callNode.arguments, callId, s.module, s.callArguments, s.literals, s.literalCounterRef, this.collections, s.scopeTracker);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/** Handle method calls: obj.method(), obj.on('event', handler), obj.arr.push() */
|
|
188
|
+
handleMemberCall(path, callNode, s, parentScopeId, isAwaited) {
|
|
189
|
+
const memberCallee = callNode.callee;
|
|
190
|
+
const object = memberCallee.object;
|
|
191
|
+
const property = memberCallee.property;
|
|
192
|
+
const isComputed = memberCallee.computed;
|
|
193
|
+
if ((object.type === 'Identifier' || object.type === 'ThisExpression') && property.type === 'Identifier') {
|
|
194
|
+
this.handleSimpleMethodCall(path, callNode, s, parentScopeId, isAwaited, memberCallee, object, property, isComputed);
|
|
195
|
+
}
|
|
196
|
+
// REG-117/REG-395: Nested method calls like obj.arr.push() or a.b.c()
|
|
197
|
+
else if (object.type === 'MemberExpression' && property.type === 'Identifier') {
|
|
198
|
+
this.handleNestedMethodCall(path, callNode, s, parentScopeId, object, property, isComputed);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** Handle simple method calls: obj.method() or obj.on('event', handler) */
|
|
202
|
+
handleSimpleMethodCall(path, callNode, s, parentScopeId, isAwaited, memberCallee, object, property, isComputed) {
|
|
203
|
+
const objectName = object.type === 'Identifier' ? object.name : 'this';
|
|
204
|
+
const methodName = isComputed ? '<computed>' : property.name;
|
|
205
|
+
const computedPropertyVar = isComputed ? property.name : null;
|
|
206
|
+
// Special handling for .on() event handlers
|
|
207
|
+
if (methodName === 'on' && callNode.arguments.length >= 2) {
|
|
208
|
+
const firstArg = callNode.arguments[0];
|
|
209
|
+
const secondArg = callNode.arguments[1];
|
|
210
|
+
if (firstArg.type === 'StringLiteral') {
|
|
211
|
+
const nodeKey = `${callNode.start}:${callNode.end}`;
|
|
212
|
+
if (s.processedNodes.eventListeners.has(nodeKey))
|
|
992
213
|
return;
|
|
214
|
+
s.processedNodes.eventListeners.add(nodeKey);
|
|
215
|
+
const eventLine = getLine(callNode);
|
|
216
|
+
const eventColumn = getColumn(callNode);
|
|
217
|
+
s.eventListeners.push({
|
|
218
|
+
id: `event:listener#${firstArg.value}#${s.module.file}#${eventLine}:${eventColumn}:${s.callSiteCounterRef.value++}`,
|
|
219
|
+
type: 'event:listener',
|
|
220
|
+
name: firstArg.value,
|
|
221
|
+
object: objectName,
|
|
222
|
+
file: s.module.file,
|
|
223
|
+
line: eventLine,
|
|
224
|
+
parentScopeId,
|
|
225
|
+
callbackArg: secondArg
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// Regular method call
|
|
231
|
+
const nodeKey = `${callNode.start}:${callNode.end}`;
|
|
232
|
+
if (s.processedNodes.methodCalls.has(nodeKey))
|
|
233
|
+
return;
|
|
234
|
+
s.processedNodes.methodCalls.add(nodeKey);
|
|
235
|
+
const fullName = `${objectName}.${methodName}`;
|
|
236
|
+
const methodLine = getLine(callNode);
|
|
237
|
+
const methodColumn = getColumn(callNode);
|
|
238
|
+
const grafemaIgnore = getGrafemaIgnore(path);
|
|
239
|
+
const methodCallInfo = {
|
|
240
|
+
id: '', // Placeholder — resolved by generateV2 or set below
|
|
241
|
+
type: 'CALL',
|
|
242
|
+
name: fullName,
|
|
243
|
+
object: objectName,
|
|
244
|
+
method: methodName,
|
|
245
|
+
computed: isComputed,
|
|
246
|
+
computedPropertyVar,
|
|
247
|
+
file: s.module.file,
|
|
248
|
+
line: methodLine,
|
|
249
|
+
column: methodColumn,
|
|
250
|
+
parentScopeId,
|
|
251
|
+
grafemaIgnore: grafemaIgnore ?? undefined,
|
|
252
|
+
isAwaited: isAwaited || undefined,
|
|
253
|
+
};
|
|
254
|
+
if (this.sharedIdGenerator) {
|
|
255
|
+
const contentHints = {
|
|
256
|
+
arity: callNode.arguments.length,
|
|
257
|
+
firstLiteralArg: extractFirstLiteralArg(callNode)
|
|
258
|
+
};
|
|
259
|
+
this.sharedIdGenerator.generateV2('CALL', fullName, s.module.file, contentHints, methodCallInfo);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const idGenerator = new IdGenerator(s.scopeTracker);
|
|
263
|
+
methodCallInfo.id = idGenerator.generate('CALL', fullName, s.module.file, methodLine, methodColumn, s.callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:${fullName}` });
|
|
264
|
+
}
|
|
265
|
+
const methodCallId = methodCallInfo.id;
|
|
266
|
+
s.methodCalls.push(methodCallInfo);
|
|
267
|
+
// Check for array mutation methods (push, unshift, splice)
|
|
268
|
+
const ARRAY_MUTATION_METHODS = ['push', 'unshift', 'splice'];
|
|
269
|
+
if (ARRAY_MUTATION_METHODS.includes(methodName)) {
|
|
270
|
+
MutationDetector.detectArrayMutation(callNode, objectName, methodName, s.module, this.collections, s.scopeTracker);
|
|
271
|
+
}
|
|
272
|
+
// Check for Object.assign() calls
|
|
273
|
+
if (objectName === 'Object' && methodName === 'assign') {
|
|
274
|
+
MutationDetector.detectObjectAssign(callNode, s.module, this.collections, s.scopeTracker);
|
|
275
|
+
}
|
|
276
|
+
// Extract arguments for PASSES_ARGUMENT edges
|
|
277
|
+
if (callNode.arguments.length > 0) {
|
|
278
|
+
ArgumentExtractor.extract(callNode.arguments, methodCallId, s.module, s.callArguments, s.literals, s.literalCounterRef, this.collections, s.scopeTracker);
|
|
279
|
+
// Also track callbacks for HAS_CALLBACK edges
|
|
280
|
+
callNode.arguments.forEach((arg) => {
|
|
281
|
+
if (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression') {
|
|
282
|
+
s.methodCallbacks.push({
|
|
283
|
+
methodCallId,
|
|
284
|
+
callbackLine: getLine(arg),
|
|
285
|
+
callbackColumn: getColumn(arg),
|
|
286
|
+
callbackType: arg.type
|
|
287
|
+
});
|
|
993
288
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/** Handle nested method calls: obj.arr.push(), a.b.c() (REG-117, REG-395) */
|
|
293
|
+
handleNestedMethodCall(path, callNode, s, parentScopeId, nestedMember, property, isComputed) {
|
|
294
|
+
const methodName = isComputed ? '<computed>' : property.name;
|
|
295
|
+
const ARRAY_MUTATION_METHODS = ['push', 'unshift', 'splice'];
|
|
296
|
+
if (ARRAY_MUTATION_METHODS.includes(methodName)) {
|
|
297
|
+
const base = nestedMember.object;
|
|
298
|
+
const prop = nestedMember.property;
|
|
299
|
+
if ((base.type === 'Identifier' || base.type === 'ThisExpression') &&
|
|
300
|
+
!nestedMember.computed && prop.type === 'Identifier') {
|
|
301
|
+
const baseObjectName = base.type === 'Identifier' ? base.name : 'this';
|
|
302
|
+
const propertyName = prop.name;
|
|
303
|
+
MutationDetector.detectArrayMutation(callNode, `${baseObjectName}.${propertyName}`, methodName, s.module, this.collections, s.scopeTracker, true, baseObjectName, propertyName);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// REG-395: Create CALL node for nested method calls like a.b.c()
|
|
307
|
+
const objectName = CallExpressionVisitor.extractMemberExpressionName(nestedMember);
|
|
308
|
+
if (objectName) {
|
|
309
|
+
const nodeKey = `${callNode.start}:${callNode.end}`;
|
|
310
|
+
if (!s.processedNodes.methodCalls.has(nodeKey)) {
|
|
311
|
+
s.processedNodes.methodCalls.add(nodeKey);
|
|
312
|
+
const fullName = `${objectName}.${methodName}`;
|
|
313
|
+
const methodLine = getLine(callNode);
|
|
314
|
+
const methodColumn = getColumn(callNode);
|
|
315
|
+
const grafemaIgnore = getGrafemaIgnore(path);
|
|
316
|
+
const methodCallInfo = {
|
|
317
|
+
id: '', // Placeholder — resolved by generateV2 or set below
|
|
318
|
+
type: 'CALL',
|
|
319
|
+
name: fullName,
|
|
320
|
+
object: objectName,
|
|
321
|
+
method: methodName,
|
|
322
|
+
file: s.module.file,
|
|
323
|
+
line: methodLine,
|
|
324
|
+
column: methodColumn,
|
|
325
|
+
parentScopeId,
|
|
326
|
+
grafemaIgnore: grafemaIgnore ?? undefined,
|
|
327
|
+
};
|
|
328
|
+
if (this.sharedIdGenerator) {
|
|
329
|
+
const contentHints = {
|
|
330
|
+
arity: callNode.arguments.length,
|
|
331
|
+
firstLiteralArg: extractFirstLiteralArg(callNode)
|
|
332
|
+
};
|
|
333
|
+
this.sharedIdGenerator.generateV2('CALL', fullName, s.module.file, contentHints, methodCallInfo);
|
|
999
334
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
335
|
+
else {
|
|
336
|
+
const idGenerator = new IdGenerator(s.scopeTracker);
|
|
337
|
+
methodCallInfo.id = idGenerator.generate('CALL', fullName, s.module.file, methodLine, methodColumn, s.callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:${fullName}` });
|
|
338
|
+
}
|
|
339
|
+
s.methodCalls.push(methodCallInfo);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/** Handle new expressions: new Foo(), new obj.Constructor() */
|
|
344
|
+
handleNewExpression(path, s) {
|
|
345
|
+
const newNode = path.node;
|
|
346
|
+
const functionParent = path.getFunctionParent();
|
|
347
|
+
// Skip if inside function - handled by analyzeFunctionBody
|
|
348
|
+
if (functionParent)
|
|
349
|
+
return;
|
|
350
|
+
const parentScopeId = s.module.id;
|
|
351
|
+
// Dedup check
|
|
352
|
+
const nodeKey = `new:${newNode.start}:${newNode.end}`;
|
|
353
|
+
if (s.processedNodes.methodCalls.has(nodeKey))
|
|
354
|
+
return;
|
|
355
|
+
s.processedNodes.methodCalls.add(nodeKey);
|
|
356
|
+
if (newNode.callee.type === 'Identifier') {
|
|
357
|
+
const constructorName = newNode.callee.name;
|
|
358
|
+
const newLine = getLine(newNode);
|
|
359
|
+
const newColumn = getColumn(newNode);
|
|
360
|
+
const callInfo = {
|
|
361
|
+
id: '', // Placeholder — resolved by generateV2 or set below
|
|
362
|
+
type: 'CALL',
|
|
363
|
+
name: constructorName,
|
|
364
|
+
file: s.module.file,
|
|
365
|
+
line: newLine,
|
|
366
|
+
column: newColumn,
|
|
367
|
+
parentScopeId,
|
|
368
|
+
targetFunctionName: constructorName,
|
|
369
|
+
isNew: true
|
|
370
|
+
};
|
|
371
|
+
if (this.sharedIdGenerator) {
|
|
372
|
+
const contentHints = {
|
|
373
|
+
arity: newNode.arguments.length,
|
|
374
|
+
firstLiteralArg: undefined // constructor args not used for hash
|
|
375
|
+
};
|
|
376
|
+
this.sharedIdGenerator.generateV2('CALL', `new:${constructorName}`, s.module.file, contentHints, callInfo);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
const idGenerator = new IdGenerator(s.scopeTracker);
|
|
380
|
+
callInfo.id = idGenerator.generate('CALL', `new:${constructorName}`, s.module.file, newLine, newColumn, s.callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:new:${constructorName}` });
|
|
381
|
+
}
|
|
382
|
+
s.callSites.push(callInfo);
|
|
383
|
+
}
|
|
384
|
+
else if (newNode.callee.type === 'MemberExpression') {
|
|
385
|
+
const memberCallee = newNode.callee;
|
|
386
|
+
const object = memberCallee.object;
|
|
387
|
+
const property = memberCallee.property;
|
|
388
|
+
if (object.type === 'Identifier' && property.type === 'Identifier') {
|
|
389
|
+
const objectName = object.name;
|
|
390
|
+
const constructorName = property.name;
|
|
391
|
+
const fullName = `${objectName}.${constructorName}`;
|
|
392
|
+
const memberNewLine = getLine(newNode);
|
|
393
|
+
const memberNewColumn = getColumn(newNode);
|
|
394
|
+
const grafemaIgnore = getGrafemaIgnore(path);
|
|
395
|
+
const methodCallInfo = {
|
|
396
|
+
id: '', // Placeholder — resolved by generateV2 or set below
|
|
397
|
+
type: 'CALL',
|
|
398
|
+
name: fullName,
|
|
399
|
+
object: objectName,
|
|
400
|
+
method: constructorName,
|
|
401
|
+
file: s.module.file,
|
|
402
|
+
line: memberNewLine,
|
|
403
|
+
column: memberNewColumn,
|
|
404
|
+
parentScopeId,
|
|
405
|
+
isNew: true,
|
|
406
|
+
grafemaIgnore: grafemaIgnore ?? undefined,
|
|
407
|
+
};
|
|
408
|
+
if (this.sharedIdGenerator) {
|
|
409
|
+
const contentHints = {
|
|
410
|
+
arity: newNode.arguments.length,
|
|
411
|
+
firstLiteralArg: undefined // constructor args not used for hash
|
|
412
|
+
};
|
|
413
|
+
this.sharedIdGenerator.generateV2('CALL', `new:${fullName}`, s.module.file, contentHints, methodCallInfo);
|
|
1021
414
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
const object = memberCallee.object;
|
|
1026
|
-
const property = memberCallee.property;
|
|
1027
|
-
if (object.type === 'Identifier' && property.type === 'Identifier') {
|
|
1028
|
-
const objectName = object.name;
|
|
1029
|
-
const constructorName = property.name;
|
|
1030
|
-
const fullName = `${objectName}.${constructorName}`;
|
|
1031
|
-
const memberNewLine = getLine(newNode);
|
|
1032
|
-
const memberNewColumn = getColumn(newNode);
|
|
1033
|
-
// Generate ID using centralized IdGenerator
|
|
1034
|
-
const idGenerator = new IdGenerator(scopeTracker);
|
|
1035
|
-
const newMethodCallId = idGenerator.generate('CALL', `new:${fullName}`, module.file, memberNewLine, memberNewColumn, callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:new:${fullName}` });
|
|
1036
|
-
// REG-332: Check for grafema-ignore comment
|
|
1037
|
-
const grafemaIgnore = getGrafemaIgnore(path);
|
|
1038
|
-
methodCalls.push({
|
|
1039
|
-
id: newMethodCallId,
|
|
1040
|
-
type: 'CALL',
|
|
1041
|
-
name: fullName,
|
|
1042
|
-
object: objectName,
|
|
1043
|
-
method: constructorName,
|
|
1044
|
-
file: module.file,
|
|
1045
|
-
line: memberNewLine,
|
|
1046
|
-
column: memberNewColumn,
|
|
1047
|
-
parentScopeId,
|
|
1048
|
-
isNew: true, // Mark as constructor call
|
|
1049
|
-
grafemaIgnore: grafemaIgnore ?? undefined,
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
415
|
+
else {
|
|
416
|
+
const idGenerator = new IdGenerator(s.scopeTracker);
|
|
417
|
+
methodCallInfo.id = idGenerator.generate('CALL', `new:${fullName}`, s.module.file, memberNewLine, memberNewColumn, s.callSiteCounterRef, { useDiscriminator: true, discriminatorKey: `CALL:new:${fullName}` });
|
|
1052
418
|
}
|
|
419
|
+
s.methodCalls.push(methodCallInfo);
|
|
1053
420
|
}
|
|
1054
|
-
}
|
|
421
|
+
}
|
|
1055
422
|
}
|
|
1056
423
|
}
|
|
1057
424
|
//# sourceMappingURL=CallExpressionVisitor.js.map
|