Skip to content

Commit aac8edc

Browse files
authored
Merge pull request #4706 from WaynePhillipsEA/typelibs-api-refactor
Typelibs API big refactor and improvements
2 parents 35ef70e + 4f4e2eb commit aac8edc

File tree

68 files changed

+6059
-2495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+6059
-2495
lines changed

Rubberduck.Core/UI/Command/ReparseCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using Rubberduck.Settings;
99
using Rubberduck.SettingsProvider;
1010
using Rubberduck.Resources;
11-
using Rubberduck.VBEditor.ComManagement.TypeLibsAPI;
11+
using Rubberduck.VBEditor.ComManagement.TypeLibs.Abstract;
1212
using Rubberduck.VBEditor.SafeComWrappers;
1313
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
1414
using Rubberduck.VBEditor.VbeRuntime.Settings;

Rubberduck.Main/Extension.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Rubberduck.Settings;
2020
using Rubberduck.SettingsProvider;
2121
using Rubberduck.VBEditor.ComManagement;
22+
using Rubberduck.VBEditor.ComManagement.TypeLibs;
2223
using Rubberduck.VBEditor.Events;
2324
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
2425
using Rubberduck.VBEditor.VbeRuntime;
@@ -68,7 +69,7 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
6869
_vbeNativeApi = VbeProvider.VbeRuntime;
6970
#if DEBUG
7071
// FOR DEBUGGING/DEVELOPMENT PURPOSES, ALLOW ACCESS TO SOME VBETypeLibsAPI FEATURES FROM VBA
71-
_addin.Object = new VBEditor.ComManagement.TypeLibsAPI.VBETypeLibsAPI_Object(_vbe);
72+
_addin.Object = new VBETypeLibsAPI_Object(_vbe);
7273
#endif
7374

7475
switch (ConnectMode)

Rubberduck.Main/Root/RubberduckIoCInstaller.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@
4949
using Rubberduck.VBEditor;
5050
using Rubberduck.VBEditor.ComManagement;
5151
using Rubberduck.VBEditor.ComManagement.TypeLibs;
52-
using Rubberduck.VBEditor.ComManagement.TypeLibsAPI;
52+
using Rubberduck.VBEditor.ComManagement.TypeLibs.Abstract;
5353
using Rubberduck.VBEditor.Events;
5454
using Rubberduck.VBEditor.Utility;
5555
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
5656
using Rubberduck.VBEditor.SourceCodeHandling;
5757
using Rubberduck.VBEditor.VbeRuntime;
58-
using Rubberduck.UnitTesting.Settings;
5958

6059
namespace Rubberduck.Root
6160
{

Rubberduck.Parsing/ComReflection/ComProject.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
using System.Runtime.InteropServices.ComTypes;
88
using System.Runtime.Serialization;
99
using Rubberduck.VBEditor.ComManagement.TypeLibs;
10-
using Rubberduck.VBEditor.ComManagement.TypeLibsSupport;
1110
using Rubberduck.VBEditor.Utility;
1211
using TYPEATTR = System.Runtime.InteropServices.ComTypes.TYPEATTR;
1312
using TYPELIBATTR = System.Runtime.InteropServices.ComTypes.TYPELIBATTR;
13+
using TYPEKIND = System.Runtime.InteropServices.ComTypes.TYPEKIND;
1414

1515
namespace Rubberduck.Parsing.ComReflection
1616
{
@@ -102,9 +102,9 @@ private void LoadModules(ITypeLib typeLibrary)
102102
var typeAttributes = Marshal.PtrToStructure<TYPEATTR>(typeAttributesPointer);
103103
KnownTypes.TryGetValue(typeAttributes.guid, out var type);
104104

105-
switch (typeAttributes.typekind.ToTypeKindVbe())
105+
switch (typeAttributes.typekind)
106106
{
107-
case TYPEKIND_VBE.TKIND_ENUM:
107+
case TYPEKIND.TKIND_ENUM:
108108
var enumeration = type ?? new ComEnumeration(this, typeLibrary, info, typeAttributes, index);
109109
Debug.Assert(enumeration is ComEnumeration);
110110
_enumerations.Add(enumeration as ComEnumeration);
@@ -113,7 +113,7 @@ private void LoadModules(ITypeLib typeLibrary)
113113
KnownTypes.TryAdd(typeAttributes.guid, enumeration);
114114
}
115115
break;
116-
case TYPEKIND_VBE.TKIND_COCLASS:
116+
case TYPEKIND.TKIND_COCLASS:
117117
var coclass = type ?? new ComCoClass(this, typeLibrary, info, typeAttributes, index);
118118
Debug.Assert(coclass is ComCoClass && !coclass.Guid.Equals(Guid.Empty));
119119
_classes.Add(coclass as ComCoClass);
@@ -122,8 +122,8 @@ private void LoadModules(ITypeLib typeLibrary)
122122
KnownTypes.TryAdd(typeAttributes.guid, coclass);
123123
}
124124
break;
125-
case TYPEKIND_VBE.TKIND_DISPATCH:
126-
case TYPEKIND_VBE.TKIND_INTERFACE:
125+
case TYPEKIND.TKIND_DISPATCH:
126+
case TYPEKIND.TKIND_INTERFACE:
127127
var intface = type ?? new ComInterface(this, typeLibrary, info, typeAttributes, index);
128128
Debug.Assert(intface is ComInterface && !intface.Guid.Equals(Guid.Empty));
129129
_interfaces.Add(intface as ComInterface);
@@ -132,11 +132,11 @@ private void LoadModules(ITypeLib typeLibrary)
132132
KnownTypes.TryAdd(typeAttributes.guid, intface);
133133
}
134134
break;
135-
case TYPEKIND_VBE.TKIND_RECORD:
135+
case TYPEKIND.TKIND_RECORD:
136136
var structure = new ComStruct(this, typeLibrary, info, typeAttributes, index);
137137
_structs.Add(structure);
138138
break;
139-
case TYPEKIND_VBE.TKIND_MODULE:
139+
case TYPEKIND.TKIND_MODULE:
140140
var module = type ?? new ComModule(this, typeLibrary, info, typeAttributes, index);
141141
Debug.Assert(module is ComModule);
142142
_modules.Add(module as ComModule);
@@ -145,20 +145,17 @@ private void LoadModules(ITypeLib typeLibrary)
145145
KnownTypes.TryAdd(typeAttributes.guid, module);
146146
}
147147
break;
148-
case TYPEKIND_VBE.TKIND_ALIAS:
148+
case TYPEKIND.TKIND_ALIAS:
149149
var alias = new ComAlias(this, typeLibrary, info, index, typeAttributes);
150150
_aliases.Add(alias);
151151
if (alias.Guid != Guid.Empty)
152152
{
153153
KnownAliases.TryAdd(alias.Guid, alias);
154154
}
155155
break;
156-
case TYPEKIND_VBE.TKIND_UNION:
156+
case TYPEKIND.TKIND_UNION:
157157
//TKIND_UNION is not a supported member type in VBA.
158158
break;
159-
case TYPEKIND_VBE.TKIND_VBACLASS:
160-
//TODO: Implement this.
161-
break;
162159
default:
163160
throw new NotImplementedException($"Didn't expect a TYPEATTR with multiple typekind flags set in {Path}.");
164161
}

Rubberduck.Parsing/ComReflection/UserProjectRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Rubberduck.Parsing.UIContext;
66
using Rubberduck.Parsing.VBA.Extensions;
77
using Rubberduck.VBEditor.ComManagement;
8-
using Rubberduck.VBEditor.ComManagement.TypeLibs;
8+
using Rubberduck.VBEditor.ComManagement.TypeLibs.Abstract;
99
using Rubberduck.VBEditor.Extensions;
1010
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
1111

Rubberduck.Parsing/Preprocessing/CompilationArgumentsProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22
using Rubberduck.Parsing.UIContext;
3-
using Rubberduck.VBEditor.ComManagement.TypeLibs;
3+
using Rubberduck.VBEditor.ComManagement.TypeLibs.Abstract;
44

55
namespace Rubberduck.Parsing.PreProcessing
66
{
@@ -29,7 +29,7 @@ private Dictionary<string, short> GetUserDefinedCompilationArguments(string proj
2929
var task = _uiDispatcher.StartTask(() => {
3030
using (var typeLib = _typeLibWrapperProvider.TypeLibWrapperFromProject(projectId))
3131
{
32-
return typeLib?.ConditionalCompilationArguments ?? new Dictionary<string, short>();
32+
return typeLib?.VBEExtensions.ConditionalCompilationArguments ?? new Dictionary<string, short>();
3333
}
3434
});
3535
return task.Result;

0 commit comments

Comments
 (0)