private ProgramState VisitIdentifier(IdentifierNameSyntax identifier, ProgramState programState)
        {
            var newProgramState = programState;
            var symbol          = SemanticModel.GetSymbolInfo(identifier).Symbol;
            var typeSymbol      = SemanticModel.GetTypeInfo(identifier).Type;
            var sv = newProgramState.GetSymbolValue(symbol);

            if (sv == null)
            {
                var fieldSymbol = symbol as IFieldSymbol;
                if (fieldSymbol != null) // TODO: Fix me when implementing SLVS-1130
                {
                    sv = fieldSymbol.CreateFieldSymbolicValue();
                    newProgramState = newProgramState.StoreSymbolicValue(symbol, sv);
                }
                else
                {
                    sv = SymbolicValue.Create(typeSymbol);
                }
            }
            newProgramState = newProgramState.PushValue(sv);

            var parenthesized = identifier.GetSelfOrTopParenthesizedExpression();
            var argument      = parenthesized.Parent as ArgumentSyntax;

            if (argument == null ||
                argument.RefOrOutKeyword.IsKind(SyntaxKind.None))
            {
                return(SetNonNullConstraintIfValueType(symbol, sv, newProgramState));
            }

            newProgramState = newProgramState.PopValue();
            sv = SymbolicValue.Create(typeSymbol);
            newProgramState = newProgramState.PushValue(sv);
            newProgramState = SetNonNullConstraintIfValueType(symbol, sv, newProgramState);
            return(SetNewSymbolicValueIfTracked(symbol, sv, newProgramState));
        }
Exemple #2
0
 public void TestInitialize()
 {
     sv_w = SymbolicValue.Create();
     sv_0 = new NullableSymbolicValue(sv_w);
 }
Exemple #3
0
 public void TestInitialize()
 {
     symbolicValue         = SymbolicValue.Create();
     nullableSymbolicValue = new NullableSymbolicValue(symbolicValue);
 }