Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ScopeTree.cs
Go to the documentation of this file.
2
3internal sealed class ScopeTree
4{
5 internal int[] m_iOffsets;
6
8
9 internal int m_iCount;
10
11 internal int m_iOpenScopeCount;
12
14
15 internal ScopeTree()
16 {
18 m_iCount = 0;
19 }
20
22 {
23 if (m_iCount == 0)
24 {
25 return -1;
26 }
27 int num = m_iCount - 1;
28 int num2 = 0;
29 while (num2 > 0 || m_ScopeActions[num] == ScopeAction.Close)
30 {
31 num2 += (int)m_ScopeActions[num];
32 num--;
33 }
34 return num;
35 }
36
37 internal void AddUsingNamespaceToCurrentScope(string strNamespace)
38 {
39 int currentActiveScopeIndex = GetCurrentActiveScopeIndex();
40 ref LocalSymInfo reference = ref m_localSymInfos[currentActiveScopeIndex];
41 if (reference == null)
42 {
43 reference = new LocalSymInfo();
44 }
45 m_localSymInfos[currentActiveScopeIndex].AddUsingNamespace(strNamespace);
46 }
47
48 internal void AddScopeInfo(ScopeAction sa, int iOffset)
49 {
50 if (sa == ScopeAction.Close && m_iOpenScopeCount <= 0)
51 {
53 }
56 m_iOffsets[m_iCount] = iOffset;
58 checked
59 {
60 m_iCount++;
61 }
62 m_iOpenScopeCount += 0 - sa;
63 }
64
65 internal void EnsureCapacity()
66 {
67 if (m_iCount == 0)
68 {
69 m_iOffsets = new int[16];
72 }
73 else if (m_iCount == m_iOffsets.Length)
74 {
75 int num = checked(m_iCount * 2);
76 int[] array = new int[num];
79 ScopeAction[] array2 = new ScopeAction[num];
81 m_ScopeActions = array2;
82 LocalSymInfo[] array3 = new LocalSymInfo[num];
84 m_localSymInfos = array3;
85 }
86 }
87}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
void AddUsingNamespace(string strNamespace)
void AddUsingNamespaceToCurrentScope(string strNamespace)
Definition ScopeTree.cs:37
void AddScopeInfo(ScopeAction sa, int iOffset)
Definition ScopeTree.cs:48
static string Argument_UnmatchingSymScope
Definition SR.cs:910
Definition SR.cs:7