visitMixinDeclaration method
Visit a SMixinDeclaration.
Implementation
@override
void visitMixinDeclaration(SMixinDeclaration node) {
final mixinName = node.name?.name ?? '';
if (environment.isDefinedLocally(mixinName)) {
return;
}
// Create a placeholder for the mixin with the required positional arguments
final placeholder = InterpretedClass(
mixinName, // name
null, // superclass (null for pure mixins)
environment, // classDefinitionEnvironment
<SFieldDeclaration>[], // fieldDeclarations (initially empty)
// Member tables use FrozenNameMap (perf T6): mutable while wiring, then
// frozen via klass.freezeMemberTables() at the end of the Pass-2 loop.
FrozenNameMap<InterpretedFunction>(), // methods
FrozenNameMap<InterpretedFunction>(), // getters
FrozenNameMap<InterpretedFunction>(), // setters
FrozenNameMap<InterpretedFunction>(), // staticMethods
FrozenNameMap<InterpretedFunction>(), // staticGetters
FrozenNameMap<InterpretedFunction>(), // staticSetters
<String, Object?>{}, // staticFields (deferred init — left mutable)
FrozenNameMap<InterpretedFunction>(), // constructors (empty for mixins)
FrozenNameMap<InterpretedFunction>(), // operators
// Named parameters
isAbstract: false, // Mixins are not abstract
isMixin: true,
interfaces: [], // Initially empty
onClauseTypes: [], // Will be filled in pass 2
mixins: [], // Initially empty (mixins cannot use 'with')
);
environment.define(mixinName, placeholder);
Logger.debug(
"[DeclarationVisitor] Defined placeholder for mixin '$mixinName' in env: [38;5;244m${environment.hashCode}[0m");
}