[Buix-commits] r884 - lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler
Author: sletellier Date: 2008-10-06 14:59:44 +0000 (Mon, 06 Oct 2008) New Revision: 884 Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/ScriptManager.java Log: Correction bug constructeur Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/ScriptManager.java =================================================================== --- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/ScriptManager.java 2008-10-06 14:50:36 UTC (rev 883) +++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/compiler/ScriptManager.java 2008-10-06 14:59:44 UTC (rev 884) @@ -176,27 +176,28 @@ } - private void processConstructor(String modifiers, SimpleNode node) { - assert node.getId() == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION : "expected node to be ConstructorDeclaration, found " + JavaParserTreeConstants.jjtNodeName[node.getId()] + " instead"; - assert node.getChild(0).getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS : "expected node 0 to be FormalParameters, found " + JavaParserTreeConstants.jjtNodeName[node.getChild(1).getId()] + " instead"; - if (node.getChild(0).jjtGetNumChildren() == 0) { - compiler.reportError("The default no-argument constructor may not be redefined"); - } - else { - SimpleNode explicitConstructorInvocation = findExplicitConstructorInvocation(node); - if (explicitConstructorInvocation == null || explicitConstructorInvocation.getText().trim().startsWith("super(")) { - String code = "$initialize();" + JAXXCompiler.getLineSeparator(); - if (explicitConstructorInvocation == null) { - node.getChild(1).firstToken.image = code + node.getChild(1).firstToken.image; - } - else { - explicitConstructorInvocation.lastToken.image += code; - } - } - } - - compiler.bodyCode.append(modifiers).append(" ").append(node.getText()); - //compiler.bodyCode.append(";\n"); + private void processConstructor(String modifiers, SimpleNode node) { + assert node.getId() == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION : "expected node to be ConstructorDeclaration, found " + JavaParserTreeConstants.jjtNodeName[node.getId()] + " instead"; + assert node.getChild(0).getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS : "expected node 0 to be FormalParameters, found " + JavaParserTreeConstants.jjtNodeName[node.getChild(1).getId()] + " instead"; + String code = ""; + if (node.getChild(0).jjtGetNumChildren() == 0) { + compiler.reportError("The default no-argument constructor may not be redefined"); + } + else { + SimpleNode explicitConstructorInvocation = findExplicitConstructorInvocation(node); + if (explicitConstructorInvocation == null || explicitConstructorInvocation.getText().trim().startsWith("super(")) { + code = "$initialize();" + JAXXCompiler.getLineSeparator(); + if (explicitConstructorInvocation == null) { + node.getChild(1).firstToken.image = node.getChild(1).firstToken.image; + } + else { + explicitConstructorInvocation.lastToken.image += code; + } + } + } + + compiler.bodyCode.append(modifiers).append(" ").append(node.getText().substring(0,node.getText().length()-1) + code + "}"); + //compiler.bodyCode.append(";\n"); } @@ -332,4 +333,4 @@ } } } -} \ No newline at end of file +}
participants (1)
-
sletellier@users.labs.libre-entreprise.org