Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Experiments / Attic / Rook / Castle.Rook.Compiler / AST / ASTNode.cs
blob82c1dd3b631a1ccb48beedd5b6942a18185bc78a
1 // Copyright 2004-2008 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.Rook.Compiler.Visitors;
21 public abstract class ASTNode : IASTNode
23 private IASTNode parent;
24 private LexicalPosition position;
25 private ISymbolTable symTable;
27 public ASTNode()
31 public ASTNode(ISymbolTable symTable)
33 this.symTable = symTable;
36 public IASTNode Parent
38 get { return parent; }
39 set { parent = value; }
42 public LexicalPosition Position
44 get { return position; }
45 set { position = value; }
48 public ISymbolTable DefiningSymbolTable
50 get { return symTable; }
51 set { symTable = value; }
54 public virtual void ReplaceBy(IASTNode node)
56 if (Parent != null)
58 throw new ApplicationException("Couldn't find a parent node to delegate");
61 Parent.ReplaceChild(this, node);
64 public virtual void ReplaceChild(IASTNode oldNode, IASTNode newNode)
66 throw new NotImplementedException( this.GetType().FullName + " must implement ReplaceChild" );
69 public virtual void RemoveChild(IASTNode node)
71 throw new NotImplementedException( this.GetType().FullName + " must implement RemoveChild" );
74 public virtual bool Accept(IASTVisitor visitor)
76 throw new NotImplementedException( this.GetType().FullName + " must implement Accept" );