PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Dependencies/boo/src/Boo.Lang.Compiler/Ast/Impl/TypeDefinitionImpl.cs

https://github.com/w4x/boolangstudio
C# | 268 lines | 205 code | 33 blank | 30 comment | 67 complexity | b9bba916746ed6972d1f8f5b31f9a2e2 MD5 | raw file
Possible License(s): GPL-2.0
  1. #region license
  2. // Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org)
  3. // All rights reserved.
  4. //
  5. // Redistribution and use in source and binary forms, with or without modification,
  6. // are permitted provided that the following conditions are met:
  7. //
  8. // * Redistributions of source code must retain the above copyright notice,
  9. // this list of conditions and the following disclaimer.
  10. // * Redistributions in binary form must reproduce the above copyright notice,
  11. // this list of conditions and the following disclaimer in the documentation
  12. // and/or other materials provided with the distribution.
  13. // * Neither the name of Rodrigo B. de Oliveira nor the names of its
  14. // contributors may be used to endorse or promote products derived from this
  15. // software without specific prior written permission.
  16. //
  17. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  21. // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  25. // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. #endregion
  28. //
  29. // DO NOT EDIT THIS FILE!
  30. //
  31. // This file was generated automatically by astgen.boo.
  32. //
  33. namespace Boo.Lang.Compiler.Ast
  34. {
  35. using System.Collections;
  36. using System.Runtime.Serialization;
  37. [System.Serializable]
  38. public abstract partial class TypeDefinition : TypeMember
  39. {
  40. protected TypeMemberCollection _members;
  41. protected TypeReferenceCollection _baseTypes;
  42. protected GenericParameterDeclarationCollection _genericParameters;
  43. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  44. new public TypeDefinition CloneNode()
  45. {
  46. return Clone() as TypeDefinition;
  47. }
  48. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  49. override public bool Matches(Node node)
  50. {
  51. TypeDefinition other = node as TypeDefinition;
  52. if (null == other) return false;
  53. if (_modifiers != other._modifiers) return NoMatch("TypeDefinition._modifiers");
  54. if (_name != other._name) return NoMatch("TypeDefinition._name");
  55. if (!Node.AllMatch(_attributes, other._attributes)) return NoMatch("TypeDefinition._attributes");
  56. if (!Node.AllMatch(_members, other._members)) return NoMatch("TypeDefinition._members");
  57. if (!Node.AllMatch(_baseTypes, other._baseTypes)) return NoMatch("TypeDefinition._baseTypes");
  58. if (!Node.AllMatch(_genericParameters, other._genericParameters)) return NoMatch("TypeDefinition._genericParameters");
  59. return true;
  60. }
  61. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  62. override public bool Replace(Node existing, Node newNode)
  63. {
  64. if (base.Replace(existing, newNode))
  65. {
  66. return true;
  67. }
  68. if (_attributes != null)
  69. {
  70. Attribute item = existing as Attribute;
  71. if (null != item)
  72. {
  73. Attribute newItem = (Attribute)newNode;
  74. if (_attributes.Replace(item, newItem))
  75. {
  76. return true;
  77. }
  78. }
  79. }
  80. if (_members != null)
  81. {
  82. TypeMember item = existing as TypeMember;
  83. if (null != item)
  84. {
  85. TypeMember newItem = (TypeMember)newNode;
  86. if (_members.Replace(item, newItem))
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. if (_baseTypes != null)
  93. {
  94. TypeReference item = existing as TypeReference;
  95. if (null != item)
  96. {
  97. TypeReference newItem = (TypeReference)newNode;
  98. if (_baseTypes.Replace(item, newItem))
  99. {
  100. return true;
  101. }
  102. }
  103. }
  104. if (_genericParameters != null)
  105. {
  106. GenericParameterDeclaration item = existing as GenericParameterDeclaration;
  107. if (null != item)
  108. {
  109. GenericParameterDeclaration newItem = (GenericParameterDeclaration)newNode;
  110. if (_genericParameters.Replace(item, newItem))
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  119. override public object Clone()
  120. {
  121. TypeDefinition clone = (TypeDefinition)FormatterServices.GetUninitializedObject(typeof(TypeDefinition));
  122. clone._lexicalInfo = _lexicalInfo;
  123. clone._endSourceLocation = _endSourceLocation;
  124. clone._documentation = _documentation;
  125. if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
  126. clone._modifiers = _modifiers;
  127. clone._name = _name;
  128. if (null != _attributes)
  129. {
  130. clone._attributes = _attributes.Clone() as AttributeCollection;
  131. clone._attributes.InitializeParent(clone);
  132. }
  133. if (null != _members)
  134. {
  135. clone._members = _members.Clone() as TypeMemberCollection;
  136. clone._members.InitializeParent(clone);
  137. }
  138. if (null != _baseTypes)
  139. {
  140. clone._baseTypes = _baseTypes.Clone() as TypeReferenceCollection;
  141. clone._baseTypes.InitializeParent(clone);
  142. }
  143. if (null != _genericParameters)
  144. {
  145. clone._genericParameters = _genericParameters.Clone() as GenericParameterDeclarationCollection;
  146. clone._genericParameters.InitializeParent(clone);
  147. }
  148. return clone;
  149. }
  150. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  151. override internal void ClearTypeSystemBindings()
  152. {
  153. _annotations = null;
  154. if (null != _attributes)
  155. {
  156. _attributes.ClearTypeSystemBindings();
  157. }
  158. if (null != _members)
  159. {
  160. _members.ClearTypeSystemBindings();
  161. }
  162. if (null != _baseTypes)
  163. {
  164. _baseTypes.ClearTypeSystemBindings();
  165. }
  166. if (null != _genericParameters)
  167. {
  168. _genericParameters.ClearTypeSystemBindings();
  169. }
  170. }
  171. [System.Xml.Serialization.XmlElement]
  172. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  173. public TypeMemberCollection Members
  174. {
  175. get
  176. {
  177. if (_members == null) _members = new TypeMemberCollection(this);
  178. return _members;
  179. }
  180. set
  181. {
  182. if (_members != value)
  183. {
  184. _members = value;
  185. if (null != _members)
  186. {
  187. _members.InitializeParent(this);
  188. }
  189. }
  190. }
  191. }
  192. [System.Xml.Serialization.XmlElement]
  193. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  194. public TypeReferenceCollection BaseTypes
  195. {
  196. get
  197. {
  198. if (_baseTypes == null) _baseTypes = new TypeReferenceCollection(this);
  199. return _baseTypes;
  200. }
  201. set
  202. {
  203. if (_baseTypes != value)
  204. {
  205. _baseTypes = value;
  206. if (null != _baseTypes)
  207. {
  208. _baseTypes.InitializeParent(this);
  209. }
  210. }
  211. }
  212. }
  213. [System.Xml.Serialization.XmlElement]
  214. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  215. public GenericParameterDeclarationCollection GenericParameters
  216. {
  217. get
  218. {
  219. if (_genericParameters == null) _genericParameters = new GenericParameterDeclarationCollection(this);
  220. return _genericParameters;
  221. }
  222. set
  223. {
  224. if (_genericParameters != value)
  225. {
  226. _genericParameters = value;
  227. if (null != _genericParameters)
  228. {
  229. _genericParameters.InitializeParent(this);
  230. }
  231. }
  232. }
  233. }
  234. }
  235. }