+ }
+ MethodInvokeNode min = null;
+ if(cd.getSuper()!= null) {
+ // add a super(...) into the anonymous constructor
+ NameDescriptor nd=new NameDescriptor("super");
+ min=new MethodInvokeNode(nd);
+ BlockExpressionNode ben=new BlockExpressionNode(min);
+ BlockNode bn = state.getMethodBody(cd_construtor);
+ bn.addFirstBlockStatement(ben);
+ }
+ for(int i = 0 ; i < tdarray.length; i++) {
+ assert(null!=min);
+ TypeDescriptor itd = tdarray[i];
+ cd_construtor.addParameter(itd, itd.getSymbol()+"_from_con_node_"+i);
+ min.addArgument(new NameNode(new NameDescriptor(itd.getSymbol()+"_from_con_node_"+i)));
+ }
+
+ // Next add the live vars into the inline class' fields
+ cd.setSurroundingNameTable(nametable);
+ // do a round of semantic check trial to get all the live vars required by the inline class
+ trialSemanticCheck(cd);
+ Vector<VarDescriptor> vars = this.inlineClass2LiveVars.remove(cd);
+ for(int i = 0; i < vars.size(); i++) {
+ Descriptor d = vars.elementAt(i);
+ if(d instanceof VarDescriptor && !d.getSymbol().equals("this")) {
+ con.addArgument(new NameNode(new NameDescriptor(d.getSymbol())));
+ cd.addField(new FieldDescriptor(new Modifiers(Modifiers.PUBLIC), ((VarDescriptor)d).getType(), d.getSymbol(), null, false));
+ cd_construtor.addParameter(((VarDescriptor)d).getType(), d.getSymbol()+"_p");
+ // add the initialize statement into this constructor
+ BlockNode obn = state.getMethodBody(cd_construtor);
+ NameNode nn=new NameNode(new NameDescriptor(d.getSymbol()));
+ NameNode fn = new NameNode (new NameDescriptor(d.getSymbol()+"_p"));
+ AssignmentNode an=new AssignmentNode(nn,fn,new AssignOperation(1));
+ obn.addFirstBlockStatement(new BlockExpressionNode(an));
+ state.addTreeCode(cd_construtor, obn);
+ }
+ }