Skip to content

Commit 038fff2

Browse files
committed
various fixes
1 parent ab576b9 commit 038fff2

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

node_translators/class.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ module.exports = function (node, indent) {
1515
str += 'final ';
1616
}
1717

18-
str += 'class ' + node.name;
18+
str += 'class';
19+
if (node.name) {
20+
str += ' ' + node.name;
21+
}
1922

2023
if (node.extends) {
2124
str += ' extends ' + codegen(node.extends, indent);
@@ -28,13 +31,21 @@ module.exports = function (node, indent) {
2831
}
2932

3033
// begin curly brace
31-
str += this.nl + indent + '{' + this.nl;
34+
if (node.name) {
35+
str += this.nl + indent + '{' + this.nl;
36+
} else {
37+
str += this.ws + '{' + this.nl;
38+
}
39+
3240

3341
// class body
3442
str += doBody(codegen, indent, this.indent, this.nl, node.body);
3543

3644
// end curly brace
37-
str += indent + '}\n';
45+
str += indent + '}';
46+
if (node.name) {
47+
str += this.nl;
48+
}
3849

3950
return str;
4051
};

node_translators/isset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
var params = require('./helper/parameters');
55

66
module.exports = function (node, indent) {
7-
return 'isset' + params(node.arguments, indent, this);
7+
return 'isset(' + params(node.arguments, indent, this) + ')';
88
};

node_translators/try.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ module.exports = function (node, indent) {
2828
return out;
2929
}, this).join('');
3030

31-
if (node.allways) {
31+
if (node.always) {
3232
str += this.ws + 'finally' + this.ws + '{' + this.nl;
33-
str += doBody(codegen, indent, this.indent, this.nl, node.allways.children);
33+
str += doBody(codegen, indent, this.indent, this.nl, node.always.children);
3434
str += indent + '}';
3535
}
3636

node_translators/unset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
var params = require('./helper/parameters');
55

66
module.exports = function (node, indent) {
7-
return 'unset' + params(node.arguments, indent, this);
7+
return 'unset(' + params(node.arguments, indent, this) + ')';
88
};

test/spec/acid1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function sparta() : ?int {
107107
} catch(Coco|Nut $ex) {
108108
$ex->printStackTrace();
109109
} finally {
110-
isset($bipbip, $ex) && unset($bipbip, $ex);
110+
if (isset($bipbip, $ex)) unset($bipbip, $ex);
111111
return (new class extends fooBar {
112112
function goatIt() {
113113
return "meeeh";

0 commit comments

Comments
 (0)