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