The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
DynVarOptions.cs
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
3 // Project rROTOR
4 // --------------------------------------------------------------------------
5 // File: DynVarOptions.cs
6 // Author: Francisco Ortin - francisco.ortin@gmail.com
7 // Description:
8 // Offers the global options of the dynamic behaviour configuration.
9 // Implements Singleton pattern [Singleton].
10 // --------------------------------------------------------------------------
11 // Create date: 22-06-2007
12 // Modification date: 22-06-2007
14 
15 using System;
16 using TypeSystem;
17 
18 namespace DynVarManagement {
22  public class DynVarOptions {
23  #region Fields
24  private bool everythingDynamic;
28 
32  private bool everythingStatic;
33  #endregion
34 
35  #region Properties
36  public bool EverythingDynamic {
40  get { return this.everythingDynamic; }
41  set { this.everythingDynamic = value; }
42  }
43 
47  public bool EverythingStatic {
48  get { return this.everythingStatic; }
49  set { this.everythingStatic = value; }
50  }
51  #endregion
52 
53  #region SingletonDesignPattern
54  private DynVarOptions() {
58  }
59 
63  private static DynVarOptions instance;
64 
68  public static DynVarOptions Instance {
69  get {
70  if (instance == null)
71  instance = new DynVarOptions();
72  return instance;
73  }
74  }
75  #endregion
76 
77  #region SetDynamic
78  public void AssignDynamism(TypeExpression typeExpression1, TypeExpression typeExpression2)
84  {
85  if (this.EverythingDynamic)
86  {
87  typeExpression1.IsDynamic = typeExpression2.IsDynamic = true;
88  return;
89  }
90  if (this.EverythingStatic)
91  {
92  typeExpression1.IsDynamic = typeExpression2.IsDynamic = false;
93  return;
94  }
95  typeExpression1.IsDynamic = typeExpression2.IsDynamic = typeExpression1.IsDynamic | typeExpression2.IsDynamic;
96  }
97  public void AssignDynamism(TypeExpression typeExpression, bool isDynamic)
98  {
99  if (this.EverythingDynamic)
100  {
101  typeExpression.IsDynamic = true;
102  return;
103  }
104  if (this.EverythingStatic)
105  {
106  typeExpression.IsDynamic = false;
107  return;
108  }
109  typeExpression.IsDynamic = isDynamic;
110  }
111 
112  #endregion
113  }
114 }
Abstract class that represents all different types.
void AssignDynamism(TypeExpression typeExpression1, TypeExpression typeExpression2)
To assign the IsDynamicProperty
static DynVarOptions Instance
Unique class instance (Singleton)
Offers the global options of the dynamic behaviour configuration.
void AssignDynamism(TypeExpression typeExpression, bool isDynamic)
bool EverythingDynamic
To ignore all the dyn files, setting all the references to dynamic.
bool EverythingStatic
To ignore all the dyn files, setting all the references to dynamic.