From: jzhou Date: Thu, 10 Mar 2011 03:09:09 +0000 (+0000) Subject: Fix a bug of field initialization. Previously the field initializations are done... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c8b88a0927126844ce4ff5be9c2cc92403871676;p=IRC.git Fix a bug of field initialization. Previously the field initializations are done in a reverse definition order. This could cause problem when a field's initialization depends on another fields initialization. As in the Java language specification, it is only specified that a instance field's initialization should be before its first usage in the field initializations, we simply change to do the field initializations in the same order as they are defined --- diff --git a/Robust/src/IR/Tree/BlockNode.java b/Robust/src/IR/Tree/BlockNode.java index 297bbc34..f62e6fa0 100644 --- a/Robust/src/IR/Tree/BlockNode.java +++ b/Robust/src/IR/Tree/BlockNode.java @@ -27,6 +27,10 @@ public class BlockNode extends TreeNode { public void addFirstBlockStatement(BlockStatementNode bsn) { blockstatements.insertElementAt(bsn,0); } + + public void addBlockStatementAt(BlockStatementNode bsn, int i) { + blockstatements.insertElementAt(bsn,i); + } public void setStyle(int style) { printStyle=style; diff --git a/Robust/src/IR/Tree/BuildIR.java b/Robust/src/IR/Tree/BuildIR.java index 742a9da9..b2e2a1ec 100644 --- a/Robust/src/IR/Tree/BuildIR.java +++ b/Robust/src/IR/Tree/BuildIR.java @@ -144,19 +144,21 @@ public class BuildIR { public void parseInitializers(ClassDescriptor cn){ Vector fv=cn.getFieldVec(); + int pos = 0; for(int i=0;i