The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
DynamicException.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: DynamicException.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // This class encapsulates the IL code to generate a dynamic exception. //
9 // -------------------------------------------------------------------------- //
10 // Create date: 31-10-2007 //
11 // Modification date: 31-10-2007 //
13 
14 using System.Text;
15 
16 namespace CodeGeneration.ExceptionManagement
17 {
22  {
23  #region Properties
24 
28  public virtual string TypeName
29  {
30  get { return "ExceptionManagement.DynamicException"; }
31  }
32 
36  public virtual DynamicExceptionManager BaseException
37  {
38  get { return null; }
39  }
40 
41 
42  #endregion
43 
44  #region WriteDynamicExceptionCode()
45 
46  public virtual string WriteDynamicExceptionCode()
47  {
48  StringBuilder aux = new StringBuilder();
49 
50  aux.AppendLine("// =============== CLASS MEMBERS DECLARATION ===================");
51  aux.AppendLine(".namespace ExceptionManagement");
52  aux.AppendLine("{");
53  aux.AppendLine(" .class private auto ansi DynamicException extends [mscorlib]System.Exception");
54  aux.AppendLine(" {");
55  aux.AppendLine(" .field family string msg");
56  aux.AppendLine(" .method public hidebysig specialname virtual instance string get_Message() cil managed");
57  aux.AppendLine(" {");
58  aux.AppendLine(" ldarg.0");
59  aux.AppendLine(" ldfld string ExceptionManagement.DynamicException::msg");
60  aux.AppendLine(" ret");
61  aux.AppendLine(" } // End of method get_Message");
62  aux.AppendLine(" .method public hidebysig specialname rtspecialname instance void .ctor() cil managed");
63  aux.AppendLine(" {");
64  aux.AppendLine(" ldarg.0");
65  aux.AppendLine(" call instance void [mscorlib]System.Exception::.ctor()");
66  aux.AppendLine(" ret");
67  aux.AppendLine(" } // End of method DynamicException");
68  aux.AppendLine(" .property instance string Message()");
69  aux.AppendLine(" {");
70  aux.AppendLine(" .get instance string ExceptionManagement.DynamicException::get_Message()");
71  aux.AppendLine(" } // End of property Message");
72  aux.AppendLine(" } // End of class DynamicException");
73  aux.AppendLine("}");
74 
75  return aux.ToString();
76  }
77 
78  #endregion
79  }
80 }
This class encapsulates the IL code to generate a dynamic exception.
System.Text.StringBuilder StringBuilder
Definition: CSharpParser.cs:4