replace meta.ConstToken

This commit is contained in:
z7zmey 2018-10-29 13:25:46 +02:00
parent db3058a72f
commit d99c11c889
6 changed files with 5 additions and 6 deletions

View File

@ -2866,7 +2866,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, constList))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.ConstToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.EqualToken).AppendTo(constant.GetMeta())

View File

@ -774,7 +774,7 @@ constant_declaration:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, constList))
// save comments
$1.Meta.SetTokenName(meta.ConstToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$3.Meta.SetTokenName(meta.EqualToken).AppendTo(constant.GetMeta())

View File

@ -2869,7 +2869,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.ConstToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.SemiColonToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)

View File

@ -590,7 +590,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.ConstToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)

View File

@ -2013,7 +2013,6 @@ func (p *Printer) printStmtConstList(n node.Node) {
nn := n.(*stmt.ConstList)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.ConstToken)
io.WriteString(p.w, "const")
p.joinPrint(",", nn.Consts)

View File

@ -6057,7 +6057,7 @@ func TestPrinterPrintStmtConstList(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.ConstToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,