blob: 06fc462b592374c7eacc6630f8673a4a87455dc9 (
plain)
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
|
// created on 06.08.2003 at 12:37
using System.Diagnostics;
using MonoDevelop.Projects.Parser;
using ICSharpCode.NRefactory.Parser;
using Modifier = ICSharpCode.NRefactory.Ast.Modifiers;
using ClassType = MonoDevelop.Projects.Parser.ClassType;
namespace VBBinding.Parser.SharpDevelopTree
{
public class Class : DefaultClass
{
public Class(CompilationUnit cu, MonoDevelop.Projects.Parser.ClassType t, Modifier m, IRegion region): base (cu)
{
classType = t;
this.region = region;
modifiers = (ModifierEnum)m;
}
public void UpdateModifier()
{
if (classType == ClassType.Enum) {
foreach (DefaultField f in Fields) {
f.AddModifier(ModifierEnum.Public);
}
return;
}
if (classType != ClassType.Interface) {
return;
}
foreach (Class c in InnerClasses) {
c.modifiers = c.modifiers | ModifierEnum.Public;
}
foreach (IMethod m in Methods) {
if (m is Constructor) {
((Constructor)m).AddModifier(ModifierEnum.Public);
} else if (m is DefaultMethod) {
((DefaultMethod)m).AddModifier(ModifierEnum.Public);
} else {
Debug.Assert(false, "Unexpected type in method of interface. Can not set modifier to public!");
}
}
foreach (DefaultEvent e in Events) {
e.AddModifier(ModifierEnum.Public);
}
foreach (DefaultField f in Fields) {
f.AddModifier(ModifierEnum.Public);
}
foreach (DefaultIndexer i in Indexer) {
i.AddModifier(ModifierEnum.Public);
}
foreach (DefaultProperty p in Properties) {
p.AddModifier(ModifierEnum.Public);
}
}
}
}
|