示例#1
0
        private static IEnumerable <SyntaxTrivia> GetLeadingTriviaFor(VariableDeclaratorSyntax variable)
        {
            var previousToken = variable.GetFirstToken().GetPreviousToken();

            return(previousToken.TrailingTrivia
                   .Concat(variable.GetLeadingTrivia()));
        }
        private VariableState VisitVariableDeclaration(VariableDeclaratorSyntax declaration, ExecutionState state)
        {
            VariableState lastState = new VariableState(declaration, VariableTaint.UNKNOWN);

            var identifier  = declaration.GetFirstToken();
            var initializer = declaration.Initializer;

            if (initializer is EqualsValueSyntax)
            {
                EqualsValueSyntax equalsClause = initializer;

                VariableState varState = VisitExpression(equalsClause.Value, state);
                state.AddNewValue(ResolveIdentifier(identifier), varState);
                lastState = varState;
            }

            return(lastState);
        }
 private static IEnumerable<SyntaxTrivia> GetLeadingTriviaFor(VariableDeclaratorSyntax variable)
 {
     var previousToken = variable.GetFirstToken().GetPreviousToken();
     return previousToken.TrailingTrivia
         .Concat(variable.GetLeadingTrivia());
 }