source: trip-planner-front/node_modules/eslint-scope/lib/definition.js@ 59329aa

Last change on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.8 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"use strict";
25
26const Variable = require("./variable");
27
28/**
29 * @class Definition
30 */
31class Definition {
32 constructor(type, name, node, parent, index, kind) {
33
34 /**
35 * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...).
36 */
37 this.type = type;
38
39 /**
40 * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence.
41 */
42 this.name = name;
43
44 /**
45 * @member {espree.Node} Definition#node - the enclosing node of the identifier.
46 */
47 this.node = node;
48
49 /**
50 * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier.
51 */
52 this.parent = parent;
53
54 /**
55 * @member {Number?} Definition#index - the index in the declaration statement.
56 */
57 this.index = index;
58
59 /**
60 * @member {String?} Definition#kind - the kind of the declaration statement.
61 */
62 this.kind = kind;
63 }
64}
65
66/**
67 * @class ParameterDefinition
68 */
69class ParameterDefinition extends Definition {
70 constructor(name, node, index, rest) {
71 super(Variable.Parameter, name, node, null, index, null);
72
73 /**
74 * Whether the parameter definition is a part of a rest parameter.
75 * @member {boolean} ParameterDefinition#rest
76 */
77 this.rest = rest;
78 }
79}
80
81module.exports = {
82 ParameterDefinition,
83 Definition
84};
85
86/* vim: set sw=4 ts=4 et tw=80 : */
Note: See TracBrowser for help on using the repository browser.