[Nice-commit] Nice/src/gnu/expr ConstructorExp.java,1.3,1.4
Brought to you by:
bonniot
From: <ar...@us...> - 2003-12-14 09:41:43
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv20832/F:/nice/src/gnu/expr Modified Files: ConstructorExp.java Log Message: Codegeneration part for custom constructors. Index: ConstructorExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ConstructorExp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConstructorExp.java 27 Nov 2003 21:02:13 -0000 1.3 --- ConstructorExp.java 13 Dec 2003 17:52:01 -0000 1.4 *************** *** 29,32 **** --- 29,39 ---- this.classType = (ClassType) thisDecl.getType(); thisDecl.context = this; + this.primary = true; + } + + public ConstructorExp(ClassType classType) + { + this.classType = classType; + this.primary = false; } *************** *** 39,42 **** --- 46,50 ---- private ClassType classType; private Expression superCall; + private boolean primary; ClassType getClassType() { return classType; } *************** *** 68,84 **** void enterFunction (Compilation comp) { ! // The super call has to come before anything else. ! superCall.compile(comp, Target.Ignore); ! ! // Do the normal stuff. ! super.enterFunction(comp); ! ! // Save 'this' if it is captured ! if (thisDecl.field != null) { ! CodeAttr code = comp.getCode(); ! thisDecl.loadOwningObject(comp); ! code.emitPushThis(); ! code.emitPutField(thisDecl.field); } } --- 76,100 ---- void enterFunction (Compilation comp) { ! if (primary) { ! // The super call has to come before anything else. ! superCall.compile(comp, Target.Ignore); ! ! // Do the normal stuff. ! super.enterFunction(comp); ! ! // Save 'this' if it is captured ! if (thisDecl.field != null) ! { ! CodeAttr code = comp.getCode(); ! thisDecl.loadOwningObject(comp); ! code.emitPushThis(); ! code.emitPutField(thisDecl.field); ! } ! } ! else ! { ! // nothing special to do for custom constructors. ! super.enterFunction(comp); } } |