#70: [php7] fix inheriting meta.Data at stmt.GroupUse, stmt.Use

This commit is contained in:
z7zmey 2019-01-02 23:21:09 +02:00
parent 4abd14d2a6
commit b5ff3ac2f7
2 changed files with 387 additions and 385 deletions

File diff suppressed because it is too large Load Diff

View File

@ -661,8 +661,9 @@ group_use_declaration:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
// save comments // save comments
$1.Meta.SetTokenName(meta.UseLeadingNsSeparatorToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.UseLeadingNsSeparatorToken) yylex.(*Parser).appendMetaToken(name, $1, meta.NodeStart)
$2[0].GetMeta().Cut(newInheritMetaFilter()).AppendTo(name.GetMeta())
$3.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta()) $3.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta()) $4.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
if $6 != nil { if $6 != nil {
@ -671,8 +672,6 @@ group_use_declaration:
} }
$7.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta()) $7.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
$2[0].GetMeta().Cut(newInheritMetaFilter()).PrependTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }
; ;
@ -710,8 +709,9 @@ mixed_group_use_declaration:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
// save comments // save comments
$1.Meta.SetTokenName(meta.UseLeadingNsSeparatorToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.UseLeadingNsSeparatorToken) yylex.(*Parser).appendMetaToken(name, $1, meta.NodeStart)
$2[0].GetMeta().Cut(newInheritMetaFilter()).AppendTo(name.GetMeta())
$3.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta()) $3.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta()) $4.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
if $6 != nil { if $6 != nil {
@ -861,6 +861,7 @@ use_declaration:
// save comments // save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart) yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.(*stmt.Use).Use.GetMeta().Cut(newInheritMetaFilter()).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }