Fixing an issue with output parameters that are of type IntPtr
[castle.git] / AspectSharp / AspectSharp.Lang / AST / TypeReference.cs
blobdd9b5f61a347fdf50d8e380fa6d45090e99ad9a1
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 AspectSharp.Lang.AST
17 using System;
19 public enum TargetTypeEnum
21 Undefined,
22 Link,
23 Type
26 /// <summary>
27 /// Summary description for TypeReference.
28 /// </summary>
29 [Serializable]
30 public class TypeReference : NodeBase
32 private String _typeName;
33 private String _linkRef;
34 private AssemblyReference _assembly;
35 private TargetTypeEnum _targetType = TargetTypeEnum.Undefined;
36 private Type _resolvedType;
38 public TypeReference()
42 public TypeReference(LexicalInfo info) : base(info)
46 public TypeReference(LexicalInfo info, String typeName) : this(info)
48 TypeName = typeName;
51 public TypeReference(LexicalInfo info, String value, TargetTypeEnum targetType) : this(info)
53 if (targetType == TargetTypeEnum.Link)
55 LinkRef = value;
57 else
59 TypeName = value;
63 public TargetTypeEnum TargetType
65 get { return _targetType; }
68 public string TypeName
70 get { return _typeName; }
71 set { _typeName = value; _targetType = TargetTypeEnum.Type; }
74 public string LinkRef
76 get { return _linkRef; }
77 set { _linkRef = value; _targetType = TargetTypeEnum.Link; }
80 public AssemblyReference AssemblyReference
82 get { return _assembly; }
83 set { _assembly = value; }
86 public Type ResolvedType
88 get { return _resolvedType; }
89 set { _resolvedType = value; }
92 public override void Accept(IVisitor visitor)
94 visitor.OnTypeReferenceDefinition(this);
97 public override String ToString()
99 return _typeName != null ? _typeName : _linkRef;