Added ability to order the execution of dictionary adapter behaviors.
[castle.git] / Experiments / Attic / Rook / Castle.Rook.Compiler / AST / Stmt / MethodDefinitionStatement.cs
blobff455ac0d47c439250c924f38021271c5ca9d46e
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Rook.Compiler.AST
17 using System;
18 using Castle.Core.Internal;
19 using Castle.Rook.Compiler.Visitors;
22 public class MethodDefinitionStatement : Statement
24 private AccessLevel accessLevel;
25 private string name;
26 private TypeReference returnType;
27 private ASTNodeCollection statements;
28 private ASTNodeCollection arguments;
30 private bool isOverride, isNewSlot, isAbstract, isVirtual, isStatic, isFinal;
32 public MethodDefinitionStatement(AccessLevel accessLevel) : base(StatementType.MethodDef)
34 statements = new ASTNodeCollection(this);
35 arguments = new ASTNodeCollection(this);
36 this.accessLevel = accessLevel;
39 public AccessLevel AccessLevel
41 get { return accessLevel; }
42 set { accessLevel = value; }
45 public string Name
47 get { return name; }
48 set
50 if (value.StartsWith("self."))
52 name = value.Substring( "self.".Length );
53 isStatic = true;
55 else
57 name = value;
62 public TypeReference ReturnType
64 get { return returnType; }
65 set { returnType = value; }
68 public ASTNodeCollection Statements
70 get { return statements; }
73 public ASTNodeCollection Arguments
75 get { return arguments; }
78 public void AddFormalParameter(ParameterVarIdentifier param)
80 arguments.Add(param);
83 public bool IsOverride
85 get { return isOverride; }
86 set { isOverride = value; }
89 public bool IsNewSlot
91 get { return isNewSlot; }
92 set { isNewSlot = value; }
95 public bool IsAbstract
97 get { return isAbstract; }
98 set { isAbstract = value; }
101 public bool IsVirtual
103 get { return isVirtual; }
104 set { isVirtual = value; }
107 public bool IsStatic
109 get { return isStatic; }
110 set { isStatic = value; }
113 public bool IsFinal
115 get { return isFinal; }
116 set { isFinal = value; }
119 public override bool Accept(IASTVisitor visitor)
121 visitor.VisitMethodDefinitionStatement(this);
122 return true;