InterpretedFunction class

Implemented types

Constructors

InterpretedFunction.constructor(SConstructorDeclaration declaration, Environment closure, RuntimeType? owner)
InterpretedFunction.declaration(SFunctionDeclaration declaration, Environment closure, RuntimeType? declaredReturnType, bool isNullable, {AppliedRuntimeType? declaredReturnTypeApplied, bool lenientBounds = false})
InterpretedFunction.expression(SFunctionExpression expression, Environment closure)
InterpretedFunction.method(SMethodDeclaration declaration, Environment closure, RuntimeType? owner, {bool lenientBounds = false})

Properties

arity → int
no setteroverride
callableRuntimeType → RuntimeType
DFUB5: the structural function type of this callable, used by is/as and return-type checks against T Function(...) annotations.
no setter
canCallWithoutArgs → bool
GEN-095 (D8f): true when the function can be called with no arguments, i.e. it has no required positional parameters and no required-named parameters. Used by the binary-expression visitor to decide whether to auto-invoke a function value (legitimate for zero-arg thunks, wrong for any callback that takes arguments — see semantics_gesture_delegate_test where onHorizontalDrag == null was crashing because the comparison auto-invoked the (DragUpdateDetails d) {} callback with []).
no setter
closure → Environment
no setter
declaredReturnType → RuntimeType?
The declared return type; null for none (dynamic).
no setter
declaredReturnTypeApplied → AppliedRuntimeType?
DFUB6: the declared return type with its applied type arguments preserved (e.g. Box<int> / List<String>), when the return type is a generic SNamedType. Null for raw / unresolvable / non-generic return types. SAstNode has no parent references, so the applied return type must be captured here at declaration time — the return statement cannot walk up the AST to re-read the annotation. Used by visitReturnStatement._checkAppliedGenericReturn.
no setter
entryName → String?
The function's declared name; null for a closure. Names the entry when native code calls it (GitHub #19).
no setter
hashCode → int
The hash code for this object.
no setterinherited
isAbstract → bool
final
isAsync → bool
final
isAsyncGenerator → bool
final
isFactory → bool
final
isGenerator → bool
final
isGetter → bool
final
isInitializer → bool
final
isNullable → bool
final
isSetter → bool
final
maxPositionalArity → int
The number of positional parameters this function can accept — required and optional together.
no setter
namedParameterNames → List<String>
Get all named parameter names.
no setter
ownerType → RuntimeType?
final
positionalParameterNames → List<String>
Get all positional parameter names (required and optional).
no setter
redirectedFactoryTarget → SConstructorName?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
typeParameterBounds → Map<String, RuntimeType?>
final
typeParameterNames → List<String>
final

Methods

bind(RuntimeValue instance) → Callable
Binds 'this' to a specific instance, returning a new callable where the closure has 'this' defined.
call(InterpreterVisitor visitor, List<Object?> positionalArguments, [Map<String, Object?> namedArguments = const {}, List<RuntimeType>? typeArguments]) → Object?
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveDeferredReturnType(RuntimeType? type, {AppliedRuntimeType? applied}) → void
GitHub #20 — a top-level function's return type may name a class of a library in the same import cycle that has not declared it yet; the interpreter builds the function without it and sets it here once the outermost module load returns. applied is the DFUB6 applied return type, resolved at the same time.
runAsBoundBody(InterpreterVisitor visitor, Environment environment) → Object?
ghissues77: runs this function's body, its parameters already bound into environment (an extension method's), as the async function or sync* / async* generator it is; notSuspending for a plain function, which the caller runs itself. An extension method ran an async body synchronously: the first await handed back a suspension nothing resumed, so nothing after it ran (Slang's loadLocale never stored the translations it loaded).
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

checkBindingType(Environment env, STypeAnnotation? typeNode, Object? value, {String? describedAs}) → Object?
The value to bind to a written type typeNode, after checking it and applying the one conversion Dart applies here.
checkForEachBinding(Environment env, SAstNode? loopVariable, Object? element) → Object?
The value to bind to a for-each loop variable for one iteration, checked against the variable's written type.
resolveBinding(Environment env, STypeAnnotation? typeNode, {String? describedAs}) → ResolvedBinding?
The value-independent half of a binding check, resolved once.
resolveForEachBinding(Environment env, SAstNode? loopVariable) → ResolvedBinding?
resolveBinding for a for-each loop variable: the resolved check, or null when the loop needs none.
resolveTypeParameterBounds(STypeParameterList? typeParameters, Environment env) → Map<String, RuntimeType?>
The bounds of typeParameters resolved STRICTLY in env: an undefined bound throws.

Constants

notSuspending → const Object
What runAsBoundBody answers for a function that is neither async nor a generator.