Skip to content

Commit f674b9f

Browse files
committed
add bin, cast & unary nodes
1 parent daaf93e commit f674b9f

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

src/ast/bin.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*!
2+
* Copyright (C) 2017 Glayzzle (BSD3 License)
3+
* @authors https://github.com/glayzzle/php-parser/graphs/contributors
4+
* @url http://glayzzle.com
5+
*/
6+
"use strict";
7+
8+
var Operation = require('./operation');
9+
var KIND = 'bin';
10+
11+
/**
12+
* Binary operations
13+
* @constructor Bin
14+
* @extends {Operation}
15+
* @property {String} type
16+
* @property {Expression} left
17+
* @property {Expression} right
18+
*/
19+
var Bin = Operation.extends(function Bin(type, left, right, location) {
20+
Operation.apply(this, [KIND, location]);
21+
this.type = type;
22+
this.left = left;
23+
this.right = right;
24+
});
25+
26+
module.exports = Bin;

src/ast/cast.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*!
2+
* Copyright (C) 2017 Glayzzle (BSD3 License)
3+
* @authors https://github.com/glayzzle/php-parser/graphs/contributors
4+
* @url http://glayzzle.com
5+
*/
6+
"use strict";
7+
8+
var Operation = require('./operation');
9+
var KIND = 'cast';
10+
11+
/**
12+
* Binary operations
13+
* @constructor Cast
14+
* @extends {Operation}
15+
* @property {String} type
16+
* @property {Expression} what
17+
*/
18+
var Cast = Operation.extends(function Cast(type, what, location) {
19+
Operation.apply(this, [KIND, location]);
20+
this.type = type;
21+
this.what = what;
22+
});
23+
24+
module.exports = Cast;

src/ast/unary.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*!
2+
* Copyright (C) 2017 Glayzzle (BSD3 License)
3+
* @authors https://github.com/glayzzle/php-parser/graphs/contributors
4+
* @url http://glayzzle.com
5+
*/
6+
"use strict";
7+
8+
var Operation = require('./operation');
9+
var KIND = 'unary';
10+
11+
/**
12+
* Unary operations
13+
* @constructor Unary
14+
* @extends {Operation}
15+
* @property {String} type
16+
* @property {Expression} what
17+
*/
18+
var Unary = Operation.extends(function Unary(type, what, location) {
19+
Operation.apply(this, [KIND, location]);
20+
this.type = type;
21+
this.what = what;
22+
});
23+
24+
module.exports = Unary;

0 commit comments

Comments
 (0)