/// <summary> /// Returns a value that indicates a promotion level. /// </summary> /// <param name="firstOperand">WriteType to promotion.</param> /// <returns>Returns a promotion value.</returns> public override object Exec(BoolType firstOperand, object arg) { // * Bool type and type variable if (TypeExpression.As <BoolType>(this.secondOperand) != null) { return(0); } // * WriteType variable TypeVariable typeVariable = this.secondOperand as TypeVariable; if (typeVariable != null && typeVariable.Substitution == null) { // * A free variable is complete promotion return(0); } // * Union type UnionType unionType = TypeExpression.As <UnionType>(this.secondOperand); if (unionType != null) { return(unionType.SuperType(firstOperand)); } // * Field type and bounded type variable FieldType fieldType = TypeExpression.As <FieldType>(this.secondOperand); if (fieldType != null) { return(firstOperand.AcceptOperation(new PromotionLevelOperation(fieldType.FieldTypeExpression), arg)); } // * Use the BCL object oriented approach return(firstOperand.AsClassType().AcceptOperation(this, arg)); }
public override object Exec(BoolType d, object arg) { return(d.AsClassType().AcceptOperation(this, arg)); }