javascript

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package javascript implements the JavaScript language analyzer for semantic input tracing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSAnalyzer

type JSAnalyzer struct {
	*analyzer.BaseAnalyzer
	// contains filtered or unexported fields
}

JSAnalyzer implements the LanguageAnalyzer interface for JavaScript

func NewJSAnalyzer

func NewJSAnalyzer() *JSAnalyzer

NewJSAnalyzer creates a new JavaScript analyzer

func (*JSAnalyzer) AnalyzeMethodBody

func (a *JSAnalyzer) AnalyzeMethodBody(method *types.MethodDef, source []byte, state *types.AnalysisState) (*analyzer.MethodFlowAnalysis, error)

AnalyzeMethodBody analyzes a method body for data flow

func (*JSAnalyzer) BuildSymbolTable

func (a *JSAnalyzer) BuildSymbolTable(filePath string, source []byte, root *sitter.Node) (*types.SymbolTable, error)

BuildSymbolTable builds the symbol table for a JavaScript file

func (*JSAnalyzer) DetectFrameworks

func (a *JSAnalyzer) DetectFrameworks(symbolTable *types.SymbolTable, source []byte) ([]string, error)

DetectFrameworks detects which JavaScript frameworks are being used

func (*JSAnalyzer) ExtractAssignments

func (a *JSAnalyzer) ExtractAssignments(root *sitter.Node, source []byte, scope string) ([]*types.Assignment, error)

ExtractAssignments extracts all assignments from the AST

func (*JSAnalyzer) ExtractCalls

func (a *JSAnalyzer) ExtractCalls(root *sitter.Node, source []byte, scope string) ([]*types.CallSite, error)

ExtractCalls extracts all function/method calls from the AST

func (*JSAnalyzer) ExtractClasses

func (a *JSAnalyzer) ExtractClasses(root *sitter.Node, source []byte) ([]*types.ClassDef, error)

ExtractClasses extracts class definitions from JavaScript AST

func (*JSAnalyzer) ExtractFunctions

func (a *JSAnalyzer) ExtractFunctions(root *sitter.Node, source []byte) ([]*types.FunctionDef, error)

ExtractFunctions extracts standalone function definitions

func (*JSAnalyzer) FindInputSources

func (a *JSAnalyzer) FindInputSources(root *sitter.Node, source []byte) ([]*types.FlowNode, error)

FindInputSources finds all user input sources in the AST

func (*JSAnalyzer) ResolveImports

func (a *JSAnalyzer) ResolveImports(symbolTable *types.SymbolTable, basePath string) ([]string, error)

ResolveImports resolves import paths to actual file paths

func (*JSAnalyzer) TraceExpression

func (a *JSAnalyzer) TraceExpression(target types.FlowTarget, state *types.AnalysisState) (*types.FlowMap, error)

TraceExpression traces a specific expression back to its sources

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL