Skip to content

Commit 078efef

Browse files
Removing annotation processor support for State argument
1 parent f4a4fec commit 078efef

File tree

3 files changed

+6
-42
lines changed

3 files changed

+6
-42
lines changed

engine/interpreter-dsl-test/src/test/java/org/enso/interpreter/dsl/test/InliningBuiltinsTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void executeWithoutVirtualFrame() {
3737
return call.call(
3838
frame,
3939
Function.ArgumentsHelper.buildArguments(
40-
null, null, new Object[] {null, 5L, 7L}));
40+
null, new Object[] {null, 5L, 7L}));
4141
});
4242
assertEquals(12L, res);
4343
} else {
@@ -70,7 +70,7 @@ public void executeWithVirtualFrame() {
7070
(frame) -> {
7171
return call.call(
7272
Function.ArgumentsHelper.buildArguments(
73-
null, null, new Object[] {null, 3L, 9L}));
73+
null, new Object[] {null, 3L, 9L}));
7474
});
7575
assertEquals(12L, res);
7676
}
@@ -101,7 +101,7 @@ public void executeWhenNeedsVirtualFrame() {
101101
(frame) -> {
102102
return call.call(
103103
Function.ArgumentsHelper.buildArguments(
104-
null, null, new Object[] {null, 3L, 9L}));
104+
null, new Object[] {null, 3L, 9L}));
105105
});
106106
assertEquals(12L, res);
107107
}
@@ -134,7 +134,7 @@ public void executeWhenNeedNotVirtualFrame() {
134134
return call.call(
135135
frame,
136136
Function.ArgumentsHelper.buildArguments(
137-
null, null, new Object[] {null, 5L, 7L}));
137+
null, new Object[] {null, 5L, 7L}));
138138
});
139139
assertEquals(12L, res);
140140
} else {

lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,7 @@ private void generateCode(MethodDefinition methodDefinition) throws IOException
341341
" Object[] arguments = Function.ArgumentsHelper.getPositionalArguments(args);");
342342
List<String> callArgNames = new ArrayList<>();
343343
for (MethodDefinition.ArgumentDefinition arg : methodDefinition.getArguments()) {
344-
if (!(arg.isImplicit()
345-
|| arg.isFrame()
346-
|| arg.isState()
347-
|| arg.isCallerInfo()
348-
|| arg.isNode())) {
344+
if (!(arg.isImplicit() || arg.isFrame() || arg.isCallerInfo() || arg.isNode())) {
349345
out.println(
350346
" int arg" + arg.getPosition() + "Idx = " + arg.getPosition() + " + prefix;");
351347
}
@@ -359,8 +355,6 @@ private void generateCode(MethodDefinition methodDefinition) throws IOException
359355
+ argumentDefinition.getPosition()
360356
+ " ***/");
361357
if (argumentDefinition.isImplicit()) {
362-
} else if (argumentDefinition.isState()) {
363-
callArgNames.add("/* state */");
364358
} else if (argumentDefinition.isFrame()) {
365359
callArgNames.add("frame");
366360
} else if (argumentDefinition.isNode()) {

lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/model/MethodDefinition.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,6 @@ public interface ArgumentDefinition {
278278

279279
boolean validate(ProcessingEnvironment processingEnvironment);
280280

281-
/**
282-
* @return whether this argument should be passed the monadic state.
283-
*/
284-
boolean isState();
285-
286281
/**
287282
* @return whether this argument should be passed the execution frame.
288283
*/
@@ -366,11 +361,6 @@ public boolean validate(ProcessingEnvironment processingEnvironment) {
366361
return true;
367362
}
368363

369-
@Override
370-
public boolean isState() {
371-
return false;
372-
}
373-
374364
@Override
375365
public boolean isFrame() {
376366
return false;
@@ -477,11 +467,9 @@ public static class ArgumentDefinitionFromParameter implements ArgumentDefinitio
477467
private static final String DATAFLOW_ERROR = "org.enso.interpreter.runtime.error.DataflowError";
478468
private static final String SELF = "self";
479469

480-
private static final String STATE = "org.enso.interpreter.runtime.state.State";
481470
private final String typeName;
482471
private final TypeMirror type;
483472
private final String name;
484-
private final boolean isState;
485473
private final boolean isNode;
486474
private final boolean isFrame;
487475
private final boolean isCallerInfo;
@@ -503,7 +491,6 @@ public ArgumentDefinitionFromParameter(VariableElement element, int position) {
503491
String[] typeNameSegments = type.toString().split("\\.");
504492
typeName = typeNameSegments[typeNameSegments.length - 1];
505493
name = element.getSimpleName().toString();
506-
isState = type.toString().equals(STATE);
507494
isSuspended = element.getAnnotation(Suspend.class) != null;
508495
acceptsError =
509496
(element.getAnnotation(AcceptsError.class) != null)
@@ -546,26 +533,9 @@ public boolean validate(ProcessingEnvironment processingEnvironment) {
546533
return false;
547534
}
548535

549-
if (isState() && !type.toString().equals(STATE)) {
550-
processingEnvironment
551-
.getMessager()
552-
.printMessage(
553-
Diagnostic.Kind.ERROR,
554-
"The monadic state argument must be typed as " + STATE,
555-
element);
556-
return false;
557-
}
558-
559536
return true;
560537
}
561538

562-
/**
563-
* @return whether this argument should be passed the monadic state.
564-
*/
565-
public boolean isState() {
566-
return isState;
567-
}
568-
569539
/**
570540
* @return whether this argument should be passed the execution frame.
571541
*/
@@ -591,7 +561,7 @@ public boolean isCallerInfo() {
591561
* @return whether this argument should be passed the next positional function argument.
592562
*/
593563
public boolean isPositional() {
594-
return !isFrame() && !isState() && !isCallerInfo() && !isNode();
564+
return !isFrame() && !isCallerInfo() && !isNode();
595565
}
596566

597567
/**

0 commit comments

Comments
 (0)