1 using TypeSystem.Operations;
4 using System.Collections.Generic;
5 namespace CodeGeneration.Operations {
13 private List<string> nextMethod;
17 private T codeGenerator;
30 this.nextMethod = nextMethod;
31 this.codeGenerator = codeGenerator;
42 this.codeGenerator.dup(this.indent);
43 this.codeGenerator.isinst(this.indent, operand);
45 this.nextMethod.Add(this.codeGenerator.NewLabel);
46 this.codeGenerator.brfalse(this.indent, nextMethod[nextMethod.Count - 1]);
57 this.codeGenerator.dup(this.indent);
58 this.codeGenerator.isinst(this.indent, operand);
60 this.nextMethod.Add(this.codeGenerator.NewLabel);
61 this.codeGenerator.brfalse(this.indent, nextMethod[nextMethod.Count - 1]);
63 this.codeGenerator.UnboxAny(
this.indent, operand);
73 return this.MultiTypeExec(operand, arg);
82 return this.MultiTypeExec(operand, arg);
93 string nextArgument = this.codeGenerator.NewLabel;
97 this.nextMethod.Add(this.codeGenerator.NewLabel);
98 this.codeGenerator.br(this.indent, this.nextMethod[this.nextMethod.Count - 1]);
99 this.codeGenerator.WriteLabel(this.indent, nextArgument);
110 string nextArgument = this.codeGenerator.NewLabel;
116 nextMethod.Add(this.codeGenerator.NewLabel);
117 this.codeGenerator.br(this.indent, this.nextMethod[this.nextMethod.Count - 1]);
118 this.codeGenerator.WriteLabel(this.indent, nextArgument);
122 ErrorManager.Instance.NotifyError(
new CodeGenerationError(
"No se ha definido la operación solicitada"));
override object Exec(DoubleType operand, object arg)
Checks if the Double Type parameter passed (operand) matches with the proper argument. It makes to 3calls to CGRuntimeCheckTypeExpressionOperation operation. One using a CharType object, second with IntType object, and last usint a double type, all of them trying a convert to double (toDouble parameter = true)
override object ReportError(TypeExpression tE)
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Represent a character type.
override object Exec(TypeExpression operand, object arg)
Checks if the parameter passed (operand) matches with the proper argument. In this method only proces...
override object Exec(IntType operand, object arg)
Checks if the IntType parameter passed (operand) matches with the proper argument. It makes to 2 calls to CGRuntimeCheckTypeExpressionOperation operation. One using a CharType object, and the other with IntType object, with no try to convert to double (toDouble parameter = false)
Abstract class that represents all different types.
override object Exec(CharType operand, object arg)
Checks if the CharType parameter passed (operand) matches with the proper argument. Finally, it perforns an unbox.any over the the operand
Represent a integer type.
Represents a error produced when a MethodType has class information and tries to assign other class i...
abstract bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
Represents a double type.
It tries to convert the top of the stack to a Type Expression indicated by operand. Firstly it duplicates the top of the stack Next check if the top of he stack is the same type of argument 'operand'. If the conversion is wrong. In a execution context we'd've finished so it's necessary to write an opcode jump, brfalse, to the end of this code (endLabel). Next it unboxes the result the top of the stack to the desired type. If a Convertion to double is requested, (member this.toDouble), it generates convToDouble If it success it jumps to the rest of code else it generates the label to jump if isinst fails.
override object Exec(BoolType operand, object arg)
Checks if the BoolType parameter passed (operand) matches with the proper argument. Finally, it perforns an unbox.any over the the operand
CGRuntimeCheckArgumentOperation(int indent, T codeGenerator, List< string > nextMethod)
Constructor of CGRuntimeCheckArgumentOperation