Skip to content

Commit

Permalink
add the user defined compilation arguments to the symbol table
Browse files Browse the repository at this point in the history
  • Loading branch information
WaynePhillipsEA committed Jul 12, 2018
1 parent 774aed7 commit 3f08f25
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Rubberduck.Parsing/Preprocessing/VBAPreprocessorVisitor.cs
Expand Up @@ -41,6 +41,7 @@ public sealed class VBAPreprocessorVisitor : VBAConditionalCompilationParserBase
_tokenStream = tokenStream;
_symbolTable = symbolTable;
AddPredefinedConstantsToSymbolTable(predefinedConstants);
AddUserDefinedConstantsToSymbolTable(userDefinedConstants);
}

private void AddPredefinedConstantsToSymbolTable(VBAPredefinedCompilationConstants predefinedConstants)
Expand All @@ -53,6 +54,14 @@ private void AddPredefinedConstantsToSymbolTable(VBAPredefinedCompilationConstan
_symbolTable.Add(VBAPredefinedCompilationConstants.MAC_NAME, new BoolValue(predefinedConstants.Mac));
}

private void AddUserDefinedConstantsToSymbolTable(Dictionary<string, short> 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());
Expand Down

0 comments on commit 3f08f25

Please sign in to comment.