本文整理汇总了Java中jdk.nashorn.internal.runtime.ScriptObject.getProto方法的典型用法代码示例。如果您正苦于以下问题:Java ScriptObject.getProto方法的具体用法?Java ScriptObject.getProto怎么用?Java ScriptObject.getProto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.runtime.ScriptObject
的用法示例。
在下文中一共展示了ScriptObject.getProto方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isPrototypeOf
import jdk.nashorn.internal.runtime.ScriptObject; //导入方法依赖的package包/类
/**
* ECMA 15.2.4.6 Object.prototype.isPrototypeOf (V)
*
* @param self self reference
* @param v v prototype object to check against
* @return true if object is prototype of v
*/
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static boolean isPrototypeOf(final Object self, final Object v) {
if (!(v instanceof ScriptObject)) {
return false;
}
final Object obj = Global.toObject(self);
ScriptObject proto = (ScriptObject)v;
do {
proto = proto.getProto();
if (proto == obj) {
return true;
}
} while (proto != null);
return false;
}
示例2: isError
import jdk.nashorn.internal.runtime.ScriptObject; //导入方法依赖的package包/类
/**
* Is the given ScriptObject an ECMAScript Error object?
*
* @param sobj the object being checked
* @return true if sobj is an Error object
*/
public boolean isError(final ScriptObject sobj) {
final ScriptObject errorProto = getErrorPrototype();
ScriptObject proto = sobj.getProto();
while (proto != null) {
if (proto == errorProto) {
return true;
}
proto = proto.getProto();
}
return false;
}
示例3: hasInheritedArrayEntries
import jdk.nashorn.internal.runtime.ScriptObject; //导入方法依赖的package包/类
private static boolean hasInheritedArrayEntries(final ScriptObject self) {
ScriptObject proto = self.getProto();
while (proto != null) {
if (proto.hasArrayEntries()) {
return true;
}
proto = proto.getProto();
}
return false;
}
示例4: get__proto__
import jdk.nashorn.internal.runtime.ScriptObject; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private static ScriptObject get__proto__(final Object self) {
// See ES6 draft spec: B.2.2.1.1 get Object.prototype.__proto__
// Step 1 Let O be the result of calling ToObject passing the this.
final ScriptObject sobj = Global.checkObject(Global.toObject(self));
return sobj.getProto();
}