forked from IronLanguages/ironpython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPythonVariable.cs
More file actions
60 lines (45 loc) · 1.7 KB
/
PythonVariable.cs
File metadata and controls
60 lines (45 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using MSAst = System.Linq.Expressions;
using System;
using System.Diagnostics;
using Microsoft.Scripting;
using Microsoft.Scripting.Ast;
using Microsoft.Scripting.Utils;
using IronPython.Runtime;
namespace IronPython.Compiler.Ast {
using Ast = MSAst.Expression;
public class PythonVariable {
public PythonVariable(string name, VariableKind kind, ScopeStatement/*!*/ scope) {
Assert.NotNull(scope);
Name = name;
Kind = kind;
Scope = scope;
}
public string Name { get; }
public bool IsGlobal {
get {
return Kind == VariableKind.Global || Scope.IsGlobal;
}
}
public ScopeStatement Scope { get; }
public VariableKind Kind { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the variable gets deleted.
/// </summary>
internal bool Deleted { get; set; }
/// <summary>
/// Gets the index used for tracking in the flow checker.
/// </summary>
internal int Index { get; set; }
/// <summary>
/// True iff there is a path in control flow graph on which the variable is used before initialized (assigned or deleted).
/// </summary>
public bool ReadBeforeInitialized { get; set; }
/// <summary>
/// True iff the variable is referred to from the inner scope.
/// </summary>
public bool AccessedInNestedScope { get; set; }
}
}