-
Notifications
You must be signed in to change notification settings - Fork 307
/
Copy pathSubroutineDeclaration.cs
82 lines (77 loc) · 2.82 KB
/
SubroutineDeclaration.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
using Antlr4.Runtime;
using Rubberduck.Parsing.Annotations;
using Rubberduck.Parsing.ComReflection;
using Rubberduck.Parsing.VBA;
using Rubberduck.VBEditor;
using System.Collections.Generic;
using System.Linq;
using static Rubberduck.Parsing.Grammar.VBAParser;
namespace Rubberduck.Parsing.Symbols
{
public sealed class SubroutineDeclaration : ModuleBodyElementDeclaration
{
public SubroutineDeclaration(
QualifiedMemberName name,
Declaration parent,
Declaration parentScope,
string asTypeName,
Accessibility accessibility,
ParserRuleContext context,
ParserRuleContext attributesPassContext,
Selection selection,
bool isUserDefined,
IEnumerable<IParseTreeAnnotation> annotations,
Attributes attributes)
: base(
name,
parent,
parentScope,
asTypeName,
null,
string.Empty,
accessibility,
DeclarationType.Procedure,
context,
attributesPassContext,
selection,
false,
isUserDefined,
annotations,
attributes)
{ }
public SubroutineDeclaration(ComMember member, Declaration parent, QualifiedModuleName module, Attributes attributes, bool eventHandler)
: base(
module.QualifyMemberName(member.Name),
parent,
parent,
string.Empty,
null,
string.Empty,
Accessibility.Global,
eventHandler ? DeclarationType.Event : DeclarationType.Procedure,
null,
null,
Selection.Home,
false,
false,
null,
attributes)
{
AddParameters(member.Parameters.Select(decl => new ParameterDeclaration(decl, this, module)));
}
/// <inheritdoc/>
protected override bool Implements(IInterfaceExposable member)
{
if (ReferenceEquals(member, this))
{
return false;
}
return DeclarationType == DeclarationType.Procedure
&& member.DeclarationType == DeclarationType.Procedure
&& IdentifierName.Equals(member.ImplementingIdentifierName)
&& member.IsInterfaceMember
&& ((ClassModuleDeclaration)member.ParentDeclaration).Subtypes.Any(implementation => ReferenceEquals(implementation, ParentDeclaration));
}
public override BlockContext Block => ((SubStmtContext)Context).block();
}
}