replace meta.FunctionToken

This commit is contained in:
z7zmey 2018-10-29 13:42:50 +02:00
parent 8dc0845d63
commit 2866018474
7 changed files with 6 additions and 7 deletions

View File

@ -3707,7 +3707,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.FunctionToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
if yyDollar[2].token != nil {
yyDollar[2].token.Meta.SetTokenName(meta.AmpersandToken).AppendTo(yyVAL.node.GetMeta())
}

View File

@ -1553,7 +1553,7 @@ unticked_function_declaration_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $9))
// save comments
$1.Meta.SetTokenName(meta.FunctionToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
if $2 != nil {
$2.Meta.SetTokenName(meta.AmpersandToken).AppendTo($$.GetMeta())
}

View File

@ -3784,7 +3784,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[11].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.FunctionToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
if yyDollar[2].token != nil {
yyDollar[2].token.Meta.SetTokenName(meta.AmpersandToken).AppendTo(yyVAL.node.GetMeta())
}

View File

@ -1433,7 +1433,7 @@ function_declaration_statement:
// save comments
$1.Meta.SetTokenName(meta.FunctionToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
if $2 != nil {
$2.Meta.SetTokenName(meta.AmpersandToken).AppendTo($$.GetMeta())
}

View File

@ -2229,7 +2229,6 @@ func (p *Printer) printStmtFunction(n node.Node) {
nn := n.(*stmt.Function)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.FunctionToken)
io.WriteString(p.w, "function")
if nn.ReturnsRef {

View File

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

View File

@ -429,7 +429,7 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\n\n\t\t\t",
// "tokenName": "FunctionToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",