The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
CGToStringOperation.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 {
11 
12  internal class CGToStringOperation <T>:TypeSystemOperation where T: ILCodeGenerator {
13 
17  private T codeGenerator;
21  private int indent;
22 
23  private bool boxed;
24  public CGToStringOperation(T codeGenerator, int indent, bool boxed) {
25  this.codeGenerator = codeGenerator;
26  this.indent = indent;
27  this.boxed = boxed;
28  }
29 
30  public CGToStringOperation(T codeGenerator, int indent) : this(codeGenerator, indent, false) { }
40  public override object Exec(TypeExpression t, object arg) {
41  if ( !boxed)
42  this.codeGenerator.BoxIfNeeded(this.indent, t);
43  this.codeGenerator.WriteLine(this.indent, "callvirt instance string [mscorlib]System.Object::ToString()");
44 
45  return null;
46  }
54  public override object Exec(StringType t, object arg) {
55  return null;
56  }
57 
58  public override object ReportError(TypeExpression tE) {
59  ErrorManager.Instance.NotifyError(new CodeGenerationError("No se ha Puede realizar ToString sobre" + tE.FullName));
60  return null;
61  }
62  }
63 }
Represent a string type.
Definition: StringType.cs:36
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Abstract class that represents all different types.
virtual string FullName
Gets the full name of the type Note: WriteType expression is the longest recursive representation of ...
Represents a error produced when a MethodType has class information and tries to assign other class i...