UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

26 lines (25 loc) 1.87 kB
import type { REnvironmentInformation } from './environment'; import { Ternary } from '../../util/logic'; import { Identifier, type IdentifierDefinition, ReferenceType } from './identifier'; /** * Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules. * If the type you want to reference is unknown, please use {@link resolveByNameAnyType} instead. * @param id - The identifier to resolve (optionally namespaced) * @param environment - The current environment used for name resolution * @param target - The target (meta) type of the identifier to resolve * @returns A list of possible identifier definitions (one if the definition location is exactly and always known), or `undefined` * if the identifier is undefined in the current scope/with the current environment information. */ export declare function resolveByName(id: Identifier, environment: REnvironmentInformation, target: ReferenceType): readonly IdentifierDefinition[] | undefined; /** * The more performant version of {@link resolveByName} when the target type is unknown. */ export declare function resolveByNameAnyType(id: Identifier, environment: REnvironmentInformation): IdentifierDefinition[] | undefined; /** * Checks whether the given identifier name resolves to a built-in constant with the given value. * @param name - The name of the identifier to resolve * @param environment - The current environment used for name resolution * @param wantedValue - The built-in constant value to check for * @returns Whether the identifier always, never, or maybe resolves to the given built-in constant value */ export declare function resolvesToBuiltInConstant(name: Identifier | undefined, environment: REnvironmentInformation, wantedValue: unknown): Ternary;