[#82] property type

This commit is contained in:
z7zmey
2019-12-29 16:36:56 +02:00
parent 7b4c72a3af
commit dc7aa7302d
10 changed files with 715 additions and 574 deletions

View File

@@ -2888,6 +2888,12 @@ func (p *Printer) printStmtPropertyList(n node.Node) {
p.Print(m)
}
if nn.Type != nil && nn.Type.GetFreeFloating().IsEmpty() {
io.WriteString(p.w, " ")
}
p.Print(nn.Type)
if nn.Properties[0].GetFreeFloating().IsEmpty() {
io.WriteString(p.w, " ")
}

View File

@@ -1256,7 +1256,7 @@ func TestParseAndPrintPropertyList(t *testing.T) {
class Foo {
var $a = '' , $b = null ;
private $c ;
public static $d ;
public static Bar $d ;
}`

View File

@@ -3928,6 +3928,13 @@ func TestPrinterPrintPropertyList(t *testing.T) {
&node.Identifier{Value: "public"},
&node.Identifier{Value: "static"},
},
Type: &name.Name{
Parts: []node.Node{
&name.NamePart{
Value: "Foo",
},
},
},
Properties: []node.Node{
&stmt.Property{
Variable: &expr.Variable{
@@ -3943,7 +3950,7 @@ func TestPrinterPrintPropertyList(t *testing.T) {
},
})
expected := `public static $a='a',$b;`
expected := `public static Foo $a='a',$b;`
actual := o.String()
if expected != actual {