[Nice-commit] Nice/src/nice/tools/code GetFieldProc.java,1.5,1.6 Gen.java,1.11,1.12
Brought to you by:
bonniot
|
From: <bo...@us...> - 2003-05-01 22:42:29
|
Update of /cvsroot/nice/Nice/src/nice/tools/code
In directory sc8-pr-cvs1:/tmp/cvs-serv25622/src/nice/tools/code
Modified Files:
GetFieldProc.java Gen.java
Log Message:
Implemented bit write access on class fields and global variables.
Index: GetFieldProc.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/code/GetFieldProc.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** GetFieldProc.java 12 Feb 2003 13:04:56 -0000 1.5
--- GetFieldProc.java 1 May 2003 22:42:18 -0000 1.6
***************
*** 36,39 ****
--- 36,41 ----
private Declaration fieldDecl;
+ Field getField() { return fieldDecl.field; }
+
public void compile (ApplyExp exp, Compilation comp, Target target)
{
Index: Gen.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/code/Gen.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Gen.java 18 Apr 2003 14:50:18 -0000 1.11
--- Gen.java 1 May 2003 22:42:18 -0000 1.12
***************
*** 266,268 ****
--- 266,290 ----
return Inline.inline(nice.lang.inline.Return.instance, value);
}
+
+ public static void store(Compilation comp, Expression destination,
+ Target target)
+ {
+ if (destination instanceof ReferenceExp)
+ {
+ ((ReferenceExp) destination).getBinding().compileStore(comp);
+ return;
+ }
+
+ // Destination must be a field.
+ gnu.bytecode.CodeAttr code = comp.getCode();
+
+ ApplyExp apply = (ApplyExp) destination;
+ GetFieldProc fieldProc = (GetFieldProc)
+ ((QuoteExp) apply.getFunction()).getValue();
+ Field field = fieldProc.getField();
+
+ apply.getArgs()[0].compile(comp, field.getDeclaringClass());
+ code.emitSwap();
+ code.emitPutField(field);
+ }
}
|