1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
18 using Castle
.Core
.Internal
;
19 using Castle
.Rook
.Compiler
.Visitors
;
22 public class MethodDefinitionStatement
: Statement
24 private AccessLevel accessLevel
;
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; }
50 if (value.StartsWith("self."))
52 name
= value.Substring( "self.".Length
);
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
)
83 public bool IsOverride
85 get { return isOverride; }
86 set { isOverride = value; }
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; }
109 get { return isStatic; }
110 set { isStatic = value; }
115 get { return isFinal; }
116 set { isFinal = value; }
119 public override bool Accept(IASTVisitor visitor
)
121 visitor
.VisitMethodDefinitionStatement(this);