convertHostListenerToBinding function
Converts a host listener to an ir.Binding instance.
Current host listeners are represented as a map from name
to value
.
Implementation
// TODO(b/130184376): Create a better HostListener representation.
ir.Binding convertHostListenerToBinding(
String eventName, expression_ast.ASTWithSource handlerAst) =>
ir.Binding(
source: _handlerFor(
eventName,
ast.EventHandler(handlerAst),
null, // TODO(alorenzen): Add SourceSpan to HostListeners.
_IrBindingContext(null, null, null),
),
target: isNativeHtmlEvent(eventName)
? ir.NativeEvent(eventName)
: ir.CustomEvent(eventName),
);