JsVar *jspeiGetScopesAsVar() {
  if (execInfo.scopeCount==0)
    return 0;
  if (execInfo.scopeCount==1)
    return jsvLockAgain(execInfo.scopes[0]);

  JsVar *arr = jsvNewEmptyArray();
  int i;
  for (i=0;i<execInfo.scopeCount;i++) {
    JsVar *idx = jsvMakeIntoVariableName(jsvNewFromInteger(i), execInfo.scopes[i]);
    if (!idx) { // out of memory
      jspSetError(false);
      return arr;
    }
    jsvAddName(arr, idx);
    jsvUnLock(idx);
  }
  return arr;
}
JsVar *jspeiGetScopesAsVar() {
  if (execInfo.scopeCount==0)
    return 0;
  if (execInfo.scopeCount==1)
    return jsvLockAgain(execInfo.scopes[0]);

  JsVar *arr = jsvNewEmptyArray();
  int i;
  for (i=0;i<execInfo.scopeCount;i++) {
    JsVar *idx = jsvMakeIntoVariableName(jsvNewFromInteger(i), execInfo.scopes[i]);
    if (!idx) {  
      jspSetError(false);
      return arr;
    }
    jsvAddName(arr, idx);
    jsvUnLock(idx);
  }
  return arr;
}