refactor(ivy): re-use the ForeignFunctionResolver
interface when appropriate (#27697)
This makes the types (and intentions) more explicit and clear. PR Close #27697
This commit is contained in:

committed by
Alex Rickabaugh

parent
19a2b783cf
commit
2fc5f002e0
@ -15,8 +15,8 @@ import {StaticInterpreter} from './interpreter';
|
||||
import {ResolvedValue} from './result';
|
||||
|
||||
export type ForeignFunctionResolver =
|
||||
(node: Reference<ts.FunctionDeclaration|ts.MethodDeclaration>, args: ts.Expression[]) =>
|
||||
ts.Expression | null;
|
||||
(node: Reference<ts.FunctionDeclaration|ts.MethodDeclaration|ts.FunctionExpression>,
|
||||
args: ReadonlyArray<ts.Expression>) => ts.Expression | null;
|
||||
|
||||
export class PartialEvaluator {
|
||||
constructor(
|
||||
|
@ -13,6 +13,7 @@ import {Declaration, ReflectionHost} from '../../reflection';
|
||||
|
||||
import {ArraySliceBuiltinFn} from './builtin';
|
||||
import {DynamicValue} from './dynamic';
|
||||
import {ForeignFunctionResolver} from './interface';
|
||||
import {BuiltinFn, EnumValue, ResolvedValue, ResolvedValueArray, ResolvedValueMap} from './result';
|
||||
|
||||
|
||||
@ -73,9 +74,7 @@ interface Context {
|
||||
*/
|
||||
resolutionContext: string;
|
||||
scope: Scope;
|
||||
foreignFunctionResolver?
|
||||
(ref: Reference<ts.FunctionDeclaration|ts.MethodDeclaration|ts.FunctionExpression>,
|
||||
args: ReadonlyArray<ts.Expression>): ts.Expression|null;
|
||||
foreignFunctionResolver?: ForeignFunctionResolver;
|
||||
}
|
||||
|
||||
export class StaticInterpreter {
|
||||
@ -542,4 +541,4 @@ function joinModuleContext(existing: Context, node: ts.Node, decl: Declaration):
|
||||
} else {
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user