1 |
|
2 |
|
3 | "use strict";
|
4 |
|
5 | var _classCallCheck = require("babel-runtime/helpers/class-call-check")["default"];
|
6 |
|
7 | var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
|
8 |
|
9 | var _index = require("./index");
|
10 |
|
11 | var _index2 = _interopRequireDefault(_index);
|
12 |
|
13 | var _utilLocation = require("../util/location");
|
14 |
|
15 |
|
16 |
|
17 | var pp = _index2["default"].prototype;
|
18 |
|
19 | var Node = (function () {
|
20 | function Node(pos /*:: ?: number*/, loc /*:: ?: SourceLocation*/) {
|
21 | _classCallCheck(this, Node);
|
22 |
|
23 | this.type = "";
|
24 | this.start = pos;
|
25 | this.end = 0;
|
26 | this.loc = new _utilLocation.SourceLocation(loc);
|
27 | }
|
28 |
|
29 | Node.prototype.__clone = function __clone() /*: Node*/ {
|
30 | var node2 = new Node();
|
31 | for (var key in this) {
|
32 | node2[key] = this[key];
|
33 | }return node2;
|
34 | };
|
35 |
|
36 | return Node;
|
37 | })();
|
38 |
|
39 | pp.startNode = function () {
|
40 | return new Node(this.state.start, this.state.startLoc);
|
41 | };
|
42 |
|
43 | pp.startNodeAt = function (pos, loc) {
|
44 | return new Node(pos, loc);
|
45 | };
|
46 |
|
47 | function finishNodeAt(node, type, pos, loc) {
|
48 | node.type = type;
|
49 | node.end = pos;
|
50 | node.loc.end = loc;
|
51 | this.processComment(node);
|
52 | return node;
|
53 | }
|
54 |
|
55 |
|
56 |
|
57 | pp.finishNode = function (node, type) {
|
58 | return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc);
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 | pp.finishNodeAt = function (node, type, pos, loc) {
|
64 | return finishNodeAt.call(this, node, type, pos, loc);
|
65 | }; |
\ | No newline at end of file |