01: /**************************************************************************/
02: /* N I C E */
03: /* A high-level object-oriented research language */
04: /* (c) Daniel Bonniot 2002 */
05: /* */
06: /* This program is free software; you can redistribute it and/or modify */
07: /* it under the terms of the GNU General Public License as published by */
08: /* the Free Software Foundation; either version 2 of the License, or */
09: /* (at your option) any later version. */
10: /* */
11: /**************************************************************************/package gnu.expr;
12:
13: /**
14: Copy the value of a previous argument in the same function call.
15:
16: Used to implement optional arguments whose default value refers to
17: another argument.
18:
19: @version $Date: 2003/08/08 19:16:33 $
20: @author Daniel Bonniot (bonniot@users.sourceforge.net)
21: */
22:
23: public class CopyArgument extends Expression {
24: public CopyArgument(java.util.Stack copies) {
25: this .copies = copies;
26: }
27:
28: public void compile(gnu.expr.Compilation comp,
29: gnu.expr.Target target) {
30: gnu.bytecode.Variable value = (gnu.bytecode.Variable) copies
31: .peek();
32: comp.getCode().emitLoad(value);
33: target.compileFromStack(comp, value.getType());
34: }
35:
36: public void print(gnu.mapping.OutPort out) {
37: }
38:
39: final java.util.Stack copies;
40: }
|