InterpretedFunction.method constructor

InterpretedFunction.method(
  1. SMethodDeclaration declaration,
  2. Environment closure,
  3. RuntimeType? owner, {
  4. bool lenientBounds = false,
})

Implementation

InterpretedFunction.method(
  SMethodDeclaration declaration,
  Environment closure,
  RuntimeType? owner, {
  bool lenientBounds = false,
}) : this._internal(
       declaration.parameters,
       declaration.body!,
       closure,
       declaration.name?.name ?? '',
       // Consider factory methods later
       isInitializer: false, // Methods are not initializers (usually)
       isGetter: declaration.isGetter, // Pass getter flag
       isSetter: declaration.isSetter, // Pass setter flag
       ownerType: owner, // Pass the owner type (class or enum)
       isAbstract: declaration.isAbstract, // Set the abstract flag
       isAsync: _isBodyAsync(declaration.body), // Pass async flag
       isGenerator: _isBodyGenerator(declaration.body), // Pass generator flag
       isAsyncGenerator:
           _isBodyAsync(declaration.body) &&
           _isBodyGenerator(declaration.body), // Pass async generator flag
       typeParameterNames: _extractTypeParameterNames(
         declaration.typeParameters,
       ),
       typeParameterBounds: _extractTypeParameterBounds(
         declaration.typeParameters,
         closure,
         lenient: lenientBounds,
       ),
     );