InterpretedFunction.constructor constructor

InterpretedFunction.constructor(
  1. SConstructorDeclaration declaration,
  2. Environment closure,
  3. RuntimeType? owner
)

Implementation

InterpretedFunction.constructor(
  SConstructorDeclaration declaration,
  Environment closure,
  RuntimeType? owner,
) : this._internal(
      declaration.parameters,
      declaration.body ?? SEmptyFunctionBody(offset: 0, length: 0),
      closure,
      declaration.name?.name ?? '', // Use '' for unnamed constructor
      isInitializer:
          !declaration.isFactory, // Factory constructors are not initializers
      constructorInitializers:
          declaration.initializers, // Pass to renamed param
      ownerType: owner, // Pass the owner type (class or enum)
      isAbstract: false, // Constructors cannot be abstract
      isAsync: false, // Constructors cannot be async
      isFactory: declaration.isFactory, // Detect factory constructors
      // OPEN B.1 — capture the redirect target for `factory X() = Y`.
      redirectedFactoryTarget: declaration.redirectedConstructor,
      // Constructors don't have their own type parameters - they inherit from their class
      typeParameterNames: const [],
      typeParameterBounds: const {},
    );