Skip to content

Commit e699016

Browse files
authored
Merge branch 'next' into next
2 parents 941196d + aed17f4 commit e699016

16 files changed

+1330
-141
lines changed

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RubberduckUI.de.resx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
62+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -667,7 +667,8 @@ Warnung: Alle eigenen Einstellungen gehen dabei verloren. Die Originaldatei wird
667667
<value>Einstellungen auf Standardkonfiguration zurücksetzen?</value>
668668
</data>
669669
<data name="RenameDialog_ConflictingNames" xml:space="preserve">
670-
<value>Das Umbenenen zu '{0}' wird einen Konflikt mit '{1}' auslösen. Wollen Sie fortfahren?</value>
670+
<value>Das Umbenenen zu '{0}' wird einen Konflikt mit '{1}' auslösen.'
671+
Wollen Sie trotzdem fortfahren?</value>
671672
</data>
672673
<data name="Rename_DeclarationType" xml:space="preserve">
673674
<value>{0} Umbenennen</value>
@@ -1749,4 +1750,28 @@ Allen Sternguckern, Likern &amp; Followern, für das warme Kribbeln
17491750
<data name="IndenterSettings_IndentEnumTypeAsProcedure" xml:space="preserve">
17501751
<value>Kommentare in Enums und Typen wie in Prozeduren einrücken</value>
17511752
</data>
1753+
<data name="CodeInspectionSettings_Misc_RunInspectionsOnSuccessfulParse">
1754+
<value>Inspektionen nach erfolgreichem Parsen automatisch starten</value>
1755+
</data>
1756+
<data name="RubberduckReloadFailure_Title">
1757+
<value>Rubberduck wird nicht neu geladen</value>
1758+
</data>
1759+
<data name="GeneralSettings_ShowSplash">
1760+
<value>Ein Startlogo zu Beginn zeigen</value>
1761+
</data>
1762+
<data name="HotkeyDescription_RefactorEncapsulateField">
1763+
<value>Refactor / Feld kapseln</value>
1764+
</data>
1765+
<data name="CodeExplorer_CollapseSubnodesToolTip">
1766+
<value>Knoten und alle Kindknoten einklappen</value>
1767+
</data>
1768+
<data name="CodeInspectionSettings_Misc">
1769+
<value>Verschiedenes</value>
1770+
</data>
1771+
<data name="CodeExplorer_ExpandSubnodesToolTip">
1772+
<value>Expand node and all child nodes</value>
1773+
</data>
1774+
<data name="RubberduckReloadFailure_Message">
1775+
<value>Werkzeugfenster wurden nicht korrekt entfernt und/oder konnten nicht wieder hergestellt werden; Die VBE könnte instabil sein. Rubberduck wird beim nächsten Start der VBE normal laden.</value>
1776+
</data>
17521777
</root>

RetailCoder.VBE/UI/RubberduckUI.fr.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
62+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -1586,4 +1586,4 @@ Tous ceux qui nous ont donné une étoile ou un "like"
15861586
<data name="ReparseToolTipText" xml:space="preserve">
15871587
<value>{0}. Cliquez pour rafraîchir.</value>
15881588
</data>
1589-
</root>
1589+
</root>

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
62+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -1840,4 +1840,4 @@ End If 'More Tools?
18401840

18411841
End Sub</value>
18421842
</data>
1843-
</root>
1843+
</root>

Rubberduck.Parsing/Annotations/VBAParserAnnotationFactory.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,29 @@ public VBAParserAnnotationFactory()
2828
public IAnnotation Create(VBAParser.AnnotationContext context, QualifiedSelection qualifiedSelection)
2929
{
3030
string annotationName = context.annotationName().GetText();
31-
List<string> parameters = new List<string>();
32-
var argList = context.annotationArgList();
33-
if (argList != null)
31+
List<string> parameters = AnnotationParametersFromContext(context);
32+
return CreateAnnotation(annotationName, parameters, qualifiedSelection);
33+
}
34+
35+
private static List<string> AnnotationParametersFromContext(VBAParser.AnnotationContext context)
3436
{
35-
parameters.AddRange(argList.annotationArg().Select(arg => arg.GetText()));
37+
List<string> parameters = new List<string>();
38+
var argList = context.annotationArgList();
39+
if (argList != null)
40+
{
41+
parameters.AddRange(argList.annotationArg().Select(arg => arg.GetText()));
42+
}
43+
return parameters;
3644
}
37-
Type annotationCLRType = null;
38-
if (_creators.TryGetValue(annotationName.ToUpperInvariant(), out annotationCLRType))
45+
46+
private IAnnotation CreateAnnotation(string annotationName, List<string> parameters, QualifiedSelection qualifiedSelection)
3947
{
40-
return (IAnnotation)Activator.CreateInstance(annotationCLRType, qualifiedSelection, parameters);
48+
Type annotationCLRType = null;
49+
if (_creators.TryGetValue(annotationName.ToUpperInvariant(), out annotationCLRType))
50+
{
51+
return (IAnnotation)Activator.CreateInstance(annotationCLRType, qualifiedSelection, parameters);
52+
}
53+
return null;
4154
}
42-
return null;
43-
}
4455
}
4556
}

Rubberduck.Parsing/Binding/DefaultBindingContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public IBoundExpression Resolve(Declaration module, Declaration parent, ParserRu
3434
public IExpressionBinding BuildTree(Declaration module, Declaration parent, ParserRuleContext expression, IBoundExpression withBlockVariable, StatementResolutionContext statementContext)
3535
{
3636
dynamic dynamicExpression = expression;
37-
var type = expression.GetType();
3837
return Visit(module, parent, dynamicExpression, withBlockVariable, statementContext);
3938
}
4039

Rubberduck.Parsing/Binding/SimpleNameDefaultBinding.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,25 +350,34 @@ private bool IsValidMatch(Declaration match, string name)
350350
{
351351
return true;
352352
}
353-
var functionSubroutinePropertyGet = match.DeclarationType == DeclarationType.Function
354-
|| match.DeclarationType == DeclarationType.Procedure
355-
|| match.DeclarationType == DeclarationType.PropertyGet;
356-
if (!functionSubroutinePropertyGet)
353+
if (!IsFunctionSubroutinePropertyGet(match))
357354
{
358355
return true;
359356
}
360357
if (((IDeclarationWithParameter)match).Parameters.Count() > 0)
361358
{
362359
return true;
363360
}
364-
if (match.AsTypeName != null
365-
&& match.AsTypeName.ToUpperInvariant() != "VARIANT"
366-
&& match.AsTypeName.ToUpperInvariant() != "OBJECT"
367-
&& match.AsTypeIsBaseType)
361+
if (IsTypeDeclarationOfSpecificBaseType(match))
368362
{
369363
return false;
370364
}
371365
return true;
372366
}
367+
368+
private static bool IsFunctionSubroutinePropertyGet(Declaration match)
369+
{
370+
return match.DeclarationType == DeclarationType.Function
371+
|| match.DeclarationType == DeclarationType.Procedure
372+
|| match.DeclarationType == DeclarationType.PropertyGet;
373+
}
374+
375+
private static bool IsTypeDeclarationOfSpecificBaseType(Declaration match)
376+
{
377+
return match.AsTypeName != null
378+
&& match.AsTypeName.ToUpperInvariant() != "VARIANT"
379+
&& match.AsTypeName.ToUpperInvariant() != "OBJECT"
380+
&& match.AsTypeIsBaseType;
381+
}
373382
}
374383
}

Rubberduck.Parsing/Symbols/AccessibilityCheck.cs

Lines changed: 71 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,104 @@ public static class AccessibilityCheck
44
{
55
public static bool IsAccessible(Declaration callingProject, Declaration callingModule, Declaration callingParent, Declaration callee)
66
{
7-
if (callee.DeclarationType.HasFlag(DeclarationType.Project))
8-
{
9-
return true;
10-
}
11-
if (callee.DeclarationType.HasFlag(DeclarationType.Module))
12-
{
13-
return IsModuleAccessible(callingProject, callingModule, callee);
14-
}
15-
return IsMemberAccessible(callingProject, callingModule, callingParent, callee);
7+
return callee != null
8+
&& (callee.DeclarationType.HasFlag(DeclarationType.Project)
9+
|| (callee.DeclarationType.HasFlag(DeclarationType.Module) && IsModuleAccessible(callingProject, callingModule, callee))
10+
|| (!callee.DeclarationType.HasFlag(DeclarationType.Module) && IsMemberAccessible(callingProject, callingModule, callingParent, callee)));
1611
}
1712

13+
1814
public static bool IsModuleAccessible(Declaration callingProject, Declaration callingModule, Declaration calleeModule)
1915
{
20-
bool validAccessibility = IsValidAccessibility(calleeModule);
21-
bool enclosingModule = callingModule.Equals(calleeModule);
22-
if (enclosingModule)
23-
{
24-
return true;
25-
}
26-
bool sameProject = callingModule.ParentScopeDeclaration.Equals(calleeModule.ParentScopeDeclaration);
27-
if (sameProject)
28-
{
29-
return validAccessibility;
30-
}
31-
if (calleeModule.DeclarationType.HasFlag(DeclarationType.ProceduralModule))
16+
return calleeModule != null
17+
&& (IsTheSameModule(callingModule, calleeModule)
18+
|| IsEnclosingProject(callingProject, calleeModule)
19+
|| (calleeModule.DeclarationType.HasFlag(DeclarationType.ProceduralModule) && !((ProceduralModuleDeclaration)calleeModule).IsPrivateModule)
20+
|| (!calleeModule.DeclarationType.HasFlag(DeclarationType.ProceduralModule) && ((ClassModuleDeclaration)calleeModule).IsExposed));
21+
}
22+
23+
private static bool IsTheSameModule(Declaration callingModule, Declaration calleeModule)
3224
{
33-
bool isPrivate = ((ProceduralModuleDeclaration)calleeModule).IsPrivateModule;
34-
return validAccessibility && !isPrivate;
25+
return calleeModule.Equals(callingModule);
3526
}
36-
else
27+
28+
private static bool IsEnclosingProject(Declaration callingProject, Declaration calleeModule)
3729
{
38-
bool isExposed = calleeModule != null && ((ClassModuleDeclaration)calleeModule).IsExposed;
39-
return validAccessibility && isExposed;
30+
return calleeModule.ParentScopeDeclaration.Equals(callingProject);
4031
}
41-
}
4232

43-
public static bool IsValidAccessibility(Declaration moduleOrMember)
44-
{
45-
return moduleOrMember != null
46-
&& (moduleOrMember.Accessibility == Accessibility.Global
47-
|| moduleOrMember.Accessibility == Accessibility.Public
48-
|| moduleOrMember.Accessibility == Accessibility.Friend
49-
|| moduleOrMember.Accessibility == Accessibility.Implicit);
50-
}
33+
5134

5235
public static bool IsMemberAccessible(Declaration callingProject, Declaration callingModule, Declaration callingParent, Declaration calleeMember)
5336
{
54-
if (IsEnclosingModule(callingModule, calleeMember))
37+
if (calleeMember == null)
5538
{
56-
return true;
57-
}
58-
var callerIsSubroutineOrProperty = callingParent.DeclarationType.HasFlag(DeclarationType.Property)
59-
|| callingParent.DeclarationType.HasFlag(DeclarationType.Function)
60-
|| callingParent.DeclarationType.HasFlag(DeclarationType.Procedure);
61-
var calleeHasSameParent = callingParent.Equals(callingParent.ParentScopeDeclaration);
62-
if (callerIsSubroutineOrProperty && calleeHasSameParent)
39+
return false;
40+
}
41+
if (IsEnclosingModuleOfInstanceMember(callingModule, calleeMember)
42+
|| IsLocalMemberOfTheCallingSubroutineOrProperty(callingParent, calleeMember))
6343
{
64-
return calleeHasSameParent;
44+
return true;
6545
}
6646
var memberModule = Declaration.GetModuleParent(calleeMember);
67-
if (IsModuleAccessible(callingProject, callingModule, memberModule))
47+
return IsModuleAccessible(callingProject, callingModule, memberModule)
48+
&& (calleeMember.DeclarationType.HasFlag(DeclarationType.EnumerationMember)
49+
|| calleeMember.DeclarationType.HasFlag(DeclarationType.UserDefinedTypeMember)
50+
|| HasPublicScope(calleeMember)
51+
|| (IsEnclosingProject(callingProject, memberModule) && IsAccessibleThroughoutTheSameProject(calleeMember)));
52+
}
53+
54+
private static bool IsEnclosingModuleOfInstanceMember(Declaration callingModule, Declaration calleeMember)
6855
{
69-
if (calleeMember.DeclarationType.HasFlag(DeclarationType.EnumerationMember) || calleeMember.DeclarationType.HasFlag(DeclarationType.UserDefinedTypeMember))
56+
if (callingModule.Equals(calleeMember.ParentScopeDeclaration))
7057
{
71-
return IsValidAccessibility(calleeMember.ParentDeclaration);
58+
return true;
7259
}
73-
else
60+
foreach (var supertype in ClassModuleDeclaration.GetSupertypes(callingModule))
7461
{
75-
return IsValidAccessibility(calleeMember);
62+
if (IsEnclosingModuleOfInstanceMember(supertype, calleeMember))
63+
{
64+
return true;
65+
}
7666
}
67+
return false;
7768
}
78-
return false;
79-
}
8069

81-
private static bool IsEnclosingModule(Declaration callingModule, Declaration calleeMember)
82-
{
83-
if (callingModule.Equals(calleeMember.ParentScopeDeclaration))
70+
private static bool IsLocalMemberOfTheCallingSubroutineOrProperty(Declaration callingParent, Declaration calleeMember)
8471
{
85-
return true;
72+
return IsSubroutineOrProperty(callingParent) && CaleeHasSameParentScopeAsCaller(callingParent, calleeMember);
8673
}
87-
foreach (var supertype in ClassModuleDeclaration.GetSupertypes(callingModule))
88-
{
89-
if (IsEnclosingModule(supertype, calleeMember))
74+
75+
private static bool IsSubroutineOrProperty(Declaration decl)
9076
{
91-
return true;
77+
return decl.DeclarationType.HasFlag(DeclarationType.Property)
78+
|| decl.DeclarationType.HasFlag(DeclarationType.Function)
79+
|| decl.DeclarationType.HasFlag(DeclarationType.Procedure);
80+
}
81+
82+
private static bool CaleeHasSameParentScopeAsCaller(Declaration callingParent, Declaration calleeMember)
83+
{
84+
return callingParent.Equals(calleeMember.ParentScopeDeclaration);
9285
}
86+
87+
private static bool HasPublicScope(Declaration member)
88+
{
89+
return member.Accessibility == Accessibility.Public
90+
|| member.Accessibility == Accessibility.Global
91+
|| (member.Accessibility == Accessibility.Implicit && IsPublicByDefault(member));
92+
}
93+
94+
private static bool IsPublicByDefault(Declaration member)
95+
{
96+
return IsSubroutineOrProperty(member)
97+
|| member.DeclarationType.HasFlag(DeclarationType.Enumeration)
98+
|| member.DeclarationType.HasFlag(DeclarationType.UserDefinedType);
99+
}
100+
101+
private static bool IsAccessibleThroughoutTheSameProject(Declaration member)
102+
{
103+
return HasPublicScope(member)
104+
|| member.Accessibility == Accessibility.Friend;
93105
}
94-
return false;
95-
}
96106
}
97107
}

0 commit comments

Comments
 (0)