Skip to content

Commit ca7cd95

Browse files
don't try to get user defined compilation arguments for the mocks
1 parent fe6a500 commit ca7cd95

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Rubberduck.Parsing/Preprocessing/VBAPreprocessor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public void PreprocessTokenStream(IVBProject project, string moduleName, CommonT
3636

3737
public Dictionary<string, short> GetUserDefinedCompilationArguments(IVBProject project)
3838
{
39+
// for the mocks, just return an empty dictionary for now
40+
if (project == null) return new Dictionary<string, short>();
41+
3942
// use the TypeLib API to grab the user defined compilation arguments. must be obtained on the main thread.
4043
var providerInst = UiContextProvider.Instance();
4144
var task = (new UiDispatcher(providerInst)).StartTask(delegate () {

RubberduckTests/Mocks/TestAttributeParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public TestAttributeParser(Func<IVBAPreprocessor> preprocessorFactory, IProjects
3535
var tokens = tokenStreamProvider.Tokens(code);
3636
var preprocessor = _preprocessorFactory();
3737
var preprocessingErrorListener = new PreprocessorExceptionErrorListener(module.ComponentName, ParsePass.AttributesPass);
38-
preprocessor.PreprocessTokenStream(component.ParentProject, module.ComponentName, tokens, preprocessingErrorListener, cancellationToken);
38+
preprocessor.PreprocessTokenStream(null, module.ComponentName, tokens, preprocessingErrorListener, cancellationToken);
3939
var listener = new AttributeListener(Tuple.Create(module.ComponentName, type));
4040
// parse tree isn't usable for declarations because
4141
// line numbers are offset due to module header and attributes

0 commit comments

Comments
 (0)