зеркало из https://github.com/github/ruby.git
[ruby/yarp] Constants on keyword rest parameters
https://github.com/ruby/yarp/commit/5e1a8fbc54
This commit is contained in:
Родитель
9e21b33ece
Коммит
3f78eec44a
|
@ -742,7 +742,7 @@ module YARP
|
|||
[],
|
||||
nil,
|
||||
[KeywordParameterNode(:b, Location(), nil)],
|
||||
KeywordRestParameterNode(Location(), Location()),
|
||||
KeywordRestParameterNode(:rest, Location(), Location()),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
@ -789,7 +789,7 @@ module YARP
|
|||
[RequiredParameterNode(:a)],
|
||||
nil,
|
||||
[KeywordParameterNode(:b, Location(), nil)],
|
||||
KeywordRestParameterNode(Location(), Location()),
|
||||
KeywordRestParameterNode(:args, Location(), Location()),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
@ -818,7 +818,7 @@ module YARP
|
|||
[RequiredParameterNode(:a)],
|
||||
nil,
|
||||
[KeywordParameterNode(:b, Location(), nil)],
|
||||
KeywordRestParameterNode(Location(), Location()),
|
||||
KeywordRestParameterNode(:args, Location(), Location()),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
@ -847,7 +847,7 @@ module YARP
|
|||
[RequiredParameterNode(:a)],
|
||||
nil,
|
||||
[KeywordParameterNode(:b, Location(), nil)],
|
||||
KeywordRestParameterNode(Location(), Location()),
|
||||
KeywordRestParameterNode(:args, Location(), Location()),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
@ -1065,7 +1065,7 @@ module YARP
|
|||
expected = DefNode(
|
||||
Location(),
|
||||
nil,
|
||||
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], [], nil, [], KeywordRestParameterNode(Location(), Location()), nil),
|
||||
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], [], nil, [], KeywordRestParameterNode(:a, Location(), Location()), nil),
|
||||
nil,
|
||||
[:a, :b],
|
||||
Location(),
|
||||
|
|
|
@ -262,7 +262,7 @@ ProgramNode(0...1194)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(250...253)((250...252), (252...253)),
|
||||
KeywordRestParameterNode(250...253)(:b, (252...253), (250...252)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
@ -283,7 +283,7 @@ ProgramNode(0...1194)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(266...268)((266...268), nil),
|
||||
KeywordRestParameterNode(266...268)(nil, nil, (266...268)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -115,7 +115,7 @@ ProgramNode(0...434)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(110...113)((110...112), (112...113)),
|
||||
KeywordRestParameterNode(110...113)(:b, (112...113), (110...112)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -119,7 +119,7 @@ ProgramNode(0...266)(
|
|||
RestParameterNode(145...147)((145...146), (146...147)),
|
||||
[KeywordParameterNode(149...151)(:d, (149...151), nil),
|
||||
KeywordParameterNode(153...155)(:e, (153...155), nil)],
|
||||
KeywordRestParameterNode(157...160)((157...159), (159...160)),
|
||||
KeywordRestParameterNode(157...160)(:f, (159...160), (157...159)),
|
||||
BlockParameterNode(162...164)(:g, (163...164), (162...163))
|
||||
),
|
||||
[],
|
||||
|
@ -146,7 +146,7 @@ ProgramNode(0...266)(
|
|||
RestParameterNode(187...189)((187...188), (188...189)),
|
||||
[KeywordParameterNode(191...193)(:d, (191...193), nil),
|
||||
KeywordParameterNode(195...197)(:e, (195...197), nil)],
|
||||
KeywordRestParameterNode(199...202)((199...201), (201...202)),
|
||||
KeywordRestParameterNode(199...202)(:f, (201...202), (199...201)),
|
||||
BlockParameterNode(204...206)(:g, (205...206), (204...205))
|
||||
),
|
||||
[],
|
||||
|
|
|
@ -17,7 +17,7 @@ ProgramNode(0...11)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(5...8)((5...7), (7...8)),
|
||||
KeywordRestParameterNode(5...8)(:b, (7...8), (5...7)),
|
||||
nil
|
||||
),
|
||||
[],
|
||||
|
|
|
@ -17,7 +17,7 @@ ProgramNode(0...23)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(5...13)((5...7), (7...13)),
|
||||
KeywordRestParameterNode(5...13)(:kwargs, (7...13), (5...7)),
|
||||
nil
|
||||
),
|
||||
[],
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...45)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(9...18)((9...11), (11...18)),
|
||||
KeywordRestParameterNode(9...18)(:testing, (11...18), (9...11)),
|
||||
nil
|
||||
),
|
||||
StatementsNode(20...41)(
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...20)(
|
|||
[],
|
||||
nil,
|
||||
[KeywordParameterNode(6...10)(:b, (6...8), IntegerNode(9...10)())],
|
||||
KeywordRestParameterNode(12...15)((12...14), (14...15)),
|
||||
KeywordRestParameterNode(12...15)(:c, (14...15), (12...14)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...19)(
|
|||
[],
|
||||
nil,
|
||||
[KeywordParameterNode(6...10)(:b, (6...8), IntegerNode(9...10)())],
|
||||
KeywordRestParameterNode(12...14)((12...14), nil),
|
||||
KeywordRestParameterNode(12...14)(nil, nil, (12...14)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...17)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(6...12)((6...8), (8...12)),
|
||||
KeywordRestParameterNode(6...12)(:opts, (8...12), (6...8)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -17,7 +17,7 @@ ProgramNode(0...17)(
|
|||
[],
|
||||
nil,
|
||||
[KeywordParameterNode(5...9)(:b, (5...7), IntegerNode(8...9)())],
|
||||
KeywordRestParameterNode(11...14)((11...13), (13...14)),
|
||||
KeywordRestParameterNode(11...14)(:c, (13...14), (11...13)),
|
||||
nil
|
||||
),
|
||||
[],
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...90)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(18...20)((18...20), nil),
|
||||
KeywordRestParameterNode(18...20)(nil, nil, (18...20)),
|
||||
nil
|
||||
),
|
||||
StatementsNode(24...41)(
|
||||
|
|
|
@ -340,7 +340,7 @@ ProgramNode(0...690)(
|
|||
(269...273),
|
||||
IntegerNode(274...275)()
|
||||
)],
|
||||
KeywordRestParameterNode(277...282)((277...279), (279...282)),
|
||||
KeywordRestParameterNode(277...282)(:baz, (279...282), (277...279)),
|
||||
BlockParameterNode(284...286)(:b, (285...286), (284...285))
|
||||
),
|
||||
nil,
|
||||
|
@ -361,7 +361,7 @@ ProgramNode(0...690)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(300...305)((300...302), (302...305)),
|
||||
KeywordRestParameterNode(300...305)(:baz, (302...305), (300...302)),
|
||||
BlockParameterNode(307...309)(:b, (308...309), (307...308))
|
||||
),
|
||||
nil,
|
||||
|
@ -382,7 +382,7 @@ ProgramNode(0...690)(
|
|||
[],
|
||||
RestParameterNode(322...323)((322...323), nil),
|
||||
[],
|
||||
KeywordRestParameterNode(325...327)((325...327), nil),
|
||||
KeywordRestParameterNode(325...327)(nil, nil, (325...327)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -75,7 +75,7 @@ ProgramNode(0...550)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(32...37)((32...34), (34...37)),
|
||||
KeywordRestParameterNode(32...37)(:baz, (34...37), (32...34)),
|
||||
BlockParameterNode(39...41)(:b, (40...41), (39...40))
|
||||
),
|
||||
[],
|
||||
|
@ -850,7 +850,11 @@ ProgramNode(0...550)(
|
|||
(430...434),
|
||||
IntegerNode(435...436)()
|
||||
)],
|
||||
KeywordRestParameterNode(438...443)((438...440), (440...443)),
|
||||
KeywordRestParameterNode(438...443)(
|
||||
:baz,
|
||||
(440...443),
|
||||
(438...440)
|
||||
),
|
||||
BlockParameterNode(445...447)(:b, (446...447), (445...446))
|
||||
),
|
||||
[],
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...45)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(18...20)((18...20), nil),
|
||||
KeywordRestParameterNode(18...20)(nil, nil, (18...20)),
|
||||
nil
|
||||
),
|
||||
StatementsNode(23...40)(
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...25)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(8...10)((8...10), nil),
|
||||
KeywordRestParameterNode(8...10)(nil, nil, (8...10)),
|
||||
nil
|
||||
),
|
||||
StatementsNode(13...20)(
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...41)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(8...10)((8...10), nil),
|
||||
KeywordRestParameterNode(8...10)(nil, nil, (8...10)),
|
||||
nil
|
||||
),
|
||||
StatementsNode(13...36)(
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...28)(
|
|||
[],
|
||||
nil,
|
||||
[KeywordParameterNode(6...12)(:a, (6...8), NilNode(9...12)())],
|
||||
KeywordRestParameterNode(14...16)((14...16), nil),
|
||||
KeywordRestParameterNode(14...16)(nil, nil, (14...16)),
|
||||
nil
|
||||
),
|
||||
StatementsNode(19...24)(
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...17)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(6...11)((6...8), (8...11)),
|
||||
KeywordRestParameterNode(6...11)(:foo, (8...11), (6...8)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -10,7 +10,7 @@ ProgramNode(0...14)(
|
|||
[],
|
||||
nil,
|
||||
[],
|
||||
KeywordRestParameterNode(6...8)((6...8), nil),
|
||||
KeywordRestParameterNode(6...8)(nil, nil, (6...8)),
|
||||
nil
|
||||
),
|
||||
nil,
|
||||
|
|
|
@ -1574,10 +1574,12 @@ nodes:
|
|||
end
|
||||
- name: KeywordRestParameterNode
|
||||
fields:
|
||||
- name: operator_loc
|
||||
type: location
|
||||
- name: name
|
||||
type: constant?
|
||||
- name: name_loc
|
||||
type: location?
|
||||
- name: operator_loc
|
||||
type: location
|
||||
comment: |
|
||||
Represents a keyword rest parameter to a method, block, or lambda definition.
|
||||
|
||||
|
|
|
@ -3088,8 +3088,9 @@ yp_keyword_rest_parameter_node_create(yp_parser_t *parser, const yp_token_t *ope
|
|||
.end = (name->type == YP_TOKEN_NOT_PROVIDED ? operator->end : name->end)
|
||||
},
|
||||
},
|
||||
.operator_loc = YP_LOCATION_TOKEN_VALUE(operator),
|
||||
.name_loc = YP_OPTIONAL_LOCATION_TOKEN_VALUE(name)
|
||||
.name = yp_parser_optional_constant_id_token(parser, name),
|
||||
.name_loc = YP_OPTIONAL_LOCATION_TOKEN_VALUE(name),
|
||||
.operator_loc = YP_LOCATION_TOKEN_VALUE(operator)
|
||||
};
|
||||
|
||||
return node;
|
||||
|
|
Загрузка…
Ссылка в новой задаче