// Fields and Accessors ///////////////////////////////////////////////
+ /** the number of formal arguments */
+ int numFormalArgs = 0;
+
/** the source code file that this block was drawn from */
private String sourceName;
public String getSourceName() throws JS.Exn { return sourceName; }
break;
}
-
+ case ASSIGN_SUB: case ASSIGN_ADD: {
+ Object val = t.pop();
+ Object old = t.pop();
+ Object key = t.pop();
+ Object obj = t.peek();
+ if (obj instanceof org.xwt.Box && val instanceof CompiledFunction) {
+ if (curOP == ASSIGN_ADD) {
+ ((org.xwt.Box)obj).addTrap(key, val);
+ } else {
+ ((org.xwt.Box)obj).delTrap(key, val);
+ }
+ // skip over the "normal" implementation of +=/-=
+ pc += ((Integer)arg[pc]).intValue() - 1;
+ } else {
+ // use the "normal" implementation
+ t.push(key);
+ t.push(old);
+ t.push(arg);
+ }
+ break;
+ }
+
case ADD: {
int count = ((Number)arg[pc]).intValue();
if(count < 2) throw new Error("this should never happen");
Object left = t.pop();
if(left instanceof String || right instanceof String) t.push(JS.toString(left).concat(JS.toString(right)));
else t.push(new Double(JS.toDouble(left) + JS.toDouble(right)));
- break;
- }
- Object[] args = new Object[count];
- while(--count >= 0) args[count] = t.pop();
- if(args[0] instanceof String) {
- StringBuffer sb = new StringBuffer(64);
- for(int i=0;i<args.length;i++) sb.append(JS.toString(args[i]));
- t.push(sb.toString());
} else {
- int numStrings = 0;
- for(int i=0;i<args.length;i++) if(args[i] instanceof String) numStrings++;
- if(numStrings == 0) {
- double d = 0.0;
- for(int i=0;i<args.length;i++) d += JS.toDouble(args[i]);
- t.push(new Double(d));
- } else {
- double d=0.0;
- int i=0;
- do {
- d += JS.toDouble(args[i++]);
- } while(!(args[i] instanceof String));
+ Object[] args = new Object[count];
+ while(--count >= 0) args[count] = t.pop();
+ if(args[0] instanceof String) {
StringBuffer sb = new StringBuffer(64);
- sb.append(JS.toString(new Double(d)));
- while(i < args.length) sb.append(JS.toString(args[i++]));
+ for(int i=0;i<args.length;i++) sb.append(JS.toString(args[i]));
t.push(sb.toString());
+ } else {
+ int numStrings = 0;
+ for(int i=0;i<args.length;i++) if(args[i] instanceof String) numStrings++;
+ if(numStrings == 0) {
+ double d = 0.0;
+ for(int i=0;i<args.length;i++) d += JS.toDouble(args[i]);
+ t.push(new Double(d));
+ } else {
+ double d=0.0;
+ int i=0;
+ do {
+ d += JS.toDouble(args[i++]);
+ } while(!(args[i] instanceof String));
+ StringBuffer sb = new StringBuffer(64);
+ sb.append(JS.toString(new Double(d)));
+ while(i < args.length) sb.append(JS.toString(args[i++]));
+ t.push(sb.toString());
+ }
}
}
break;