// Expressions // Set Type property for the expression and return this type public TypeDenoter VisitEmptyExpression(EmptyExpression ast, Void arg) { ast.Type = null; return(ast.Type); }
public virtual void VisitEmptyExpression(EmptyExpression emptyExpression) { if (this.ThrowException) { throw (Exception)this.CreateException(emptyExpression); } }
public void VisitEmptyExpression(EmptyExpression emptyExpression) { StartNode(emptyExpression); EndNode(emptyExpression); }
static void FindApplicableUserDefinedConversionOperators (ResolveContext rc, IList<MemberSpec> operators, Expression source, TypeSpec target, UserConversionRestriction restr, ref List<MethodSpec> candidates) { if (source.Type.IsInterface) { // Neither A nor B are interface-types return; } // For a conversion operator to be applicable, it must be possible // to perform a standard conversion from the source type to // the operand type of the operator, and it must be possible // to perform a standard conversion from the result type of // the operator to the target type. Expression texpr = null; foreach (MethodSpec op in operators) { // Can be null because MemberCache.GetUserOperator does not resize the array if (op == null) continue; var t = op.Parameters.Types[0]; if (source.Type != t && !ImplicitStandardConversionExists (rc, source, t)) { if ((restr & UserConversionRestriction.ImplicitOnly) != 0) continue; if (!ImplicitStandardConversionExists (new EmptyExpression (t), source.Type)) continue; } if ((restr & UserConversionRestriction.NullableSourceOnly) != 0 && !t.IsNullableType) continue; t = op.ReturnType; if (t.IsInterface) continue; if (target != t) { if (t.IsNullableType) t = Nullable.NullableInfo.GetUnderlyingType (t); if (!ImplicitStandardConversionExists (new EmptyExpression (t), target)) { if ((restr & UserConversionRestriction.ImplicitOnly) != 0) continue; if (texpr == null) texpr = new EmptyExpression (target); if (!ImplicitStandardConversionExists (texpr, t)) continue; } } if (candidates == null) candidates = new List<MethodSpec> (); candidates.Add (op); } }
// // Finds the most encompassing type (type into which all other // types can convert to) amongst the types in the given set // static TypeSpec FindMostEncompassingType (IList<TypeSpec> types) { if (types.Count == 0) return null; if (types.Count == 1) return types [0]; TypeSpec best = null; for (int i = 0; i < types.Count; ++i) { int ii = 0; for (; ii < types.Count; ++ii) { if (ii == i) continue; var expr = new EmptyExpression (types[ii]); if (!ImplicitStandardConversionExists (expr, types [i])) { ii = 0; break; } } if (ii == 0) continue; if (best == null) { best = types[i]; continue; } // Indicates multiple best types return InternalType.FakeInternalType; } return best; }
private static EmptyExpression Clone(EmptyExpression expression) { return(expression); }
public abstract StringBuilder VisitEmptyExpression(EmptyExpression emptyExpression, int data);
void IExpressionVisitor.Visit(EmptyExpression expr) { }
public void VisitEmptyExpression(EmptyExpression node) { }
public virtual S VisitEmptyExpression(EmptyExpression emptyExpression, T data) { return(VisitChildren(emptyExpression, data)); }
public int VisitEmptyExpression(EmptyExpression ast, Frame frame) { return(0); }
public int Visit(EmptyExpression expression) { _writer.Write("/* empty */"); return(0); }
public override AstNode VisitEmptyExpression(EmptyExpression emptyExpression, ICecilArgumentsResolver argumentsResolver) { return(emptyExpression); }
public override void VisitEmptyExpression(EmptyExpression emptyExpression) { HandleExpressionNode(emptyExpression); }
/// <summary> /// Visits an empty expression. /// </summary> public virtual void Visit(EmptyExpression expression) { }
public virtual T Visit(EmptyExpression node) { return(Visit((Expression)node)); }
void ITreeWalker.Visit(EmptyExpression expression) { expression.Validate(this); _operations.Add(ConstOperation.Null); }
public UnifiedElement VisitEmptyExpression( EmptyExpression empty, object data) { return(null); }
public override StringBuilder VisitEmptyExpression(EmptyExpression emptyExpression, int data) { throw new NotImplementedException(); }
public override bool Visit(EmptyExpression node) { Visit((Expression)node); return(true); }
public virtual object Visit (EmptyExpression emptyExpression) { return null; }
public abstract T ConvertEmpty(EmptyExpression exp);
/// <summary> /// Finds "most encompassed type" according to the spec (13.4.2) /// amongst the methods in the MethodGroupExpr /// </summary> public static TypeSpec FindMostEncompassedType (IList<TypeSpec> types) { TypeSpec best = null; EmptyExpression expr; foreach (TypeSpec t in types) { if (best == null) { best = t; continue; } expr = new EmptyExpression (t); if (ImplicitStandardConversionExists (expr, best)) best = t; } expr = new EmptyExpression (best); foreach (TypeSpec t in types) { if (best == t) continue; if (!ImplicitStandardConversionExists (expr, t)) { best = null; break; } } return best; }
public virtual object Visit(EmptyExpression emptyExpression) { return(null); }
/// <summary> /// Finds the most specific target Tx according to section 13.4.4 /// </summary> static public TypeSpec FindMostSpecificTarget (IList<MethodSpec> list, TypeSpec target, bool apply_explicit_conv_rules) { List<TypeSpec> tgt_types_set = null; // // If any operator converts to T then Tx = T // foreach (var mi in list){ TypeSpec ret_type = mi.ReturnType; if (ret_type == target) return ret_type; if (tgt_types_set == null) { tgt_types_set = new List<TypeSpec> (list.Count); } else if (tgt_types_set.Contains (ret_type)) { continue; } tgt_types_set.Add (ret_type); } // // Explicit conv rules // if (apply_explicit_conv_rules) { var candidate_set = new List<TypeSpec> (); foreach (TypeSpec ret_type in tgt_types_set) { var expr = new EmptyExpression (ret_type); if (ImplicitStandardConversionExists (expr, target)) candidate_set.Add (ret_type); } if (candidate_set.Count != 0) return FindMostEncompassingType (candidate_set); } // // Okay, final case ! // if (apply_explicit_conv_rules) return FindMostEncompassedType (tgt_types_set); else return FindMostEncompassingType (tgt_types_set); }
void ITreeWalker.Visit(EmptyExpression expression) { expression.Validate(this); }
public virtual void VisitEmptyExpression (EmptyExpression emptyExpression) { VisitChildren (emptyExpression); }
public override void VisitEmptyExpression(EmptyExpression emptyExpression) { }
protected override Expression DoResolve (ResolveContext ec) { if ((Oper & Operator.LogicalMask) != 0) { Error_OperatorCannotBeApplied (ec, left, right); return null; } bool use_default_call = (Oper & (Operator.BitwiseMask | Operator.EqualityMask)) != 0; left_orig = left; if (left.Type.IsNullableType) { left = left_unwrap = Unwrap.Create (left, use_default_call); if (left == null) return null; } right_orig = right; if (right.Type.IsNullableType) { right = right_unwrap = Unwrap.Create (right, use_default_call); if (right == null) return null; } // // Some details are in 6.4.2, 7.2.7 // Arguments can be lifted for equal operators when the return type is bool and both // arguments are of same type // if (left_orig is NullLiteral) { left = right; state |= State.LeftNullLifted; type = ec.BuiltinTypes.Bool; } if (right_orig.IsNull) { if ((Oper & Operator.ShiftMask) != 0) right = new EmptyExpression (ec.BuiltinTypes.Int); else right = left; state |= State.RightNullLifted; type = ec.BuiltinTypes.Bool; } eclass = ExprClass.Value; return DoResolveCore (ec, left_orig, right_orig); }