From 3f08f2566020f1203e0fb19d0e7c514039e4e9ab Mon Sep 17 00:00:00 2001 From: Wayne Phillips Date: Thu, 12 Jul 2018 11:51:32 +0100 Subject: [PATCH] add the user defined compilation arguments to the symbol table --- .../Preprocessing/VBAPreprocessorVisitor.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Rubberduck.Parsing/Preprocessing/VBAPreprocessorVisitor.cs b/Rubberduck.Parsing/Preprocessing/VBAPreprocessorVisitor.cs index 6d0419afc0..e84f7c28dc 100644 --- a/Rubberduck.Parsing/Preprocessing/VBAPreprocessorVisitor.cs +++ b/Rubberduck.Parsing/Preprocessing/VBAPreprocessorVisitor.cs @@ -41,6 +41,7 @@ public sealed class VBAPreprocessorVisitor : VBAConditionalCompilationParserBase _tokenStream = tokenStream; _symbolTable = symbolTable; AddPredefinedConstantsToSymbolTable(predefinedConstants); + AddUserDefinedConstantsToSymbolTable(userDefinedConstants); } private void AddPredefinedConstantsToSymbolTable(VBAPredefinedCompilationConstants predefinedConstants) @@ -53,6 +54,14 @@ private void AddPredefinedConstantsToSymbolTable(VBAPredefinedCompilationConstan _symbolTable.Add(VBAPredefinedCompilationConstants.MAC_NAME, new BoolValue(predefinedConstants.Mac)); } + private void AddUserDefinedConstantsToSymbolTable(Dictionary userDefinedConstants) + { + foreach (var constant in userDefinedConstants) + { + _symbolTable.Add(constant.Key, new DecimalValue(constant.Value)); + } + } + public override IExpression VisitCompilationUnit([NotNull] VBAConditionalCompilationParser.CompilationUnitContext context) { return Visit(context.ccBlock());