1 using TypeSystem.Operations;
6 using System.Collections.Generic;
7 using CodeGeneration.ExceptionManagement;
8 namespace CodeGeneration.Operations {
13 private T codeGenerator;
17 this.codeGenerator = codeGenerator;
25 string notACharLabel = this.codeGenerator.NewLabel;
26 string endLabel = this.codeGenerator.NewLabel;
30 this.codeGenerator.dup(this.indent);
31 this.codeGenerator.isinst(this.indent, CharType.Instance);
32 this.codeGenerator.dup(this.indent);
33 this.codeGenerator.brfalse(this.indent, notACharLabel);
34 this.codeGenerator.br(this.indent, endLabel);
35 this.codeGenerator.WriteLabel(this.indent, notACharLabel);
36 this.codeGenerator.pop(this.indent);
37 this.codeGenerator.dup(this.indent);
38 this.codeGenerator.isinst(this.indent, IntType.Instance);
39 this.codeGenerator.WriteLabel(this.indent, endLabel);
48 string notACharLabel = this.codeGenerator.NewLabel;
49 string notAInt32Label = this.codeGenerator.NewLabel;
50 string endLabel = this.codeGenerator.NewLabel;
54 this.codeGenerator.dup(this.indent);
55 this.codeGenerator.isinst(this.indent, CharType.Instance);
56 this.codeGenerator.dup(this.indent);
57 this.codeGenerator.brfalse(this.indent, notACharLabel);
58 this.codeGenerator.br(indent, endLabel);
59 this.codeGenerator.WriteLabel(this.indent, notACharLabel);
60 this.codeGenerator.pop(this.indent);
61 this.codeGenerator.dup(this.indent);
62 this.codeGenerator.isinst(this.indent, IntType.Instance);
63 this.codeGenerator.dup(this.indent);
64 this.codeGenerator.brfalse(this.indent, notAInt32Label);
65 this.codeGenerator.br(this.indent, endLabel);
66 this.codeGenerator.WriteLabel(this.indent, notAInt32Label);
67 this.codeGenerator.pop(this.indent);
68 this.codeGenerator.dup(this.indent);
69 this.codeGenerator.isinst(this.indent, DoubleType.Instance);
70 this.codeGenerator.WriteLabel(this.indent, endLabel);
82 this.codeGenerator.dup(this.indent);
83 this.codeGenerator.isinst(this.indent, operand);
103 ErrorManager.Instance.NotifyError(
new CodeGenerationError(
"No se ha definido la operación solicitada. El código generado es incorrecto"));
override bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Abstract class that represents all different types.
Represents a generic type expression
override object Exec(TypeExpression operand, object arg)
The promotion coul be to other type, not IntType nor DoubleType
Represent a integer type.
Represents a error produced when a MethodType has class information and tries to assign other class i...
override object Exec(DoubleType operand, object arg)
The promotion could be to a DoubleType
Represents a double type.
override object Exec(TypeVariable operand, object arg)
It delegates the trying to promotion to other methods.
override object Exec(IntType operand, object arg)
The promotion could be to a IntType
override object ReportError(TypeExpression tE)
CGRuntimeIsInstructionOperation(int indent, T codeGenerator)