Inference/src/CodeGeneration/Operations/CGRuntimeFreshTEPromotionOperation.cs
/// <summary>
/// Tries a promotion to a integer. As a char can be promotioned to int, it generates the proper code.
/// </summary>
/// <param name="operand"></param>
/// <returns></returns>
Tries a promotion to a integer. As a char can be promotioned to int, it generates the proper code.
Tries a promotion to a integer . As a char can be promotioned to int it generates the proper code .
public override object Exec(IntType operand, object arg) {
            this.codeGenerator.dup(this.indent);
            this.codeGenerator.isinst(this.indent, CharType.Instance);
            string notACharLabel = this.codeGenerator.NewLabel;
            this.codeGenerator.brfalse(this.indent, notACharLabel);
            this.codeGenerator.UnboxAny(this.indent, CharType.Instance);
            string endLabel = this.codeGenerator.NewLabel;
            this.codeGenerator.br(this.indent, endLabel);
            this.codeGenerator.WriteLabel(this.indent, notACharLabel);
            this.codeGenerator.UnboxAny(this.indent, IntType.Instance);
            this.codeGenerator.WriteLabel(this.indent, endLabel);
            return null;
        }
public override object Exec ( IntType operand , object arg ) { this . codeGenerator . dup ( this . indent ) ; this . codeGenerator . isinst ( this . indent , CharType . Instance ) ; string notACharLabel = this . codeGenerator . NewLabel ; this . codeGenerator . brfalse ( this . indent , notACharLabel ) ; this . codeGenerator . UnboxAny ( this . indent , CharType . Instance ) ; string endLabel = this . codeGenerator . NewLabel ; this . codeGenerator . br ( this . indent , endLabel ) ; this . codeGenerator . WriteLabel ( this . indent , notACharLabel ) ; this . codeGenerator . UnboxAny ( this . indent , IntType . Instance ) ; this . codeGenerator . WriteLabel ( this . indent , endLabel ) ; return null ; }
Tries a promotion to a integer.
Tries a promotion to a integer .
// * char to int // * If we must promote to an integer, a Char could be on the stack
None
operand
IntType
None
arg
object