1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | var Node = require('./node');
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var Params = module.exports = function Params(){
|
24 | Node.call(this);
|
25 | this.nodes = [];
|
26 | };
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | Params.prototype.__defineGetter__('length', function(){
|
36 | return this.nodes.length;
|
37 | });
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | Params.prototype.__proto__ = Node.prototype;
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | Params.prototype.push = function(node){
|
53 | this.nodes.push(node);
|
54 | };
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | Params.prototype.clone = function(parent){
|
64 | var clone = new Params;
|
65 | clone.lineno = this.lineno;
|
66 | clone.column = this.column;
|
67 | clone.filename = this.filename;
|
68 | this.nodes.forEach(function(node){
|
69 | clone.push(node.clone(parent, clone));
|
70 | });
|
71 | return clone;
|
72 | };
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | Params.prototype.toJSON = function(){
|
82 | return {
|
83 | __type: 'Params',
|
84 | nodes: this.nodes,
|
85 | lineno: this.lineno,
|
86 | column: this.column,
|
87 | filename: this.filename
|
88 | };
|
89 | };
|
90 |
|