|
36 | 36 | import org.truffleruby.language.methods.Split;
|
37 | 37 | import org.truffleruby.language.Visibility;
|
38 | 38 | import org.truffleruby.language.arguments.MissingArgumentBehavior;
|
39 |
| -import org.truffleruby.language.arguments.NotProvidedNode; |
40 | 39 | import org.truffleruby.language.arguments.ReadBlockFromCurrentFrameArgumentsNode;
|
41 |
| -import org.truffleruby.language.arguments.ReadKeywordArgumentNode; |
42 | 40 | import org.truffleruby.language.arguments.ReadPreArgumentNode;
|
43 | 41 | import org.truffleruby.language.arguments.ReadRemainingArgumentsNode;
|
44 | 42 | import org.truffleruby.language.arguments.ReadSelfNode;
|
@@ -132,14 +130,7 @@ private void addCoreMethod(RubyModule module, MethodDetails methodDetails) {
|
132 | 130 | final Visibility visibility = annotation.visibility();
|
133 | 131 | verifyUsage(module, methodDetails, annotation, visibility);
|
134 | 132 |
|
135 |
| - final String keywordAsOptional = annotation.keywordAsOptional().isEmpty() |
136 |
| - ? null |
137 |
| - : annotation.keywordAsOptional(); |
138 |
| - final Arity arity = createArity( |
139 |
| - annotation.required(), |
140 |
| - annotation.optional(), |
141 |
| - annotation.rest(), |
142 |
| - keywordAsOptional); |
| 133 | + final Arity arity = new Arity(annotation.required(), annotation.optional(), annotation.rest()); |
143 | 134 | final NodeFactory<? extends RubyBaseNode> nodeFactory = methodDetails.getNodeFactory();
|
144 | 135 | final boolean onSingleton = annotation.onSingleton() || annotation.constructor();
|
145 | 136 | final boolean isModuleFunc = annotation.isModuleFunction();
|
@@ -173,11 +164,10 @@ public void addLazyCoreMethod(
|
173 | 164 | int required,
|
174 | 165 | int optional,
|
175 | 166 | boolean rest,
|
176 |
| - String keywordAsOptional, |
177 | 167 | String... names) {
|
178 | 168 |
|
179 | 169 | final RubyModule module = getModule(moduleName, isClass);
|
180 |
| - final Arity arity = createArity(required, optional, rest, keywordAsOptional); |
| 170 | + final Arity arity = new Arity(required, optional, rest); |
181 | 171 | final Split finalSplit;
|
182 | 172 | if (alwaysInlined) {
|
183 | 173 | finalSplit = Split.NEVER;
|
@@ -317,12 +307,6 @@ private static SharedMethodInfo makeSharedMethodInfo(String moduleName, boolean
|
317 | 307 | null);
|
318 | 308 | }
|
319 | 309 |
|
320 |
| - private static Arity createArity(int required, int optional, boolean rest, String keywordAsOptional) { |
321 |
| - return keywordAsOptional == null |
322 |
| - ? new Arity(required, optional, rest) |
323 |
| - : new Arity(required, optional, rest, 0, new String[]{ keywordAsOptional }, true, false); |
324 |
| - } |
325 |
| - |
326 | 310 | public RootCallTarget createCoreMethodRootNode(NodeFactory<? extends RubyBaseNode> nodeFactory,
|
327 | 311 | RubyLanguage language, SharedMethodInfo sharedMethodInfo, Split split, CoreMethod method) {
|
328 | 312 |
|
@@ -372,18 +356,6 @@ public RootCallTarget createCoreMethodRootNode(NodeFactory<? extends RubyBaseNod
|
372 | 356 | argumentsNodes[i++] = new ReadBlockFromCurrentFrameArgumentsNode();
|
373 | 357 | }
|
374 | 358 |
|
375 |
| - if (!method.keywordAsOptional().isEmpty()) { |
376 |
| - if (optional > 0) { |
377 |
| - throw new UnsupportedOperationException( |
378 |
| - "core method has been declared with both optional arguments and a keyword-as-optional argument"); |
379 |
| - } |
380 |
| - |
381 |
| - argumentsNodes[i++] = ReadKeywordArgumentNode.create( |
382 |
| - required, |
383 |
| - language.getSymbol(method.keywordAsOptional()), |
384 |
| - new NotProvidedNode()); |
385 |
| - } |
386 |
| - |
387 | 359 | RubyNode node = (RubyNode) createNodeFromFactory(nodeFactory, argumentsNodes);
|
388 | 360 | RubyNode methodNode = transformResult(method, node);
|
389 | 361 |
|
|
0 commit comments