-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefinitionInfo.cs
More file actions
98 lines (87 loc) · 3.65 KB
/
Copy pathDefinitionInfo.cs
File metadata and controls
98 lines (87 loc) · 3.65 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System.Collections.Generic;
using Heddle.Data;
namespace Heddle.LanguageServices
{
/// <summary>One prop of a definition (phase 5 declaration, resolved).</summary>
public sealed class PropInfo
{
internal PropInfo(string name, string typeName, ExType type, bool isRequired, object defaultValue,
int declarationOffset, int declarationLength)
{
Name = name;
TypeName = typeName;
Type = type;
IsRequired = isRequired;
DefaultValue = defaultValue;
DeclarationOffset = declarationOffset;
DeclarationLength = declarationLength;
}
public string Name { get; }
public string TypeName { get; }
public ExType Type { get; }
public bool IsRequired { get; }
public object DefaultValue { get; }
public int DeclarationOffset { get; }
public int DeclarationLength { get; }
}
/// <summary>One named content region of a definition (phase 7), projected from the parse model.</summary>
public sealed class RegionInfo
{
internal RegionInfo(string name, bool isPublic, string typeName, ExType type,
int declarationOffset, int declarationLength)
{
Name = name;
IsPublic = isPublic;
TypeName = typeName;
Type = type;
DeclarationOffset = declarationOffset;
DeclarationLength = declarationLength;
}
public string Name { get; }
/// <summary><c><:name></c> ⇒ true (overridable from a call site); a private inner
/// <c><name></c> ⇒ false.</summary>
public bool IsPublic { get; }
public string TypeName { get; }
/// <summary>The resolved region model type, or null when unresolved/abstract.</summary>
public ExType Type { get; }
public int DeclarationOffset { get; }
public int DeclarationLength { get; }
}
/// <summary>
/// One definition visible in a document. <see cref="ModelType"/> is null when unresolved or abstract;
/// <see cref="IsPinned"/> = <c>:: Type</c> resolving to non-object (D13); <see cref="Props"/> are
/// inheritance-flattened (phase 5 D6 rules).
/// </summary>
public sealed class DefinitionInfo
{
internal DefinitionInfo(string name, string sourcePath, int offset, int length, string modelTypeName,
ExType modelType, bool isPinned, IReadOnlyList<PropInfo> props, string slotTypeName, string baseName,
IReadOnlyList<RegionInfo> regions = null)
{
Regions = regions ?? System.Array.Empty<RegionInfo>();
Name = name;
SourcePath = sourcePath;
Offset = offset;
Length = length;
ModelTypeName = modelTypeName;
ModelType = modelType;
IsPinned = isPinned;
Props = props;
SlotTypeName = slotTypeName;
BaseName = baseName;
}
public string Name { get; }
public string SourcePath { get; }
public int Offset { get; }
public int Length { get; }
public string ModelTypeName { get; }
public ExType ModelType { get; }
public bool IsPinned { get; }
public IReadOnlyList<PropInfo> Props { get; }
public string SlotTypeName { get; }
public string BaseName { get; }
/// <summary>Phase 7: the definition's directly-declared named content regions (declaration order) —
/// public <c><:name></c> regions a call site may override, plus its private inner regions.</summary>
public IReadOnlyList<RegionInfo> Regions { get; }
}
}