PageRenderTime 28ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/w4x/boolangstudio
C# | 325 lines | 254 code | 41 blank | 30 comment | 78 complexity | 9347ce00a5348600979a127b27093e85 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 CallableDefinition : TypeMember, INodeWithParameters
  39. {
  40. protected ParameterDeclarationCollection _parameters;
  41. protected GenericParameterDeclarationCollection _genericParameters;
  42. protected TypeReference _returnType;
  43. protected AttributeCollection _returnTypeAttributes;
  44. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  45. new public CallableDefinition CloneNode()
  46. {
  47. return Clone() as CallableDefinition;
  48. }
  49. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  50. override public NodeType NodeType
  51. {
  52. get
  53. {
  54. return NodeType.CallableDefinition;
  55. }
  56. }
  57. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  58. override public void Accept(IAstVisitor visitor)
  59. {
  60. visitor.OnCallableDefinition(this);
  61. }
  62. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  63. override public bool Matches(Node node)
  64. {
  65. CallableDefinition other = node as CallableDefinition;
  66. if (null == other) return false;
  67. if (_modifiers != other._modifiers) return NoMatch("CallableDefinition._modifiers");
  68. if (_name != other._name) return NoMatch("CallableDefinition._name");
  69. if (!Node.AllMatch(_attributes, other._attributes)) return NoMatch("CallableDefinition._attributes");
  70. if (!Node.AllMatch(_parameters, other._parameters)) return NoMatch("CallableDefinition._parameters");
  71. if (!Node.AllMatch(_genericParameters, other._genericParameters)) return NoMatch("CallableDefinition._genericParameters");
  72. if (!Node.Matches(_returnType, other._returnType)) return NoMatch("CallableDefinition._returnType");
  73. if (!Node.AllMatch(_returnTypeAttributes, other._returnTypeAttributes)) return NoMatch("CallableDefinition._returnTypeAttributes");
  74. return true;
  75. }
  76. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  77. override public bool Replace(Node existing, Node newNode)
  78. {
  79. if (base.Replace(existing, newNode))
  80. {
  81. return true;
  82. }
  83. if (_attributes != null)
  84. {
  85. Attribute item = existing as Attribute;
  86. if (null != item)
  87. {
  88. Attribute newItem = (Attribute)newNode;
  89. if (_attributes.Replace(item, newItem))
  90. {
  91. return true;
  92. }
  93. }
  94. }
  95. if (_parameters != null)
  96. {
  97. ParameterDeclaration item = existing as ParameterDeclaration;
  98. if (null != item)
  99. {
  100. ParameterDeclaration newItem = (ParameterDeclaration)newNode;
  101. if (_parameters.Replace(item, newItem))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. if (_genericParameters != null)
  108. {
  109. GenericParameterDeclaration item = existing as GenericParameterDeclaration;
  110. if (null != item)
  111. {
  112. GenericParameterDeclaration newItem = (GenericParameterDeclaration)newNode;
  113. if (_genericParameters.Replace(item, newItem))
  114. {
  115. return true;
  116. }
  117. }
  118. }
  119. if (_returnType == existing)
  120. {
  121. this.ReturnType = (TypeReference)newNode;
  122. return true;
  123. }
  124. if (_returnTypeAttributes != null)
  125. {
  126. Attribute item = existing as Attribute;
  127. if (null != item)
  128. {
  129. Attribute newItem = (Attribute)newNode;
  130. if (_returnTypeAttributes.Replace(item, newItem))
  131. {
  132. return true;
  133. }
  134. }
  135. }
  136. return false;
  137. }
  138. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  139. override public object Clone()
  140. {
  141. CallableDefinition clone = (CallableDefinition)FormatterServices.GetUninitializedObject(typeof(CallableDefinition));
  142. clone._lexicalInfo = _lexicalInfo;
  143. clone._endSourceLocation = _endSourceLocation;
  144. clone._documentation = _documentation;
  145. if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
  146. clone._modifiers = _modifiers;
  147. clone._name = _name;
  148. if (null != _attributes)
  149. {
  150. clone._attributes = _attributes.Clone() as AttributeCollection;
  151. clone._attributes.InitializeParent(clone);
  152. }
  153. if (null != _parameters)
  154. {
  155. clone._parameters = _parameters.Clone() as ParameterDeclarationCollection;
  156. clone._parameters.InitializeParent(clone);
  157. }
  158. if (null != _genericParameters)
  159. {
  160. clone._genericParameters = _genericParameters.Clone() as GenericParameterDeclarationCollection;
  161. clone._genericParameters.InitializeParent(clone);
  162. }
  163. if (null != _returnType)
  164. {
  165. clone._returnType = _returnType.Clone() as TypeReference;
  166. clone._returnType.InitializeParent(clone);
  167. }
  168. if (null != _returnTypeAttributes)
  169. {
  170. clone._returnTypeAttributes = _returnTypeAttributes.Clone() as AttributeCollection;
  171. clone._returnTypeAttributes.InitializeParent(clone);
  172. }
  173. return clone;
  174. }
  175. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  176. override internal void ClearTypeSystemBindings()
  177. {
  178. _annotations = null;
  179. if (null != _attributes)
  180. {
  181. _attributes.ClearTypeSystemBindings();
  182. }
  183. if (null != _parameters)
  184. {
  185. _parameters.ClearTypeSystemBindings();
  186. }
  187. if (null != _genericParameters)
  188. {
  189. _genericParameters.ClearTypeSystemBindings();
  190. }
  191. if (null != _returnType)
  192. {
  193. _returnType.ClearTypeSystemBindings();
  194. }
  195. if (null != _returnTypeAttributes)
  196. {
  197. _returnTypeAttributes.ClearTypeSystemBindings();
  198. }
  199. }
  200. [System.Xml.Serialization.XmlElement]
  201. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  202. public ParameterDeclarationCollection Parameters
  203. {
  204. get
  205. {
  206. if (_parameters == null) _parameters = new ParameterDeclarationCollection(this);
  207. return _parameters;
  208. }
  209. set
  210. {
  211. if (_parameters != value)
  212. {
  213. _parameters = value;
  214. if (null != _parameters)
  215. {
  216. _parameters.InitializeParent(this);
  217. }
  218. }
  219. }
  220. }
  221. [System.Xml.Serialization.XmlElement]
  222. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  223. public GenericParameterDeclarationCollection GenericParameters
  224. {
  225. get
  226. {
  227. if (_genericParameters == null) _genericParameters = new GenericParameterDeclarationCollection(this);
  228. return _genericParameters;
  229. }
  230. set
  231. {
  232. if (_genericParameters != value)
  233. {
  234. _genericParameters = value;
  235. if (null != _genericParameters)
  236. {
  237. _genericParameters.InitializeParent(this);
  238. }
  239. }
  240. }
  241. }
  242. [System.Xml.Serialization.XmlElement]
  243. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  244. public TypeReference ReturnType
  245. {
  246. get
  247. {
  248. return _returnType;
  249. }
  250. set
  251. {
  252. if (_returnType != value)
  253. {
  254. _returnType = value;
  255. if (null != _returnType)
  256. {
  257. _returnType.InitializeParent(this);
  258. }
  259. }
  260. }
  261. }
  262. [System.Xml.Serialization.XmlElement]
  263. [System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
  264. public AttributeCollection ReturnTypeAttributes
  265. {
  266. get
  267. {
  268. if (_returnTypeAttributes == null) _returnTypeAttributes = new AttributeCollection(this);
  269. return _returnTypeAttributes;
  270. }
  271. set
  272. {
  273. if (_returnTypeAttributes != value)
  274. {
  275. _returnTypeAttributes = value;
  276. if (null != _returnTypeAttributes)
  277. {
  278. _returnTypeAttributes.InitializeParent(this);
  279. }
  280. }
  281. }
  282. }
  283. }
  284. }