From: Doni Pracner Date: Thu, 12 Jun 2014 20:43:19 +0000 (+0200) Subject: mjc2wsl - field acces simplification and wraping in VAR statements X-Git-Tag: v0.1.8~1^2~11 X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=commitdiff_plain;h=f049de94cf27a4e41c132b2fcc9a77ad66f09346 mjc2wsl - field acces simplification and wraping in VAR statements --- diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index d582784..f754e4e 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -436,17 +436,18 @@ public class mjc2wsl{ case getfield: { int f = get2(); + prl(createStartVar("tempa")); prl(createTopEStack()); prl(createToEStack(createObject("tempa") + "[" + (f + 1) + "]")); + prl(createEndVar()); break; } case putfield: { int f = get2(); - // we need to use a temparray as a pointer, WSL - // otherwise tries to access it as a list of lists and fails - prl(createTopTwoEStack()); - prl("VAR < tempArray := " + createObject("tempb") + " > :"); - prl("tempArray[" + (f + 1) + "]:=tempa ENDVAR;"); + prl(createStartVar("tempa", "tempb")); + prl(createTopTwoEStack()); + prl(createObject("tempb") + "[" + (f + 1) + "]:=tempa;"); + prl(createEndVar()); break; }