remove meta.QuestionMarkToken from node.Nullable

This commit is contained in:
z7zmey 2018-10-25 12:56:50 +03:00
parent d232d3ae6b
commit aa9fb90138
4 changed files with 3 additions and 5 deletions

View File

@ -4581,7 +4581,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.QuestionMarkToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -2197,7 +2197,7 @@ type_expr:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.QuestionMarkToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -465,8 +465,6 @@ func (p *Printer) printNodeNullable(n node.Node) {
nn := n.(*node.Nullable)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.QuestionMarkToken)
io.WriteString(p.w, "?")
p.Print(nn.Expr)

View File

@ -217,7 +217,7 @@ func TestPrinterPrintNullable(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.QuestionMarkToken,
TokenName: meta.NodeStart,
},
},
Expr: &node.Parameter{