зеркало из https://github.com/mozilla/gecko-dev.git
tabs -> spaces
This commit is contained in:
Родитель
a9ae7fee2a
Коммит
142bcdb900
|
@ -36,12 +36,12 @@
|
|||
package org.mozilla.javascript;
|
||||
|
||||
final class BinaryDigitReader {
|
||||
int lgBase; // Logarithm of base of number
|
||||
int digit; // Current digit value in radix given by base
|
||||
int digitPos; // Bit position of last bit extracted from digit
|
||||
String digits; // String containing the digits
|
||||
int start; // Index of the first remaining digit
|
||||
int end; // Index past the last remaining digit
|
||||
int lgBase; // Logarithm of base of number
|
||||
int digit; // Current digit value in radix given by base
|
||||
int digitPos; // Bit position of last bit extracted from digit
|
||||
String digits; // String containing the digits
|
||||
int start; // Index of the first remaining digit
|
||||
int end; // Index past the last remaining digit
|
||||
|
||||
BinaryDigitReader(int base, String digits, int start, int end) {
|
||||
lgBase = 0;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -142,7 +142,7 @@ public class JavaAdapter extends ScriptableObject {
|
|||
public static Object createAdapterClass(Class superClass,
|
||||
Class[] interfaces,
|
||||
Scriptable obj, Scriptable self)
|
||||
throws ClassNotFoundException
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
ClassSignature sig = new ClassSignature(superClass, interfaces, obj);
|
||||
Class adapterClass = (Class) generatedClasses.get(sig);
|
||||
|
|
|
@ -284,15 +284,15 @@ class JavaMembers {
|
|||
return;
|
||||
}
|
||||
if (member instanceof Field) {
|
||||
Field oldField = (Field) member;
|
||||
// If this newly reflected field shadows an inherited field,
|
||||
Field oldField = (Field) member;
|
||||
// If this newly reflected field shadows an inherited field,
|
||||
// then replace it. Otherwise, since access to the field
|
||||
// would be ambiguous from Java, no field should be reflected.
|
||||
// For now, the first field found wins, unless another field
|
||||
// For now, the first field found wins, unless another field
|
||||
// explicitly shadows it.
|
||||
if (oldField.getDeclaringClass().isAssignableFrom(field.getDeclaringClass()))
|
||||
ht.put(name, field);
|
||||
return;
|
||||
if (oldField.getDeclaringClass().isAssignableFrom(field.getDeclaringClass()))
|
||||
ht.put(name, field);
|
||||
return;
|
||||
}
|
||||
throw new RuntimeException("unknown member type");
|
||||
}
|
||||
|
|
|
@ -108,8 +108,8 @@ public class NativeJavaClass extends NativeJavaObject implements Function {
|
|||
throw members.reportMemberNotFound(name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void put(String name, Scriptable start, Object value) {
|
||||
|
@ -164,21 +164,21 @@ public class NativeJavaClass extends NativeJavaObject implements Function {
|
|||
public Scriptable construct(Context cx, Scriptable scope, Object[] args)
|
||||
throws JavaScriptException
|
||||
{
|
||||
Class classObject = getClassObject();
|
||||
int modifiers = classObject.getModifiers();
|
||||
if (! (Modifier.isInterface(modifiers) ||
|
||||
Class classObject = getClassObject();
|
||||
int modifiers = classObject.getModifiers();
|
||||
if (! (Modifier.isInterface(modifiers) ||
|
||||
Modifier.isAbstract(modifiers)))
|
||||
{
|
||||
Constructor[] ctors = members.getConstructors();
|
||||
Member member = NativeJavaMethod.findFunction(ctors, args);
|
||||
Constructor ctor = (Constructor) member;
|
||||
if (ctor == null) {
|
||||
String sig = NativeJavaMethod.scriptSignature(args);
|
||||
Constructor[] ctors = members.getConstructors();
|
||||
Member member = NativeJavaMethod.findFunction(ctors, args);
|
||||
Constructor ctor = (Constructor) member;
|
||||
if (ctor == null) {
|
||||
String sig = NativeJavaMethod.scriptSignature(args);
|
||||
throw Context.reportRuntimeError2(
|
||||
"msg.no.java.ctor", classObject.getName(), sig);
|
||||
}
|
||||
}
|
||||
|
||||
// Found the constructor, so try invoking it.
|
||||
// Found the constructor, so try invoking it.
|
||||
return NativeJavaClass.constructSpecific(cx, scope,
|
||||
this, ctor, args);
|
||||
} else {
|
||||
|
|
|
@ -130,7 +130,7 @@ public class NativeJavaObject implements Scriptable, Wrapper, Externalizable {
|
|||
}
|
||||
|
||||
public Scriptable getPrototype() {
|
||||
if (prototype == null && javaObject.getClass() == ScriptRuntime.StringClass) {
|
||||
if (prototype == null && javaObject.getClass() == ScriptRuntime.StringClass) {
|
||||
return ScriptableObject.getClassPrototype(parent, "String");
|
||||
}
|
||||
return prototype;
|
||||
|
@ -140,7 +140,7 @@ public class NativeJavaObject implements Scriptable, Wrapper, Externalizable {
|
|||
* Sets the prototype of the object.
|
||||
*/
|
||||
public void setPrototype(Scriptable m) {
|
||||
prototype = m;
|
||||
prototype = m;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
* Copyright (C) 2000 Matthias Radestock. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Redfig Ltd (http://www.redfig.com)
|
||||
* LShift Ltd (http://www.lshift.net)
|
||||
* Redfig Ltd (http://www.redfig.com)
|
||||
* LShift Ltd (http://www.lshift.net)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms
|
||||
* of the GNU Public License (the "GPL License"), in which case the
|
||||
|
@ -61,17 +61,18 @@ public class Synchronizer extends Delegator {
|
|||
* @param obj the existing function
|
||||
*/
|
||||
public Synchronizer(Scriptable obj) {
|
||||
super(obj);
|
||||
super(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.mozilla.javascript.Function#call
|
||||
*/
|
||||
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
|
||||
Object[] args)
|
||||
throws JavaScriptException {
|
||||
synchronized(thisObj) {
|
||||
return ((Function)obj).call(cx,scope,thisObj,args);
|
||||
}
|
||||
Object[] args)
|
||||
throws JavaScriptException
|
||||
{
|
||||
synchronized(thisObj) {
|
||||
return ((Function)obj).call(cx,scope,thisObj,args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -374,32 +374,32 @@ public class Block {
|
|||
switch (n.getType()) {
|
||||
case TokenStream.NUMBER : {
|
||||
/* distinguish between integers & f.p.s ?
|
||||
Number num = ((NumberNode)n).getNumber();
|
||||
if ((num instanceof Byte)
|
||||
|| (num instanceof Short)
|
||||
|| (num instanceof Integer)) {
|
||||
}
|
||||
else {
|
||||
}
|
||||
Number num = ((NumberNode)n).getNumber();
|
||||
if ((num instanceof Byte)
|
||||
|| (num instanceof Short)
|
||||
|| (num instanceof Integer)) {
|
||||
}
|
||||
else {
|
||||
}
|
||||
*/
|
||||
return TypeEvent.NumberType;
|
||||
}
|
||||
case TokenStream.NEW :
|
||||
case TokenStream.CALL :
|
||||
return TypeEvent.NoType;
|
||||
return TypeEvent.NumberType;
|
||||
}
|
||||
case TokenStream.NEW :
|
||||
case TokenStream.CALL :
|
||||
return TypeEvent.NoType;
|
||||
|
||||
case TokenStream.GETELEM :
|
||||
case TokenStream.GETELEM :
|
||||
return TypeEvent.AnyType;
|
||||
|
||||
case TokenStream.GETVAR : {
|
||||
case TokenStream.GETVAR : {
|
||||
OptLocalVariable theVar = (OptLocalVariable)
|
||||
(n.getProp(Node.VARIABLE_PROP));
|
||||
if (theVar != null)
|
||||
return theVar.getTypeUnion();
|
||||
}
|
||||
}
|
||||
|
||||
case TokenStream.INC :
|
||||
case TokenStream.DEC :
|
||||
case TokenStream.INC :
|
||||
case TokenStream.DEC :
|
||||
case TokenStream.DIV:
|
||||
case TokenStream.MOD:
|
||||
case TokenStream.BITOR:
|
||||
|
@ -409,7 +409,7 @@ public class Block {
|
|||
case TokenStream.RSH:
|
||||
case TokenStream.URSH:
|
||||
case TokenStream.SUB : {
|
||||
return TypeEvent.NumberType;
|
||||
return TypeEvent.NumberType;
|
||||
}
|
||||
case TokenStream.ADD : {
|
||||
// if the lhs & rhs are known to be numbers, we can be sure that's
|
||||
|
|
|
@ -450,7 +450,7 @@ public class NativeRegExp extends IdScriptable implements Function {
|
|||
case REOP_LPARENNON:
|
||||
System.out.println();
|
||||
dumpRegExp(state, (RENode) ren.kid);
|
||||
break;
|
||||
break;
|
||||
|
||||
case REOP_BACKREF:
|
||||
case REOP_RPAREN:
|
||||
|
@ -980,7 +980,7 @@ public class NativeRegExp extends IdScriptable implements Function {
|
|||
++index;
|
||||
op = REOP_DOT;
|
||||
if ((index < source.length) && (source[index] == '*')) {
|
||||
index++;
|
||||
index++;
|
||||
op = REOP_DOTSTAR;
|
||||
if ((index < source.length) && (source[index] == '?')) {
|
||||
index++;
|
||||
|
@ -1172,7 +1172,7 @@ public class NativeRegExp extends IdScriptable implements Function {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
index = ocp; /* \xZZ is xZZ (Perl does \0ZZ!) */
|
||||
index = ocp; /* \xZZ is xZZ (Perl does \0ZZ!) */
|
||||
num = 'x';
|
||||
}
|
||||
ren = new RENode(state, REOP_FLAT1, null);
|
||||
|
@ -1352,7 +1352,7 @@ public class NativeRegExp extends IdScriptable implements Function {
|
|||
int match;
|
||||
int num;
|
||||
|
||||
/*
|
||||
/*
|
||||
* when the kid match fails, we reset the parencount and run any
|
||||
* previously succesful kid in order to restablish it's paren
|
||||
* contents.
|
||||
|
@ -1521,7 +1521,7 @@ public class NativeRegExp extends IdScriptable implements Function {
|
|||
return -1;
|
||||
if (state.goForBroke && (state.complete != -1))
|
||||
return state.complete;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case REOP_PLUS: {
|
||||
|
@ -1552,7 +1552,7 @@ public class NativeRegExp extends IdScriptable implements Function {
|
|||
if (index == -1) return -1;
|
||||
}
|
||||
break;
|
||||
case REOP_STAR:
|
||||
case REOP_STAR:
|
||||
if ((ren.flags & RENode.MINIMAL) == 0) {
|
||||
int kidMatch = matchGreedyKid(state, ren, stop, 0, index, -1);
|
||||
if (kidMatch != -1) {
|
||||
|
@ -2465,7 +2465,7 @@ class RENode implements Serializable {
|
|||
n += NativeRegExp.unHex((char)c);
|
||||
}
|
||||
} else {
|
||||
index = ocp; /* \xZZ is xZZ (Perl does \0ZZ!) */
|
||||
index = ocp; /* \xZZ is xZZ (Perl does \0ZZ!) */
|
||||
n = 'x';
|
||||
}
|
||||
c = n;
|
||||
|
@ -2551,7 +2551,7 @@ class RENode implements Serializable {
|
|||
|
||||
|
||||
class MatchState {
|
||||
boolean inputExhausted; /* did we run out of input chars ? */
|
||||
boolean inputExhausted; /* did we run out of input chars ? */
|
||||
boolean anchoring; /* true if multiline anchoring ^/$ */
|
||||
int pcend; /* pc limit (fencepost) */
|
||||
int cpbegin, cpend; /* cp base address and limit */
|
||||
|
@ -2562,7 +2562,7 @@ class MatchState {
|
|||
SubString[] maybeParens; /* possible paren substring pointers */
|
||||
SubString[] parens; /* certain paren substring matches */
|
||||
Scriptable scope;
|
||||
char[] input;
|
||||
char[] input;
|
||||
boolean goForBroke; /* pursue any match to the end of the re */
|
||||
int complete; /* match acheived by attempted early completion */
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ msg.illegal.character =\
|
|||
illegal character
|
||||
|
||||
msg.invalid.escape =\
|
||||
invalid Unicode escape sequence
|
||||
invalid Unicode escape sequence
|
||||
|
||||
# TokensStream warnings
|
||||
msg.bad.octal.literal =\
|
||||
|
@ -510,8 +510,8 @@ msg.arraylength.bad =\
|
|||
|
||||
# URI
|
||||
msg.bad.uri =\
|
||||
Malformed URI sequence.
|
||||
Malformed URI sequence.
|
||||
|
||||
# Number
|
||||
msg.bad.precision =\
|
||||
Precision {0} out of range.
|
||||
Precision {0} out of range.
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -53,7 +53,7 @@ public class VariableModel extends AbstractTreeTableModel
|
|||
|
||||
|
||||
public VariableModel(Scriptable scope) {
|
||||
super(scope == null ? null : new VariableNode(scope, "this"));
|
||||
super(scope == null ? null : new VariableNode(scope, "this"));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -61,14 +61,14 @@ public class VariableModel extends AbstractTreeTableModel
|
|||
//
|
||||
|
||||
protected Object getObject(Object node) {
|
||||
VariableNode varNode = ((VariableNode)node);
|
||||
if(varNode == null) return null;
|
||||
return varNode.getObject();
|
||||
VariableNode varNode = ((VariableNode)node);
|
||||
if(varNode == null) return null;
|
||||
return varNode.getObject();
|
||||
}
|
||||
|
||||
protected Object[] getChildren(Object node) {
|
||||
VariableNode varNode = ((VariableNode)node);
|
||||
return varNode.getChildren();
|
||||
VariableNode varNode = ((VariableNode)node);
|
||||
return varNode.getChildren();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -76,27 +76,27 @@ public class VariableModel extends AbstractTreeTableModel
|
|||
//
|
||||
|
||||
public int getChildCount(Object node) {
|
||||
Object[] children = getChildren(node);
|
||||
return (children == null) ? 0 : children.length;
|
||||
Object[] children = getChildren(node);
|
||||
return (children == null) ? 0 : children.length;
|
||||
}
|
||||
|
||||
public Object getChild(Object node, int i) {
|
||||
return getChildren(node)[i];
|
||||
return getChildren(node)[i];
|
||||
}
|
||||
|
||||
// The superclass's implementation would work, but this is more efficient.
|
||||
public boolean isLeaf(Object node) {
|
||||
if(node == null) return true;
|
||||
VariableNode varNode = (VariableNode)node;
|
||||
Object[] children = varNode.getChildren();
|
||||
if(children != null && children.length > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if(node == null) return true;
|
||||
VariableNode varNode = (VariableNode)node;
|
||||
Object[] children = varNode.getChildren();
|
||||
if(children != null && children.length > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCellEditable(Object node, int column) {
|
||||
return column == 0;
|
||||
return column == 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -104,34 +104,34 @@ public class VariableModel extends AbstractTreeTableModel
|
|||
//
|
||||
|
||||
public int getColumnCount() {
|
||||
return cNames.length;
|
||||
return cNames.length;
|
||||
}
|
||||
|
||||
public String getColumnName(int column) {
|
||||
return cNames[column];
|
||||
return cNames[column];
|
||||
}
|
||||
|
||||
public Class getColumnClass(int column) {
|
||||
return cTypes[column];
|
||||
return cTypes[column];
|
||||
}
|
||||
|
||||
public Object getValueAt(Object node, int column) {
|
||||
Object value = getObject(node);
|
||||
Object value = getObject(node);
|
||||
Context cx = Context.enter();
|
||||
try {
|
||||
switch(column) {
|
||||
case 0: // Name
|
||||
VariableNode varNode = (VariableNode)node;
|
||||
String name = "";
|
||||
if(varNode.name != null) {
|
||||
return name + varNode.name;
|
||||
}
|
||||
return name + "[" + varNode.index + "]";
|
||||
case 1: // value
|
||||
if(value == Undefined.instance ||
|
||||
try {
|
||||
switch(column) {
|
||||
case 0: // Name
|
||||
VariableNode varNode = (VariableNode)node;
|
||||
String name = "";
|
||||
if(varNode.name != null) {
|
||||
return name + varNode.name;
|
||||
}
|
||||
return name + "[" + varNode.index + "]";
|
||||
case 1: // value
|
||||
if(value == Undefined.instance ||
|
||||
value == ScriptableObject.NOT_FOUND) {
|
||||
return "undefined";
|
||||
}
|
||||
return "undefined";
|
||||
}
|
||||
if(value == null) {
|
||||
return "null";
|
||||
}
|
||||
|
@ -156,19 +156,19 @@ public class VariableModel extends AbstractTreeTableModel
|
|||
return buf.toString();
|
||||
}
|
||||
} catch(Exception exc) {
|
||||
//exc.printStackTrace();
|
||||
} finally {
|
||||
//exc.printStackTrace();
|
||||
} finally {
|
||||
cx.exit();
|
||||
}
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setScope(Scriptable scope) {
|
||||
VariableNode rootVar = (VariableNode)root;
|
||||
rootVar.scope = scope;
|
||||
fireTreeNodesChanged(this,
|
||||
new Object[]{root},
|
||||
null, new Object[]{root});
|
||||
VariableNode rootVar = (VariableNode)root;
|
||||
rootVar.scope = scope;
|
||||
fireTreeNodesChanged(this,
|
||||
new Object[]{root},
|
||||
null, new Object[]{root});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -180,51 +180,51 @@ class VariableNode {
|
|||
int index;
|
||||
|
||||
public VariableNode(Scriptable scope, String name) {
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public VariableNode(Scriptable scope, int index) {
|
||||
this.scope = scope;
|
||||
this.name = null;
|
||||
this.index = index;
|
||||
this.scope = scope;
|
||||
this.name = null;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the the string to be used to display this leaf in the JTree.
|
||||
*/
|
||||
public String toString() {
|
||||
return (name != null ? name : "[" + index + "]");
|
||||
return (name != null ? name : "[" + index + "]");
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
try {
|
||||
if(scope == null) return null;
|
||||
if(name != null) {
|
||||
if(name.equals("this")) {
|
||||
return scope;
|
||||
}
|
||||
Object result;
|
||||
if(name.equals("__proto__")) {
|
||||
result = scope.getPrototype();
|
||||
} else if(name.equals("__parent__")) {
|
||||
result = scope.getParentScope();
|
||||
} else {
|
||||
result = scope.get(name, scope);
|
||||
}
|
||||
if(result == ScriptableObject.NOT_FOUND) {
|
||||
result = Undefined.instance;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Object result = scope.get(index, scope);
|
||||
if(result == ScriptableObject.NOT_FOUND) {
|
||||
result = Undefined.instance;
|
||||
}
|
||||
return result;
|
||||
} catch(Exception exc) {
|
||||
return "undefined";
|
||||
}
|
||||
try {
|
||||
if(scope == null) return null;
|
||||
if(name != null) {
|
||||
if(name.equals("this")) {
|
||||
return scope;
|
||||
}
|
||||
Object result;
|
||||
if(name.equals("__proto__")) {
|
||||
result = scope.getPrototype();
|
||||
} else if(name.equals("__parent__")) {
|
||||
result = scope.getParentScope();
|
||||
} else {
|
||||
result = scope.get(name, scope);
|
||||
}
|
||||
if(result == ScriptableObject.NOT_FOUND) {
|
||||
result = Undefined.instance;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Object result = scope.get(index, scope);
|
||||
if(result == ScriptableObject.NOT_FOUND) {
|
||||
result = Undefined.instance;
|
||||
}
|
||||
return result;
|
||||
} catch(Exception exc) {
|
||||
return "undefined";
|
||||
}
|
||||
}
|
||||
|
||||
Object[] children;
|
||||
|
@ -235,19 +235,19 @@ class VariableNode {
|
|||
static final Object[] empty = new Object[0];
|
||||
static Scriptable builtin[];
|
||||
protected Object[] getChildren() {
|
||||
if(children != null) return children;
|
||||
if(children != null) return children;
|
||||
Context cx = Context.enter();
|
||||
try {
|
||||
Object value = getObject();
|
||||
if(value == null) return children = empty;
|
||||
if(value == ScriptableObject.NOT_FOUND ||
|
||||
value == Undefined.instance) {
|
||||
return children = empty;
|
||||
}
|
||||
if(value instanceof Scriptable) {
|
||||
Scriptable scrip = (Scriptable)value;
|
||||
Scriptable proto = scrip.getPrototype();
|
||||
Scriptable parent = scrip.getParentScope();
|
||||
try {
|
||||
Object value = getObject();
|
||||
if(value == null) return children = empty;
|
||||
if(value == ScriptableObject.NOT_FOUND ||
|
||||
value == Undefined.instance) {
|
||||
return children = empty;
|
||||
}
|
||||
if(value instanceof Scriptable) {
|
||||
Scriptable scrip = (Scriptable)value;
|
||||
Scriptable proto = scrip.getPrototype();
|
||||
Scriptable parent = scrip.getParentScope();
|
||||
if(value instanceof NativeCall) {
|
||||
if(name != null && name.equals("this")) {
|
||||
// this is the local variables table root
|
||||
|
@ -260,112 +260,112 @@ class VariableNode {
|
|||
parent = null;
|
||||
}
|
||||
}
|
||||
if(proto != null) {
|
||||
if(builtin == null) {
|
||||
builtin = new Scriptable[6];
|
||||
builtin[0] =
|
||||
ScriptableObject.getObjectPrototype(scrip);
|
||||
builtin[1] =
|
||||
ScriptableObject.getFunctionPrototype(scrip);
|
||||
builtin[2] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"String");
|
||||
builtin[3] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"Boolean");
|
||||
builtin[4] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"Array");
|
||||
builtin[5] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"Number");
|
||||
}
|
||||
for(int i = 0; i < builtin.length; i++) {
|
||||
if(proto == builtin[i]) {
|
||||
proto = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(scrip.has(0, scrip)) {
|
||||
int len = 0;
|
||||
try {
|
||||
Scriptable start = scrip;
|
||||
Scriptable obj = start;
|
||||
Object result = Undefined.instance;
|
||||
do {
|
||||
if(obj.has("length", start)) {
|
||||
result = obj.get("length", start);
|
||||
if (result != Scriptable.NOT_FOUND)
|
||||
break;
|
||||
}
|
||||
obj = obj.getPrototype();
|
||||
} while (obj != null);
|
||||
if(result instanceof Number) {
|
||||
len = ((Number)result).intValue();
|
||||
}
|
||||
} catch(Exception exc) {
|
||||
}
|
||||
if(parent != null) {
|
||||
len++;
|
||||
}
|
||||
if(proto != null) {
|
||||
len++;
|
||||
}
|
||||
children = new VariableNode[len];
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
if(proto != null) {
|
||||
children[i++] = new VariableNode(scrip, "__proto__");
|
||||
j++;
|
||||
}
|
||||
if(parent != null) {
|
||||
children[i++] = new VariableNode(scrip, "__parent__");
|
||||
j++;
|
||||
}
|
||||
for(; i < len; i++) {
|
||||
children[i] = new VariableNode(scrip, i-j);
|
||||
}
|
||||
} else {
|
||||
int len = 0;
|
||||
Hashtable t = new Hashtable();
|
||||
Object[] ids = scrip.getIds();
|
||||
if(proto != null) t.put("__proto__", "__proto__");
|
||||
if(parent != null) t.put("__parent__", "__parent__");
|
||||
if(ids.length > 0) {
|
||||
for(int j = 0; j < ids.length; j++) {
|
||||
t.put(ids[j], ids[j]);
|
||||
}
|
||||
}
|
||||
ids = new Object[t.size()];
|
||||
Enumeration e = t.keys();
|
||||
int j = 0;
|
||||
while(e.hasMoreElements()) {
|
||||
ids[j++] = e.nextElement().toString();
|
||||
}
|
||||
if(ids != null && ids.length > 0) {
|
||||
java.util.Arrays.sort(ids, new java.util.Comparator() {
|
||||
public int compare(Object l, Object r) {
|
||||
return l.toString().compareToIgnoreCase(r.toString());
|
||||
|
||||
}
|
||||
});
|
||||
len = ids.length;
|
||||
}
|
||||
children = new VariableNode[len];
|
||||
for(int i = 0; i < len; i++) {
|
||||
Object id = ids[i];
|
||||
children[i] =
|
||||
new VariableNode(scrip, id.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exc) {
|
||||
exc.printStackTrace();
|
||||
} finally {
|
||||
if(proto != null) {
|
||||
if(builtin == null) {
|
||||
builtin = new Scriptable[6];
|
||||
builtin[0] =
|
||||
ScriptableObject.getObjectPrototype(scrip);
|
||||
builtin[1] =
|
||||
ScriptableObject.getFunctionPrototype(scrip);
|
||||
builtin[2] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"String");
|
||||
builtin[3] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"Boolean");
|
||||
builtin[4] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"Array");
|
||||
builtin[5] =
|
||||
ScriptableObject.getClassPrototype(scrip,
|
||||
"Number");
|
||||
}
|
||||
for(int i = 0; i < builtin.length; i++) {
|
||||
if(proto == builtin[i]) {
|
||||
proto = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(scrip.has(0, scrip)) {
|
||||
int len = 0;
|
||||
try {
|
||||
Scriptable start = scrip;
|
||||
Scriptable obj = start;
|
||||
Object result = Undefined.instance;
|
||||
do {
|
||||
if(obj.has("length", start)) {
|
||||
result = obj.get("length", start);
|
||||
if (result != Scriptable.NOT_FOUND)
|
||||
break;
|
||||
}
|
||||
obj = obj.getPrototype();
|
||||
} while (obj != null);
|
||||
if(result instanceof Number) {
|
||||
len = ((Number)result).intValue();
|
||||
}
|
||||
} catch(Exception exc) {
|
||||
}
|
||||
if(parent != null) {
|
||||
len++;
|
||||
}
|
||||
if(proto != null) {
|
||||
len++;
|
||||
}
|
||||
children = new VariableNode[len];
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
if(proto != null) {
|
||||
children[i++] = new VariableNode(scrip, "__proto__");
|
||||
j++;
|
||||
}
|
||||
if(parent != null) {
|
||||
children[i++] = new VariableNode(scrip, "__parent__");
|
||||
j++;
|
||||
}
|
||||
for(; i < len; i++) {
|
||||
children[i] = new VariableNode(scrip, i-j);
|
||||
}
|
||||
} else {
|
||||
int len = 0;
|
||||
Hashtable t = new Hashtable();
|
||||
Object[] ids = scrip.getIds();
|
||||
if(proto != null) t.put("__proto__", "__proto__");
|
||||
if(parent != null) t.put("__parent__", "__parent__");
|
||||
if(ids.length > 0) {
|
||||
for(int j = 0; j < ids.length; j++) {
|
||||
t.put(ids[j], ids[j]);
|
||||
}
|
||||
}
|
||||
ids = new Object[t.size()];
|
||||
Enumeration e = t.keys();
|
||||
int j = 0;
|
||||
while(e.hasMoreElements()) {
|
||||
ids[j++] = e.nextElement().toString();
|
||||
}
|
||||
if(ids != null && ids.length > 0) {
|
||||
java.util.Arrays.sort(ids, new java.util.Comparator() {
|
||||
public int compare(Object l, Object r) {
|
||||
return l.toString().compareToIgnoreCase(r.toString());
|
||||
|
||||
}
|
||||
});
|
||||
len = ids.length;
|
||||
}
|
||||
children = new VariableNode[len];
|
||||
for(int i = 0; i < len; i++) {
|
||||
Object id = ids[i];
|
||||
children[i] =
|
||||
new VariableNode(scrip, id.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception exc) {
|
||||
exc.printStackTrace();
|
||||
} finally {
|
||||
cx.exit();
|
||||
}
|
||||
return children;
|
||||
return children;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,8 +113,8 @@ DocumentListener {
|
|||
private int outputMark = 0;
|
||||
|
||||
public void select(int start, int end) {
|
||||
requestFocus();
|
||||
super.select(start, end);
|
||||
requestFocus();
|
||||
super.select(start, end);
|
||||
}
|
||||
|
||||
public ConsoleTextArea(String[] argv) {
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Environment.java
|
||||
|
||||
Wraps java.lang.System properties.
|
||||
|
||||
by Patrick C. Beard <beard@netscape.com>
|
||||
Environment.java
|
||||
|
||||
Wraps java.lang.System properties.
|
||||
|
||||
by Patrick C. Beard <beard@netscape.com>
|
||||
*/
|
||||
|
||||
package org.mozilla.javascript.tools.shell;
|
||||
|
|
|
@ -339,10 +339,10 @@ public class Main {
|
|||
exitCode = EXITCODE_RUNTIME_ERROR;
|
||||
}
|
||||
catch (JavaScriptException jse) {
|
||||
// Need to propagate ThreadDeath exceptions.
|
||||
Object value = jse.getValue();
|
||||
if (value instanceof ThreadDeath)
|
||||
throw (ThreadDeath) value;
|
||||
// Need to propagate ThreadDeath exceptions.
|
||||
Object value = jse.getValue();
|
||||
if (value instanceof ThreadDeath)
|
||||
throw (ThreadDeath) value;
|
||||
exitCode = EXITCODE_RUNTIME_ERROR;
|
||||
Context.reportError(ToolErrorReporter.getMessage(
|
||||
"msg.uncaughtJSException",
|
||||
|
|
Загрузка…
Ссылка в новой задаче