01: /**************************************************************************/
02: /* N I C E */
03: /* A high-level object-oriented research language */
04: /* (c) Daniel Bonniot 2004 */
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: import gnu.bytecode.*;
14:
15: /**
16: A LambdaExp member of a class (with a this argument).
17:
18: @author Daniel Bonniot (bonniot@users.sourceforge.net)
19: */
20:
21: public class MemberLambdaExp extends LambdaExp {
22: public MemberLambdaExp(Declaration this Decl) {
23: this .this Decl = this Decl;
24: this Decl.context = this ;
25: }
26:
27: private Declaration this Decl;
28:
29: void enterFunction(Compilation comp) {
30: // Do the normal stuff.
31: super .enterFunction(comp);
32:
33: // Save 'this' if it is captured
34: if (this Decl.field != null) {
35: CodeAttr code = comp.getCode();
36: thisDecl.loadOwningObject(comp);
37: code.emitPushThis();
38: code.emitPutField(thisDecl.field);
39: }
40: }
41: }
|