Commits

Tim Vernum  committed 30a0c26

In member reference, support parameters

  • Participants
  • Parent commits 1027a1e

Comments (0)

Files changed (1)

File convert/source/java/main/org/adjective/syntactic/convert/j8to7/MemberReferenceConverter.java

 import org.adjective.syntactic.convert.j8to7.util.Importer;
 import org.adjective.syntactic.parser.ast.ASTArraySuffixList;
 import org.adjective.syntactic.parser.ast.ASTBlock;
+import org.adjective.syntactic.parser.ast.ASTFormalParameter;
 import org.adjective.syntactic.parser.ast.ASTFormalParameters;
 import org.adjective.syntactic.parser.ast.ASTIdentifier;
 import org.adjective.syntactic.parser.ast.ASTMemberReference;
 
     private ASTMethodDeclaration makeMethodDeclaration(final MethodInfo method, final ExpressionNode target, final ASTMemberReference reference)
     {
+        final ASTFormalParameters parameters = makeFormalParameters(method);
         // TODO
-        final ASTFormalParameters parameters = new ASTFormalParameters();
         final ASTNameList exceptions = new ASTNameList();
         final ASTMethodBody body = new ASTMethodBody(new ASTBlock());
 
                                         exceptions,
                                         body);
     }
+
+    private ASTFormalParameters makeFormalParameters(final MethodInfo method)
+    {
+        final JavaType[] parameterTypes = method.getParameterTypes();
+        final String[] parameterNames = method.getParameterNames();
+        final ASTFormalParameter[] formalParameters = new ASTFormalParameter[parameterTypes.length];
+        for (int i = 0; i < formalParameters.length; i++)
+        {
+            formalParameters[i] = new ASTFormalParameter(parameterTypes[i],
+                                                         i == formalParameters.length - 1 && method.isVarArgs(),
+                                                         parameterNames[i]);
+        }
+        return new ASTFormalParameters(formalParameters);
+
+    }
 }