Make sure isDate and asDate messages are properly propagated

This commit is contained in:
Jaroslav Tulach 2022-07-01 18:29:41 +02:00 committed by James Dunkerley
parent 1225591cd7
commit d063b6617f

View File

@ -15,6 +15,7 @@ import com.oracle.truffle.api.library.CachedLibrary;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.library.ExportMessage;
import com.oracle.truffle.api.profiles.BranchProfile;
import java.time.LocalDate;
import org.enso.interpreter.epb.node.ContextRewrapExceptionNode;
import org.enso.interpreter.epb.node.ContextRewrapNode;
@ -909,4 +910,29 @@ public class PolyglotProxy implements TruffleObject {
leaveOrigin(node, p);
}
}
@ExportMessage
boolean isDate(
@CachedLibrary("this.delegate") InteropLibrary datum,
@CachedLibrary("this") InteropLibrary node) {
Object p = enterOrigin(node);
try {
return datum.isDate(delegate);
} finally {
leaveOrigin(node, p);
}
}
@ExportMessage
LocalDate asDate(
@CachedLibrary("this.delegate") InteropLibrary datume,
@CachedLibrary("this") InteropLibrary node)
throws UnsupportedMessageException {
Object p = enterOrigin(node);
try {
return datume.asDate(delegate);
} finally {
leaveOrigin(node, p);
}
}
}