Skip to content

Commit 9900266

Browse files
committed
Add Truffle::Interop methods for the new InteropLibrary#{hasMetaParents,getMetaParents}
1 parent f8a5cc3 commit 9900266

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/main/java/org/truffleruby/interop/InteropNodes.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,29 @@ protected Object getMetaQualifiedName(Object metaObject,
19971997
}
19981998
}
19991999
}
2000+
2001+
@CoreMethod(names = "has_meta_parents?", onSingleton = true, required = 1)
2002+
public abstract static class HasMetaParentsNode extends CoreMethodArrayArgumentsNode {
2003+
@Specialization(limit = "getInteropCacheLimit()")
2004+
protected boolean hasMetaParents(Object receiver,
2005+
@CachedLibrary("receiver") InteropLibrary interop) {
2006+
return interop.hasMetaParents(receiver);
2007+
}
2008+
}
2009+
2010+
@CoreMethod(names = "meta_parents", onSingleton = true, required = 1)
2011+
public abstract static class GetMetaParentsNode extends CoreMethodArrayArgumentsNode {
2012+
@Specialization(limit = "getInteropCacheLimit()")
2013+
protected Object getMetaParents(Object value,
2014+
@CachedLibrary("value") InteropLibrary interop,
2015+
@Cached TranslateInteropExceptionNode translateInteropException) {
2016+
try {
2017+
return interop.getMetaParents(value);
2018+
} catch (UnsupportedMessageException e) {
2019+
throw translateInteropException.execute(e);
2020+
}
2021+
}
2022+
}
20002023
// endregion
20012024

20022025
// region Hash entries

0 commit comments

Comments
 (0)