File tree 1 file changed +15
-6
lines changed
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -144,14 +144,23 @@ def compile_keyword_args
144
144
145
145
if rest_arg
146
146
with_temp do |tmp |
147
- rest_arg_name = variable ( rest_arg [ 1 ] . to_sym )
148
- line "#{ tmp } = #{ rest_arg_name } [#{ rest_arg_name } .length - 1];"
149
- line "if (#{ tmp } == null || !#{ tmp } .$$is_hash) {"
147
+ rest_arg_name = variable ( rest_arg [ 1 ] . to_sym )
148
+ line "#{ tmp } = #{ rest_arg_name } [#{ rest_arg_name } .length - 1];"
149
+ line "if (#{ tmp } == null || !#{ tmp } .$$is_hash) {"
150
+ line " $kwargs = $hash2([], {});"
151
+ line "} else {"
152
+ line " $kwargs = #{ rest_arg_name } .pop();"
153
+ line "}"
154
+ end
155
+ elsif last_opt_arg = opt_args . last
156
+ opt_arg_name = variable ( last_opt_arg [ 1 ] )
157
+ line "if (#{ opt_arg_name } == null) {"
150
158
line " $kwargs = $hash2([], {});"
151
- line "} else {"
152
- line " $kwargs = #{ rest_arg_name } .pop();"
153
159
line "}"
154
- end
160
+ line "else if (#{ opt_arg_name } .$$is_hash) {"
161
+ line " $kwargs = #{ opt_arg_name } ;"
162
+ line " #{ opt_arg_name } = " , expr ( last_opt_arg [ 2 ] ) , ";"
163
+ line "}"
155
164
else
156
165
line "if ($kwargs == null) {"
157
166
line " $kwargs = $hash2([], {});"
You can’t perform that action at this time.
0 commit comments