remove meta.ThrowToken

This commit is contained in:
z7zmey 2018-10-29 15:01:32 +02:00
parent 14cfed2e03
commit 5382ec090c
8 changed files with 7 additions and 9 deletions

View File

@ -21,7 +21,6 @@ const (
FunctionToken
ConstToken
TryToken
ThrowToken
InsteadofToken
VarToken
UnsetToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenTryTokenThrowTokenInsteadofTokenVarTokenUnsetTokenClassTokenTraitTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenFunctionTokenConstTokenTryTokenInsteadofTokenVarTokenUnsetTokenClassTokenTraitTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 58, 71, 92, 113, 124, 139, 154, 161, 175, 188, 198, 206, 216, 230, 238, 248, 258, 268, 280, 295, 311, 324, 338, 362, 388, 404, 417, 431, 446, 461, 476, 486, 499, 509, 521, 535, 546, 554, 562, 581, 594, 608, 622, 637, 650, 663, 676, 692, 705, 718, 730, 743, 755, 767, 781, 796, 804, 811, 818, 834, 853, 865, 880, 901, 922, 940, 960, 981, 995, 1005, 1025, 1046, 1063, 1081, 1098, 1112, 1122, 1131, 1141, 1157, 1167, 1177, 1190, 1200, 1212, 1221, 1233, 1241}
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 58, 71, 92, 113, 124, 139, 154, 161, 175, 188, 198, 206, 220, 228, 238, 248, 258, 270, 285, 301, 314, 328, 352, 378, 394, 407, 421, 436, 451, 466, 476, 489, 499, 511, 525, 536, 544, 552, 571, 584, 598, 612, 627, 640, 653, 666, 682, 695, 708, 720, 733, 745, 757, 771, 786, 794, 801, 808, 824, 843, 855, 870, 891, 912, 930, 950, 971, 985, 995, 1015, 1036, 1053, 1071, 1088, 1102, 1112, 1121, 1131, 1147, 1157, 1167, 1180, 1190, 1202, 1211, 1223, 1231}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -3490,7 +3490,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.ThrowToken).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

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

View File

@ -3627,7 +3627,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.ThrowToken).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

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

View File

@ -2517,7 +2517,6 @@ func (p *Printer) printStmtThrow(n node.Node) {
nn := n.(*stmt.Throw)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.ThrowToken)
io.WriteString(p.w, "throw")
p.Print(nn.Expr)
p.printMeta(nn, meta.SemiColonToken)

View File

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