[refactoring] update ast structure of "HaltCompiler" node
This commit is contained in:
@@ -2823,13 +2823,11 @@ func (p *Printer) printStmtGoto(n ast.Vertex) {
|
||||
p.printFreeFloating(nn, token.End)
|
||||
}
|
||||
|
||||
func (p *Printer) printStmtHaltCompiler(n ast.Vertex) {
|
||||
nn := n.(*ast.StmtHaltCompiler)
|
||||
p.printFreeFloating(nn, token.Start)
|
||||
|
||||
io.WriteString(p.w, "__halt_compiler")
|
||||
|
||||
p.printFreeFloatingOrDefault(nn, token.End, "();")
|
||||
func (p *Printer) printStmtHaltCompiler(n *ast.StmtHaltCompiler) {
|
||||
p.printToken(n.HaltCompilerTkn, "__halt_compiler")
|
||||
p.printToken(n.OpenParenthesisTkn, "(")
|
||||
p.printToken(n.CloseParenthesisTkn, ")")
|
||||
p.printToken(n.SemiColonTkn, ";")
|
||||
}
|
||||
|
||||
func (p *Printer) printStmtIf(n ast.Vertex) {
|
||||
|
||||
@@ -1049,7 +1049,8 @@ func TestParseAndPrintPhp5Goto(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseAndPrintPhp5HaltCompiler(t *testing.T) {
|
||||
src := `<?php
|
||||
// TODO: remove ; after <?php
|
||||
src := `<?php ;
|
||||
__halt_compiler ( ) ;
|
||||
this text is ignored by parser
|
||||
`
|
||||
|
||||
@@ -1182,7 +1182,8 @@ func TestParseAndPrintGroupUse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseAndPrintHaltCompiler(t *testing.T) {
|
||||
src := `<?php
|
||||
// TODO: remove ; after <?php
|
||||
src := `<?php ;
|
||||
__halt_compiler ( ) ;
|
||||
this text is ignored by parser
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user