override public void LeaveSlicingExpression(SlicingExpression node) { if (TypeSystemServices.IsDuckTyped(node.Target)) { BindDuck(node); } else { base.LeaveSlicingExpression(node); } }
override protected void ProcessInvocationOnUnknownCallableExpression(MethodInvocationExpression node) { if (TypeSystemServices.IsDuckTyped(node.Target)) { Bind(node, BuiltinFunction.Quack); BindDuck(node); } else { base.ProcessInvocationOnUnknownCallableExpression(node); } }
override protected void MemberNotFound(MemberReferenceExpression node, INamespace ns) { if (TypeSystemServices.IsDuckTyped(node.Target)) { Bind(node, BuiltinFunction.Quack); BindDuck(node); } else { base.MemberNotFound(node, ns); } }
override public void LeaveUnaryExpression(UnaryExpression node) { if (TypeSystemServices.IsDuckTyped(node.Operand) && node.Operator == UnaryOperatorType.UnaryNegation) { BindDuck(node); } else { base.LeaveUnaryExpression(node); } }
public override void OnSlice(Slice node) { base.OnSlice(node); if (TypeSystemServices.IsDuckTyped((Expression)node.ParentNode)) { return; } AssertInt(node.Begin); AssertOptionalInt(node.End); if (node.Step != null) { CompilerErrorFactory.NotImplemented(node.Step, "slicing step"); } }
override public void OnMethodInvocationExpression(MethodInvocationExpression node) { if (!TypeSystemServices.IsDuckTyped(node.Target)) { base.OnMethodInvocationExpression(node); return; } if (TypeSystemServices.IsQuackBuiltin(node.Target)) { ExpandQuackInvocation(node); return; } base.OnMethodInvocationExpression(node); if (node.GetAncestor(NodeType.Constructor) == null || (node.Target.NodeType != NodeType.SelfLiteralExpression && node.Target.NodeType != NodeType.SuperLiteralExpression) || node.Target.Entity as IConstructor == null) { ExpandCallableInvocation(node); } }
override protected void BindBinaryExpression(BinaryExpression node) { if (TypeSystemServices.IsDuckTyped(node.Left) || TypeSystemServices.IsDuckTyped(node.Right)) { if (AstUtil.IsOverloadableOperator(node.Operator)) { BindDuck(node); } else if (BinaryOperatorType.Or == node.Operator || BinaryOperatorType.And == node.Operator) { BindDuck(node); } else { base.BindBinaryExpression(node); } } else { base.BindBinaryExpression(node); } }
protected virtual bool IsDuckTyped(Expression e) { return(TypeSystemServices.IsDuckTyped(e)); }
private bool IsDuckTyped(Expression e) { return(TypeSystemServices.IsDuckTyped(e)); }