source: imaps-frontend/node_modules/eslint-scope/lib/variable.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12
13 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
17 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24
25/**
26 * A Variable represents a locally scoped identifier. These include arguments to
27 * functions.
28 * @constructor Variable
29 */
30class Variable {
31 constructor(name, scope) {
32
33 /**
34 * The variable name, as given in the source code.
35 * @member {string} Variable#name
36 */
37 this.name = name;
38
39 /**
40 * List of defining occurrences of this variable (like in 'var ...'
41 * statements or as parameter), as AST nodes.
42 * @member {espree.Identifier[]} Variable#identifiers
43 */
44 this.identifiers = [];
45
46 /**
47 * List of {@link Reference|references} of this variable (excluding parameter entries)
48 * in its defining scope and all nested scopes. For defining
49 * occurrences only see {@link Variable#defs}.
50 * @member {Reference[]} Variable#references
51 */
52 this.references = [];
53
54 /**
55 * List of defining occurrences of this variable (like in 'var ...'
56 * statements or as parameter), as custom objects.
57 * @member {Definition[]} Variable#defs
58 */
59 this.defs = [];
60
61 this.tainted = false;
62
63 /**
64 * Whether this is a stack variable.
65 * @member {boolean} Variable#stack
66 */
67 this.stack = true;
68
69 /**
70 * Reference to the enclosing Scope.
71 * @member {Scope} Variable#scope
72 */
73 this.scope = scope;
74 }
75}
76
77Variable.CatchClause = "CatchClause";
78Variable.Parameter = "Parameter";
79Variable.FunctionName = "FunctionName";
80Variable.ClassName = "ClassName";
81Variable.Variable = "Variable";
82Variable.ImportBinding = "ImportBinding";
83Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable";
84
85export default Variable;
86
87/* vim: set sw=4 ts=4 et tw=80 : */
Note: See TracBrowser for help on using the repository browser.