@@ -1262,6 +1262,15 @@ private Object doImport(String name) {
1262
1262
// endregion
1263
1263
1264
1264
// region Language
1265
+ @ CoreMethod (names = "has_language?" , onSingleton = true , required = 1 )
1266
+ public abstract static class HasLanguageNode extends InteropCoreMethodArrayArgumentsNode {
1267
+ @ Specialization (limit = "getCacheLimit()" )
1268
+ protected boolean hasLanguage (Object receiver ,
1269
+ @ CachedLibrary ("receiver" ) InteropLibrary interop ) {
1270
+ return interop .hasLanguage (receiver );
1271
+ }
1272
+ }
1273
+
1265
1274
@ CoreMethod (names = "language" , onSingleton = true , required = 1 )
1266
1275
public abstract static class GetLanguageNode extends InteropCoreMethodArrayArgumentsNode {
1267
1276
@@ -1659,31 +1668,22 @@ protected int identityHashCode(Object value,
1659
1668
// endregion
1660
1669
1661
1670
// region Scope
1662
- @ Primitive (name = "current_scope" )
1663
- public abstract static class GetCurrentScopeNode extends PrimitiveArrayArgumentsNode {
1664
-
1665
- @ Specialization
1666
- protected Object getScope (VirtualFrame frame ,
1667
- @ CachedLibrary (limit = "1" ) NodeLibrary nodeLibrary ,
1668
- @ Cached TranslateInteropExceptionNode translateInteropException ) {
1669
- try {
1670
- return nodeLibrary .getScope (this , frame , true );
1671
- } catch (UnsupportedMessageException e ) {
1672
- throw translateInteropException .execute (e );
1673
- }
1671
+ @ CoreMethod (names = "scope?" , onSingleton = true , required = 1 )
1672
+ public abstract static class IsScopeNode extends InteropCoreMethodArrayArgumentsNode {
1673
+ @ Specialization (limit = "getCacheLimit()" )
1674
+ protected boolean isScope (Object receiver ,
1675
+ @ CachedLibrary ("receiver" ) InteropLibrary interop ) {
1676
+ return interop .isScope (receiver );
1674
1677
}
1675
-
1676
1678
}
1677
1679
1678
- @ Primitive (name = "top_scope" )
1679
- public abstract static class GetTopScopeNode extends PrimitiveArrayArgumentsNode {
1680
-
1681
- @ Specialization
1682
- protected Object getTopScope (
1683
- @ CachedContext (RubyLanguage .class ) RubyContext context ) {
1684
- return context .getTopScopeObject ();
1680
+ @ CoreMethod (names = "has_scope_parent?" , onSingleton = true , required = 1 )
1681
+ public abstract static class HasScopeParentNode extends InteropCoreMethodArrayArgumentsNode {
1682
+ @ Specialization (limit = "getCacheLimit()" )
1683
+ protected boolean hasScopeParent (Object receiver ,
1684
+ @ CachedLibrary ("receiver" ) InteropLibrary interop ) {
1685
+ return interop .hasScopeParent (receiver );
1685
1686
}
1686
-
1687
1687
}
1688
1688
1689
1689
@ CoreMethod (names = "scope_parent" , onSingleton = true , required = 1 )
@@ -1704,6 +1704,29 @@ protected Object getScope(Object scope,
1704
1704
}
1705
1705
}
1706
1706
}
1707
+
1708
+ @ Primitive (name = "current_scope" )
1709
+ public abstract static class GetCurrentScopeNode extends PrimitiveArrayArgumentsNode {
1710
+ @ Specialization
1711
+ protected Object getScope (VirtualFrame frame ,
1712
+ @ CachedLibrary (limit = "1" ) NodeLibrary nodeLibrary ,
1713
+ @ Cached TranslateInteropExceptionNode translateInteropException ) {
1714
+ try {
1715
+ return nodeLibrary .getScope (this , frame , true );
1716
+ } catch (UnsupportedMessageException e ) {
1717
+ throw translateInteropException .execute (e );
1718
+ }
1719
+ }
1720
+ }
1721
+
1722
+ @ Primitive (name = "top_scope" )
1723
+ public abstract static class GetTopScopeNode extends PrimitiveArrayArgumentsNode {
1724
+ @ Specialization
1725
+ protected Object getTopScope (
1726
+ @ CachedContext (RubyLanguage .class ) RubyContext context ) {
1727
+ return context .getTopScopeObject ();
1728
+ }
1729
+ }
1707
1730
// endregion scope
1708
1731
1709
1732
}
0 commit comments