/
CompilerErrorCollection.cs
103 lines (86 loc) · 2.63 KB
/
CompilerErrorCollection.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
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
99
100
101
102
103
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
namespace System.CodeDom.Compiler
{
public class CompilerErrorCollection : CollectionBase
{
public CompilerErrorCollection() { }
public CompilerErrorCollection(CompilerErrorCollection value)
{
AddRange(value);
}
public CompilerErrorCollection(CompilerError[] value)
{
AddRange(value);
}
public CompilerError this[int index]
{
get => (CompilerError)List[index];
set => List[index] = value;
}
public int Add(CompilerError value) => List.Add(value);
public void AddRange(CompilerError[] value)
{
if (value is null)
{
throw new ArgumentNullException(nameof(value));
}
for (int i = 0; i < value.Length; i++)
{
Add(value[i]);
}
}
public void AddRange(CompilerErrorCollection value)
{
if (value is null)
{
throw new ArgumentNullException(nameof(value));
}
int currentCount = value.Count;
for (int i = 0; i < currentCount; i++)
{
Add(value[i]);
}
}
public bool Contains(CompilerError value) => List.Contains(value);
public void CopyTo(CompilerError[] array, int index) => List.CopyTo(array, index);
public bool HasErrors
{
get
{
if (Count > 0)
{
foreach (CompilerError e in this)
{
if (!e.IsWarning)
{
return true;
}
}
}
return false;
}
}
public bool HasWarnings
{
get
{
if (Count > 0)
{
foreach (CompilerError e in this)
{
if (e.IsWarning)
{
return true;
}
}
}
return false;
}
}
public int IndexOf(CompilerError value) => List.IndexOf(value);
public void Insert(int index, CompilerError value) => List.Insert(index, value);
public void Remove(CompilerError value) => List.Remove(value);
}
}