protected override ICode VisitCall(ExprCall e) {
var isDelegate = e.CallMethod.DeclaringType.EnumThisAllBaseTypes().Any(x => x.IsDelegate());
if (isDelegate) {
var ctx = e.Ctx;
switch (e.CallMethod.Name) {
case "Invoke":
return new ExprJsDelegateInvoke(ctx, e.Obj, e.Args);
default:
throw new NotSupportedException("Cannot handle delegate call: " + e.CallMethod.Name);
}
} else {
return base.VisitCall(e);
}
}