This repository has been archived by the owner on Jul 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Property.cs
71 lines (58 loc) · 2.16 KB
/
Property.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using Docu.Documentation.Comments;
using Docu.Parsing.Model;
namespace Docu.Documentation
{
public class Property : BaseDocumentationElement, IReferencable
{
public Property(PropertyIdentifier identifier, DeclaredType type)
: base(identifier)
{
Type = type;
HasGet = identifier.HasGet;
HasSet = identifier.HasSet;
}
public DeclaredType Type { get; set; }
public bool HasGet { get; private set; }
public bool HasSet { get; private set; }
public IReferencable ReturnType { get; set; }
public string FullName
{
get { return Name; }
}
public string PrettyName
{
get { return Name; }
}
public void Resolve(IDictionary<Identifier, IReferencable> referencables)
{
if (referencables.ContainsKey(identifier))
{
IsResolved = true;
IReferencable referencable = referencables[identifier];
var property = referencable as Property;
if (property == null)
throw new InvalidOperationException("Cannot resolve to '" + referencable.GetType().FullName + "'");
ReturnType = property.ReturnType;
if (!ReturnType.IsResolved)
ReturnType.Resolve(referencables);
if (!Summary.IsResolved)
Summary.Resolve(referencables);
if (!Remarks.IsResolved)
Remarks.Resolve(referencables);
}
else
ConvertToExternalReference();
}
public static Property Unresolved(PropertyIdentifier propertyIdentifier, DeclaredType type)
{
return new Property(propertyIdentifier, type) { IsResolved = false };
}
public static Property Unresolved(PropertyIdentifier propertyIdentifier, DeclaredType type, IReferencable returnType)
{
return new Property(propertyIdentifier, type) { IsResolved = false, ReturnType = returnType };
}
}
}