Beispiel #1
0
        private void Value(InvocationExpressionSyntax node)
        {
            var expression = node.GetArgument(0).Expression;

            if (TryGetConstant(expression, out object value))
            {
                Root = new EnumTypeAnalyzer(Model.GetSymbol(expression).ContainingType, value);
            }
        }
Beispiel #2
0
        private void Values(InvocationExpressionSyntax node)
        {
            // We do not care about argument 0, as it is the out parameter
            var expression = node.GetArgument(1).Expression;
            var enumType   = new EnumTypeAnalyzer(Model.GetSymbol(expression).ContainingType);

            foreach (var argument in node.ArgumentList.Arguments.Skip(1))
            {
                if (!TryGetConstant(argument.Expression, out int value))
                {
                    return;
                }

                enumType.AddValue(value);
            }

            Root = enumType;
        }