PageRenderTime 58ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 1ms

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

https://github.com/w4x/boolangstudio
C# | 387 lines | 317 code | 40 blank | 30 comment | 105 complexity | 09a2aa141ed593fd807c66480d7d302e 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 partial class Module : TypeDefinition
  39. {
  40. protected NamespaceDeclaration _namespace;
  41. protected ImportCollection _imports;
  42. protected Block _globals;
  43. protected AttributeCollection _assemblyAttributes;
  44. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  45. new public Module CloneNode()
  46. {
  47. return Clone() as Module;
  48. }
  49. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  50. override public NodeType NodeType
  51. {
  52. get
  53. {
  54. return NodeType.Module;
  55. }
  56. }
  57. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  58. override public void Accept(IAstVisitor visitor)
  59. {
  60. visitor.OnModule(this);
  61. }
  62. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  63. override public bool Matches(Node node)
  64. {
  65. Module other = node as Module;
  66. if (null == other) return false;
  67. if (_modifiers != other._modifiers) return NoMatch("Module._modifiers");
  68. if (_name != other._name) return NoMatch("Module._name");
  69. if (!Node.AllMatch(_attributes, other._attributes)) return NoMatch("Module._attributes");
  70. if (!Node.AllMatch(_members, other._members)) return NoMatch("Module._members");
  71. if (!Node.AllMatch(_baseTypes, other._baseTypes)) return NoMatch("Module._baseTypes");
  72. if (!Node.AllMatch(_genericParameters, other._genericParameters)) return NoMatch("Module._genericParameters");
  73. if (!Node.Matches(_namespace, other._namespace)) return NoMatch("Module._namespace");
  74. if (!Node.AllMatch(_imports, other._imports)) return NoMatch("Module._imports");
  75. if (!Node.Matches(_globals, other._globals)) return NoMatch("Module._globals");
  76. if (!Node.AllMatch(_assemblyAttributes, other._assemblyAttributes)) return NoMatch("Module._assemblyAttributes");
  77. return true;
  78. }
  79. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  80. override public bool Replace(Node existing, Node newNode)
  81. {
  82. if (base.Replace(existing, newNode))
  83. {
  84. return true;
  85. }
  86. if (_attributes != null)
  87. {
  88. Attribute item = existing as Attribute;
  89. if (null != item)
  90. {
  91. Attribute newItem = (Attribute)newNode;
  92. if (_attributes.Replace(item, newItem))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. if (_members != null)
  99. {
  100. TypeMember item = existing as TypeMember;
  101. if (null != item)
  102. {
  103. TypeMember newItem = (TypeMember)newNode;
  104. if (_members.Replace(item, newItem))
  105. {
  106. return true;
  107. }
  108. }
  109. }
  110. if (_baseTypes != null)
  111. {
  112. TypeReference item = existing as TypeReference;
  113. if (null != item)
  114. {
  115. TypeReference newItem = (TypeReference)newNode;
  116. if (_baseTypes.Replace(item, newItem))
  117. {
  118. return true;
  119. }
  120. }
  121. }
  122. if (_genericParameters != null)
  123. {
  124. GenericParameterDeclaration item = existing as GenericParameterDeclaration;
  125. if (null != item)
  126. {
  127. GenericParameterDeclaration newItem = (GenericParameterDeclaration)newNode;
  128. if (_genericParameters.Replace(item, newItem))
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. if (_namespace == existing)
  135. {
  136. this.Namespace = (NamespaceDeclaration)newNode;
  137. return true;
  138. }
  139. if (_imports != null)
  140. {
  141. Import item = existing as Import;
  142. if (null != item)
  143. {
  144. Import newItem = (Import)newNode;
  145. if (_imports.Replace(item, newItem))
  146. {
  147. return true;
  148. }
  149. }
  150. }
  151. if (_globals == existing)
  152. {
  153. this.Globals = (Block)newNode;
  154. return true;
  155. }
  156. if (_assemblyAttributes != null)
  157. {
  158. Attribute item = existing as Attribute;
  159. if (null != item)
  160. {
  161. Attribute newItem = (Attribute)newNode;
  162. if (_assemblyAttributes.Replace(item, newItem))
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  171. override public object Clone()
  172. {
  173. Module clone = (Module)FormatterServices.GetUninitializedObject(typeof(Module));
  174. clone._lexicalInfo = _lexicalInfo;
  175. clone._endSourceLocation = _endSourceLocation;
  176. clone._documentation = _documentation;
  177. if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
  178. clone._modifiers = _modifiers;
  179. clone._name = _name;
  180. if (null != _attributes)
  181. {
  182. clone._attributes = _attributes.Clone() as AttributeCollection;
  183. clone._attributes.InitializeParent(clone);
  184. }
  185. if (null != _members)
  186. {
  187. clone._members = _members.Clone() as TypeMemberCollection;
  188. clone._members.InitializeParent(clone);
  189. }
  190. if (null != _baseTypes)
  191. {
  192. clone._baseTypes = _baseTypes.Clone() as TypeReferenceCollection;
  193. clone._baseTypes.InitializeParent(clone);
  194. }
  195. if (null != _genericParameters)
  196. {
  197. clone._genericParameters = _genericParameters.Clone() as GenericParameterDeclarationCollection;
  198. clone._genericParameters.InitializeParent(clone);
  199. }
  200. if (null != _namespace)
  201. {
  202. clone._namespace = _namespace.Clone() as NamespaceDeclaration;
  203. clone._namespace.InitializeParent(clone);
  204. }
  205. if (null != _imports)
  206. {
  207. clone._imports = _imports.Clone() as ImportCollection;
  208. clone._imports.InitializeParent(clone);
  209. }
  210. if (null != _globals)
  211. {
  212. clone._globals = _globals.Clone() as Block;
  213. clone._globals.InitializeParent(clone);
  214. }
  215. if (null != _assemblyAttributes)
  216. {
  217. clone._assemblyAttributes = _assemblyAttributes.Clone() as AttributeCollection;
  218. clone._assemblyAttributes.InitializeParent(clone);
  219. }
  220. return clone;
  221. }
  222. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  223. override internal void ClearTypeSystemBindings()
  224. {
  225. _annotations = null;
  226. if (null != _attributes)
  227. {
  228. _attributes.ClearTypeSystemBindings();
  229. }
  230. if (null != _members)
  231. {
  232. _members.ClearTypeSystemBindings();
  233. }
  234. if (null != _baseTypes)
  235. {
  236. _baseTypes.ClearTypeSystemBindings();
  237. }
  238. if (null != _genericParameters)
  239. {
  240. _genericParameters.ClearTypeSystemBindings();
  241. }
  242. if (null != _namespace)
  243. {
  244. _namespace.ClearTypeSystemBindings();
  245. }
  246. if (null != _imports)
  247. {
  248. _imports.ClearTypeSystemBindings();
  249. }
  250. if (null != _globals)
  251. {
  252. _globals.ClearTypeSystemBindings();
  253. }
  254. if (null != _assemblyAttributes)
  255. {
  256. _assemblyAttributes.ClearTypeSystemBindings();
  257. }
  258. }
  259. [System.Xml.Serialization.XmlElement]
  260. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  261. public NamespaceDeclaration Namespace
  262. {
  263. get
  264. {
  265. return _namespace;
  266. }
  267. set
  268. {
  269. if (_namespace != value)
  270. {
  271. _namespace = value;
  272. if (null != _namespace)
  273. {
  274. _namespace.InitializeParent(this);
  275. }
  276. }
  277. }
  278. }
  279. [System.Xml.Serialization.XmlElement]
  280. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  281. public ImportCollection Imports
  282. {
  283. get
  284. {
  285. if (_imports == null) _imports = new ImportCollection(this);
  286. return _imports;
  287. }
  288. set
  289. {
  290. if (_imports != value)
  291. {
  292. _imports = value;
  293. if (null != _imports)
  294. {
  295. _imports.InitializeParent(this);
  296. }
  297. }
  298. }
  299. }
  300. [System.Xml.Serialization.XmlElement]
  301. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  302. public Block Globals
  303. {
  304. get
  305. {
  306. if (_globals == null)
  307. {
  308. _globals = new Block();
  309. _globals.InitializeParent(this);
  310. }
  311. return _globals;
  312. }
  313. set
  314. {
  315. if (_globals != value)
  316. {
  317. _globals = value;
  318. if (null != _globals)
  319. {
  320. _globals.InitializeParent(this);
  321. }
  322. }
  323. }
  324. }
  325. [System.Xml.Serialization.XmlElement]
  326. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  327. public AttributeCollection AssemblyAttributes
  328. {
  329. get
  330. {
  331. if (_assemblyAttributes == null) _assemblyAttributes = new AttributeCollection(this);
  332. return _assemblyAttributes;
  333. }
  334. set
  335. {
  336. if (_assemblyAttributes != value)
  337. {
  338. _assemblyAttributes = value;
  339. if (null != _assemblyAttributes)
  340. {
  341. _assemblyAttributes.InitializeParent(this);
  342. }
  343. }
  344. }
  345. }
  346. }
  347. }