The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
CGCastOperation.cs
Go to the documentation of this file.
1 using TypeSystem.Operations;
2 using TypeSystem;
3 using ErrorManagement;
4 using AST;
5 using Tools;
6 using System.Collections.Generic;
7 using CodeGeneration.ExceptionManagement;
8 namespace CodeGeneration.Operations {
12  internal class CGCastOperation <T>:TypeSystemOperation where T: ILCodeGenerator {
13 
17  private T codeGenerator;
21  private int indent;
22 
23 
24  public CGCastOperation(T codeGenerator, int indent) {
25  this.codeGenerator = codeGenerator;
26  this.indent = indent;
27  }
28 
29  public override object Exec(ClassType ct, object arg) {
30  this.codeGenerator.castclass(this.indent, ct);
31  return null;
32  }
33  public override object Exec(IntType it, object arg) {
34  this.codeGenerator.convToInt(this.indent);
35  return null;
36  }
37 
38  public override object Exec(DoubleType dt, object arg) {
39  this.codeGenerator.convToDouble(this.indent);
40  return null;
41  }
42 
43  public override object ReportError(TypeExpression tE) {
44  ErrorManager.Instance.NotifyError(new CodeGenerationError("No se ha definido la operación solicitada"));
45  return null;
46  }
47  }
48 }
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Abstract class that represents all different types.
Represent a integer type.
Definition: IntType.cs:37
Represents a error produced when a MethodType has class information and tries to assign other class i...
Represents a double type.
Definition: DoubleType.cs:36
Represents a class type.
Definition: ClassType.cs:35