forked from DerivcoIpswich/dsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptReference.cs
More file actions
58 lines (45 loc) · 1.38 KB
/
Copy pathScriptReference.cs
File metadata and controls
58 lines (45 loc) · 1.38 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
// ScriptReference.cs
// Script#/Core/Compiler
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System.Diagnostics;
namespace DSharp.Compiler
{
public sealed class ScriptReference
{
private string identifier;
private string path;
private int typeReferenceCount;
private int constReferenceCount;
public ScriptReference(string name, string identifier)
{
Debug.Assert(string.IsNullOrEmpty(name) == false);
Debug.Assert(identifier == null || identifier.Length != 0);
Name = name;
this.identifier = identifier;
}
public bool DelayLoaded { get; set; }
public bool HasIdentifier => identifier != null;
public string Identifier
{
get => identifier ?? Name;
set => identifier = value;
}
public string Name { get; }
public string Path
{
get => path ?? Name;
set => path = value;
}
public int TypeReferenceCount => typeReferenceCount;
public int ConstReferenceCount => constReferenceCount;
public void IncrementTypeReferenceCount()
{
++typeReferenceCount;
}
public void IncrementConstReferenceCount()
{
++constReferenceCount;
}
}
}