UNPKG

cst

Version:

JavaScript CST Implementation

73 lines (65 loc) 2.26 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var Reference = (function () { function Reference(_ref) { var node = _ref.node; var scope = _ref.scope; var read = _ref.read; var write = _ref.write; return (function () { _classCallCheck(this, Reference); this._node = node; this._scope = scope; this._read = read; this._write = write; }).apply(this, arguments); } _createClass(Reference, [{ key: 'node', get: function get() { return this._node; } }, { key: 'scope', get: function get() { return this._scope; } }, { key: 'variable', get: function get() { return this._variable; } }, { key: 'isRead', get: function get() { return this._read; } }, { key: 'isWrite', get: function get() { return this._write; } }, { key: 'isReadOnly', get: function get() { return this._read && !this._write; } }, { key: 'isWriteOnly', get: function get() { return !this._read && this._write; } }, { key: 'isReadWrite', get: function get() { return this._read && this._write; } }]); return Reference; })(); exports['default'] = Reference; module.exports = exports['default'];