import * as t from '@babel/types'; import { NodePath } from '@babel/traverse'; import { FunctionalContext, PrimingDiagnostic } from './types'; import { ModuleContext, ModuleMetadata } from '@komaci/common-shared'; /** * Run a series of checks against a functional node (currently class method or some form of template string) for "purity" * * See the individual invariants for details about each check * * @param path The babel nodepath we are looking at * @param moduleContext Contextual information about the module * @param functionalContext Contextual information about this functional code block * @returns An array of the problems identified */ export declare function checkFunctionalPurity(path: NodePath, adgIndex: number, moduleMetadata: ModuleMetadata, moduleContext: ModuleContext, functionalContext: FunctionalContext): Array; /** * Given a ClassMethod representing a getter method, it will run several invariant checks against its NodePath representation, * in order to determine if it adheres all designated invariants. * @param getterMethodPath NodePath path that represents class member-level getter method * e.g. "get myId() { return '187291110cd3a'; }" * @param returnSourceLocation if true, we will return an Array for any * detected invariants (or empty array if none were found) * @param moduleContext all needful context about items in the class or encapsulating module * * @returns boolean or Array representing whether the validated getter failed one of the * invariant checks. * * boolean: * If returnSourceLocation is false AND none fails the check, true is returned because * the getter is valid. False is returned otherwise. * Array: * Or, if returnSourceLocation is true AND a non-empty Array is returned, that means at * least one invariant check failed. If no invariant checks failed, an empty Array is returned. */ export declare function validateGetter(getterMethodPath: NodePath, adgIndex: number, moduleMetadata: ModuleMetadata, moduleContext: ModuleContext, returnSourceLocation?: boolean): boolean | Array; /** * Given a set of results from invariant checks. we want to filter out any no-op values and put meaningful * results into the list of allInvalidLocations * @param allInvalidLocations PrimingDiagnostic[] containing all invariants that occurred so far * @param results the Array containing what is return by calling invariant checker method. * @returns array of PrimingDiagnostic filtered of no-op values/non-meaningful results. */ export declare function processLocationInfo(allInvalidLocations: PrimingDiagnostic[], results: Array): PrimingDiagnostic[]; /** * Validate template strings for purity. Variable declarations are not valid inside of a template expression so we do not have to support that use case here. * Template string processing is essentially a subset of what we do for getter functions. The only diff is that we don't have to do the extra "only a return statement" * check that we do for getters. * @param node Node Path to check * @param moduleContext contextual details about the module * @param returnSourceLocation if we have to return the priming diagnostics or not * @returns Priming diagnostics or just a true/false if it's valid */ export declare function validateTemplateString(node: NodePath, adgIndex: number, moduleMetadata: ModuleMetadata, moduleContext: ModuleContext, returnSourceLocation?: boolean): boolean | Array; //# sourceMappingURL=validateGetter.d.ts.map