UNPKG

@oaklean/profiler-core

Version:

Part of the @oaklean suite. It provides all basic functions to work with the `.oak` file format. It allows parsing the `.oak` file format as well as tools for analyzing the measurement values. It also provides all necessary capabilities required for prec

48 lines (47 loc) 2.85 kB
import { BaseModel } from './BaseModel'; import { UnifiedPath } from '../system'; import { ProgramStructureTreeType, PSTIdentifierHierarchy, IdentifierType, NodeLocation, NodeLocationRange, IProgramStructureTree, SourceNodeIdentifier_string, SourceNodeIdentifierPart_string } from '../types'; type NodeLocationString = `${NodeLocation['line']}:${NodeLocation['column']}`; export declare class ProgramStructureTree<T extends ProgramStructureTreeType = ProgramStructureTreeType> extends BaseModel { id: number; type: T; identifierType: IdentifierType; identifier: SourceNodeIdentifierPart_string; beginLoc: NodeLocation; endLoc: NodeLocation; parent: T extends ProgramStructureTreeType.Root ? null : ProgramStructureTree; private _children; private _childrenByBeginLoc; private identifierBySourceLocationCache; private containsLocationCache; private sourceLocationOfIdentifierCache; constructor(parent: T extends ProgramStructureTreeType.Root ? null : ProgramStructureTree, id: number, type: T, identifierType: IdentifierType, identifier: SourceNodeIdentifierPart_string, beginLoc: NodeLocation, endLoc: NodeLocation); hasChildren(sourceNodeIdentifierPart: SourceNodeIdentifierPart_string): boolean; getChildren(sourceNodeIdentifierPart: SourceNodeIdentifierPart_string): ProgramStructureTree<ProgramStructureTreeType> | undefined; childrenValues(): IterableIterator<ProgramStructureTree<ProgramStructureTreeType>>; childrenEntries(): IterableIterator<[SourceNodeIdentifierPart_string, ProgramStructureTree<ProgramStructureTreeType>]>; get childrenSize(): number; addChildren(child: ProgramStructureTree): void; static compareNodeLocations(a: NodeLocationString, b: NodeLocationString): number; private _sortedChildrenKeys; get sortedChildrenKeys(): NodeLocationString[]; numberOfLeafs(): number; /** * Returns the identifier path of the current node. */ identifierPath(): SourceNodeIdentifier_string; identifierHierarchy(): PSTIdentifierHierarchy; toJSON(): IProgramStructureTree; storeToFile(filePath: UnifiedPath): void; static loadFromFile(filePath: UnifiedPath): ProgramStructureTree | undefined; static fromJSON(json: string | IProgramStructureTree): ProgramStructureTree; static fromJSONWithParent(json: string | IProgramStructureTree, parent: ProgramStructureTree | null): ProgramStructureTree; containsLocation(loc: NodeLocation): boolean; identifierNodeBySourceLocation(targetLoc: NodeLocation): { identifier: SourceNodeIdentifier_string; node: ProgramStructureTree; } | undefined; identifierBySourceLocation(targetLoc: NodeLocation): SourceNodeIdentifier_string; sourceLocationOfIdentifier(identifier: SourceNodeIdentifier_string): NodeLocationRange | null; } export {};