From d028f7f14a130f31237e269a7dc7a509a547f43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=BCtterling=2C=20Franziska=20=28WWI2012D=29?= Date: Tue, 23 Jun 2015 20:01:06 +0200 Subject: [PATCH] =?UTF-8?q?GenCode:=20Assign=20ist=20jetzt=20dynamisch=20f?= =?UTF-8?q?=C3=BCr=20mehrere=20Variablen=20-=20Anpassung=20f=C3=BCr=20vers?= =?UTF-8?q?chiedene=20Typen=20potentiell=20n=C3=B6tig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/syntaxtree/statement/Assign.java | 11 ++++------- test/bytecode/Assign.jav | 3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java index 88243383..efb9147c 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java @@ -172,19 +172,16 @@ public class Assign extends Expr - int counter = 0; //Zaehlvariable für ISTORE + public static int counter = 0; //Zaehlvariable für ISTORE @Override public InstructionList genByteCode(ClassGen cg) { // TODO Auto-generated method stub - //Bytecode: bipush 20 - // istore_1 - //InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool()); + InstructionFactory _factory = new InstructionFactory(cg, cg.getConstantPool()); InstructionList il = expr2.genByteCode(cg);//expr2 rechte expr - //il.append(_factory.ISTORE_1); counter++; - il.append(new ISTORE(counter)); //nimmt das auch die Variable und nicht den Zaehler? - + il.append(new ISTORE(counter)); //macht ISTORE für meherere Variable nutzbar (nicht nur ISTORE_1, ISTORE_2, etc.) + //Anpassung für Variablen außerhalb von int = ISTORE nötig? return il; } diff --git a/test/bytecode/Assign.jav b/test/bytecode/Assign.jav index 8f32ab9c..b238192f 100644 --- a/test/bytecode/Assign.jav +++ b/test/bytecode/Assign.jav @@ -1,7 +1,6 @@ class Assign{ - -void method() {i; i = 20; j; j=50;k; k=50;l; l =70;}//m; m=120; n; n=60; +void method() {a; a = 20;b; b=59;} } \ No newline at end of file