-
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.
- Loading branch information
Showing
5 changed files
with
302 additions
and
14 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
engine/runtime-parser-processor/src/main/java/org/enso/runtime/parser/processor/Field.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,42 @@ | ||
package org.enso.runtime.parser.processor; | ||
|
||
import javax.lang.model.element.TypeElement; | ||
|
||
final class Field { | ||
private final TypeElement type; | ||
|
||
/** Name of the field (identifier). */ | ||
private final String name; | ||
|
||
/** If the field can be {@code null}. */ | ||
private final boolean nullable; | ||
|
||
private final boolean isChild; | ||
|
||
Field(TypeElement type, String name, boolean nullable, boolean isChild) { | ||
this.type = type; | ||
this.name = name; | ||
this.nullable = nullable; | ||
this.isChild = isChild; | ||
} | ||
|
||
boolean isChild() { | ||
return isChild; | ||
} | ||
|
||
boolean isNullable() { | ||
return nullable; | ||
} | ||
|
||
String getName() { | ||
return name; | ||
} | ||
|
||
String getSimpleTypeName() { | ||
return type.getSimpleName().toString(); | ||
} | ||
|
||
String getQualifiedTypeName() { | ||
return type.getQualifiedName().toString(); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
engine/runtime-parser-processor/src/main/java/org/enso/runtime/parser/processor/Utils.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,21 @@ | ||
package org.enso.runtime.parser.processor; | ||
|
||
import javax.annotation.processing.Messager; | ||
import javax.annotation.processing.ProcessingEnvironment; | ||
import javax.lang.model.element.Element; | ||
import javax.lang.model.type.TypeMirror; | ||
import javax.tools.Diagnostic.Kind; | ||
|
||
final class Utils { | ||
private Utils() {} | ||
|
||
static boolean isSubtypeOfIR(TypeMirror type, ProcessingEnvironment processingEnv) { | ||
var irType = | ||
processingEnv.getElementUtils().getTypeElement("org.enso.compiler.core.IR").asType(); | ||
return processingEnv.getTypeUtils().isAssignable(type, irType); | ||
} | ||
|
||
static void printError(String msg, Element elem, Messager messager) { | ||
messager.printMessage(Kind.ERROR, msg, elem); | ||
} | ||
} |
Oops, something went wrong.