-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate BuiltinMethods from simple method and constructor signatures (…
…#3444) A low-hanging fruit where we can automate the generation of many @BuiltinMethod nodes simply from the runtime's methods signatures. This change introduces another annotation, @Builtin, to distinguish from @BuiltinType and @BuiltinMethod processing. @Builtin processing will always be the first stage of processing and its output will be fed to the latter. Note that the return type of Array.length() is changed from `int` to `long` because we probably don't want to add a ton of specializations for the former (see comparator nodes for details) and it is fine to cast it in a small number of places. Progress is visible in the number of deleted hardcoded classes. This is an incremental step towards #181499077. # Important Notes This process does not attempt to cover all cases. Not yet, at least. We only handle simple methods and constructors (see removed `Array` boilerplate methods).
- Loading branch information
Showing
15 changed files
with
341 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
...runtime/src/main/java/org/enso/interpreter/node/expression/builtin/mutable/EmptyNode.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...untime/src/main/java/org/enso/interpreter/node/expression/builtin/mutable/LengthNode.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...e/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/mutable/NewNode.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
...ntime/src/main/java/org/enso/interpreter/node/expression/builtin/mutable/ToArrayNode.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/Builtin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.enso.interpreter.dsl; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** An annotation denoting a method that will auto-generate a BuiltinMethod node. */ | ||
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||
@Retention(RetentionPolicy.SOURCE) | ||
public @interface Builtin { | ||
/** @return the name of the subpackage for the generated method node. */ | ||
String pkg() default ""; | ||
|
||
/** @return a custom name, by default it uses the name of the annotated element. */ | ||
String name() default ""; | ||
|
||
/** @return a short description of this method. */ | ||
String description() default ""; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.