Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/NRefactory.CSharp-5.5.0/Analysis/NullValueStatus.cs @ 12515

Last change on this file since 12515 was 11700, checked in by jkarder, 10 years ago

#2077: created branch and added first version

File size: 2.9 KB
Line 
1//
2// NullValueAnalysis.cs
3// 
4// Author:
5//       Luís Reis <luiscubal@gmail.com>
6//
7// Copyright (c) 2013 Luís Reis
8//
9// Permission is hereby granted, free of charge, to any person obtaining a copy
10// of this software and associated documentation files (the "Software"), to deal
11// in the Software without restriction, including without limitation the rights
12// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13// copies of the Software, and to permit persons to whom the Software is
14// furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice shall be included in
17// all copies or substantial portions of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25// THE SOFTWARE.
26using System;
27
28namespace ICSharpCode.NRefactory.CSharp.Analysis
29{
30  /// <summary>
31  /// Represents the null value status of a variable at a specific location.
32  /// </summary>
33  public enum NullValueStatus
34  {
35    /// <summary>
36    /// The value of the variable is unknown, possibly due to limitations
37    /// of the null value analysis.
38    /// </summary>
39    Unknown = 0,
40    /// <summary>
41    /// The value of the variable is unknown and even assigning it to a
42    /// value won't change its state, since it has been captured by a lambda
43    /// that may change it at any time (potentially even from a different thread).
44    /// Only going out of scope and creating a new variable may change the value
45    /// of this variable.
46    /// </summary>
47    CapturedUnknown,
48    /// <summary>
49    /// This variable is potentially unassigned.
50    /// </summary>
51    Unassigned,
52    /// <summary>
53    /// The value of the variable is provably null.
54    /// </summary>
55    DefinitelyNull,
56    /// <summary>
57    /// The value of the variable might or might not be null
58    /// </summary>
59    PotentiallyNull,
60    /// <summary>
61    /// The value of the variable is provably not null
62    /// </summary>
63    DefinitelyNotNull,
64    /// <summary>
65    /// The position of this node is unreachable, therefore the value
66    /// of the variable is not meaningful.
67    /// Alternatively, it might mean no local variable exists with the requested name.
68    /// </summary>
69    UnreachableOrInexistent,
70    /// <summary>
71    /// The analyser has encountered an error when attempting to find the value
72    /// of this variable.
73    /// </summary>
74    Error
75  }
76
77  public static class NullValueStatusExtensions
78  {
79    public static bool IsDefiniteValue (this NullValueStatus self) {
80      return self == NullValueStatus.DefinitelyNull || self == NullValueStatus.DefinitelyNotNull;
81    }
82  }
83}
84
Note: See TracBrowser for help on using the repository browser.