org.mozilla.javascript.NativeArray.getTopLevelScope()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 JavaScript  
字(5.9k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.mozilla.javascript.NativeArray.getTopLevelScope()方法的一些代码示例,展示了NativeArray.getTopLevelScope()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NativeArray.getTopLevelScope()方法的具体详情如下:
包路径:org.mozilla.javascript.NativeArray
类名称:NativeArray
方法名:getTopLevelScope

NativeArray.getTopLevelScope介绍

暂无

代码示例

代码示例来源:origin: com.github.tntim96/rhino

private Scriptable js_slice(Context cx, Scriptable thisObj,
              Object[] args)
{
  Scriptable scope = getTopLevelScope(this);
  Scriptable result = cx.newArray(scope, 0);
  long length = getLengthProperty(cx, thisObj);
  long begin, end;
  if (args.length == 0) {
    begin = 0;
    end = length;
  } else {
    begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length);
    if (args.length == 1) {
      end = length;
    } else {
      end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length);
    }
  }
  for (long slot = begin; slot < end; slot++) {
    Object temp = getRawElem(thisObj, slot);
    if (temp != NOT_FOUND) {
      setElem(cx, result, slot - begin, temp);
    }
  }
  setLengthProperty(cx, result, Math.max(0, end - begin));
  return result;
}

代码示例来源:origin: geogebra/geogebra

private Scriptable js_slice(Context cx, Scriptable thisObj,
              Object[] args)
{
  Scriptable scope = getTopLevelScope(this);
  Scriptable result = cx.newArray(scope, 0);
  long length = getLengthProperty(cx, thisObj);
  long begin, end;
  if (args.length == 0) {
    begin = 0;
    end = length;
  } else {
    begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length);
    if (args.length == 1 || args[1] == Undefined.instance) {
      end = length;
    } else {
      end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length);
    }
  }
  for (long slot = begin; slot < end; slot++) {
    Object temp = getRawElem(thisObj, slot);
    if (temp != NOT_FOUND) {
      defineElem(cx, result, slot - begin, temp);
    }
  }
  setLengthProperty(cx, result, Math.max(0, end - begin));
  return result;
}

代码示例来源:origin: ro.isdc.wro4j/rhino

private Scriptable js_slice(Context cx, Scriptable thisObj,
              Object[] args)
{
  Scriptable scope = getTopLevelScope(this);
  Scriptable result = cx.newArray(scope, 0);
  long length = getLengthProperty(cx, thisObj);
  long begin, end;
  if (args.length == 0) {
    begin = 0;
    end = length;
  } else {
    begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length);
    if (args.length == 1) {
      end = length;
    } else {
      end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length);
    }
  }
  for (long slot = begin; slot < end; slot++) {
    Object temp = getRawElem(thisObj, slot);
    if (temp != NOT_FOUND) {
      setElem(cx, result, slot - begin, temp);
    }
  }
  setLengthProperty(cx, result, Math.max(0, end - begin));
  return result;
}

代码示例来源:origin: io.apigee/rhino

private Scriptable js_slice(Context cx, Scriptable thisObj,
              Object[] args)
{
  Scriptable scope = getTopLevelScope(this);
  Scriptable result = cx.newArray(scope, 0);
  long length = getLengthProperty(cx, thisObj);
  long begin, end;
  if (args.length == 0) {
    begin = 0;
    end = length;
  } else {
    begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length);
    if (args.length == 1 || args[1] == Undefined.instance) {
      end = length;
    } else {
      end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length);
    }
  }
  for (long slot = begin; slot < end; slot++) {
    Object temp = getRawElem(thisObj, slot);
    if (temp != NOT_FOUND) {
      defineElem(cx, result, slot - begin, temp);
    }
  }
  setLengthProperty(cx, result, Math.max(0, end - begin));
  return result;
}

代码示例来源:origin: rhino/js

private Scriptable js_slice(Context cx, Scriptable thisObj,
              Object[] args)
{
  Scriptable scope = getTopLevelScope(this);
  Scriptable result = ScriptRuntime.newObject(cx, scope, "Array", null);
  long length = getLengthProperty(cx, thisObj);
  long begin, end;
  if (args.length == 0) {
    begin = 0;
    end = length;
  } else {
    begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length);
    if (args.length == 1) {
      end = length;
    } else {
      end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length);
    }
  }
  for (long slot = begin; slot < end; slot++) {
    Object temp = getElem(cx, thisObj, slot);
    setElem(cx, result, slot - begin, temp);
  }
  return result;
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

private Scriptable js_slice(Context cx, Scriptable thisObj,
              Object[] args)
{
  Scriptable scope = getTopLevelScope(this);
  Scriptable result = ScriptRuntime.newObject(cx, scope, "Array", null);
  long length = getLengthProperty(cx, thisObj);
  long begin, end;
  if (args.length == 0) {
    begin = 0;
    end = length;
  } else {
    begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length);
    if (args.length == 1) {
      end = length;
    } else {
      end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length);
    }
  }
  for (long slot = begin; slot < end; slot++) {
    Object temp = getElem(cx, thisObj, slot);
    setElem(cx, result, slot - begin, temp);
  }
  return result;
}

代码示例来源:origin: rhino/js

scope = getTopLevelScope(scope);
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array");
Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs);

代码示例来源:origin: io.apigee/rhino

scope = getTopLevelScope(scope);
Scriptable result = cx.newArray(scope, 0);
if (thisObj instanceof NativeArray && result instanceof NativeArray) {

代码示例来源:origin: ro.isdc.wro4j/rhino

scope = getTopLevelScope(scope);
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array");
Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs);

代码示例来源:origin: geogebra/geogebra

scope = getTopLevelScope(scope);
Scriptable result = cx.newArray(scope, 0);
if (thisObj instanceof NativeArray && result instanceof NativeArray) {

代码示例来源:origin: rhino/js

scope = getTopLevelScope(scope);
int argc = args.length;
if (argc == 0)

代码示例来源:origin: com.github.tntim96/rhino

scope = getTopLevelScope(scope);
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array");
Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs);

代码示例来源:origin: ro.isdc.wro4j/rhino

scope = getTopLevelScope(scope);
int argc = args.length;
if (argc == 0)

代码示例来源:origin: geogebra/geogebra

scope = getTopLevelScope(scope);
int argc = args.length;
if (argc == 0)

代码示例来源:origin: com.github.tntim96/rhino

scope = getTopLevelScope(scope);
int argc = args.length;
if (argc == 0)

代码示例来源:origin: io.apigee/rhino

scope = getTopLevelScope(scope);
int argc = args.length;
if (argc == 0)

代码示例来源:origin: com.sun.phobos/phobos-rhino

scope = getTopLevelScope(scope);
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array");
Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs);

代码示例来源:origin: com.sun.phobos/phobos-rhino

scope = getTopLevelScope(scope);
Object result = ScriptRuntime.newObject(cx, scope, "Array", null);
int argc = args.length;

相关文章

微信公众号