core/src/main/java/org/apidesign/bck2brwsr/core/impl/JavaScriptProcesor.java
branchUseFunctionCall
changeset 443 9359b006782b
parent 432 1bdeeb77f5a3
child 575 0751e63c5a94
     1.1 --- a/core/src/main/java/org/apidesign/bck2brwsr/core/impl/JavaScriptProcesor.java	Sat Jan 12 16:29:29 2013 +0100
     1.2 +++ b/core/src/main/java/org/apidesign/bck2brwsr/core/impl/JavaScriptProcesor.java	Mon Jan 14 11:30:56 2013 +0100
     1.3 @@ -53,7 +53,7 @@
     1.4      @Override
     1.5      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
     1.6          for (Element e : roundEnv.getElementsAnnotatedWith(JavaScriptBody.class)) {
     1.7 -            if (e.getKind() != ElementKind.METHOD) {
     1.8 +            if (e.getKind() != ElementKind.METHOD && e.getKind() != ElementKind.CONSTRUCTOR) {
     1.9                  continue;
    1.10              }
    1.11              ExecutableElement ee = (ExecutableElement)e;
    1.12 @@ -61,13 +61,7 @@
    1.13              
    1.14              JavaScriptBody jsb = e.getAnnotation(JavaScriptBody.class);
    1.15              String[] arr = jsb.args();
    1.16 -            int indx;
    1.17 -            if (!ee.getModifiers().contains(Modifier.STATIC)) {
    1.18 -                indx = 1;
    1.19 -            } else {
    1.20 -                indx = 0;
    1.21 -            }
    1.22 -            if (indx + params.size() != arr.length) {
    1.23 +            if (params.size() != arr.length) {
    1.24                  processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Number of args arguments does not match real arguments!", e);
    1.25              }
    1.26          }
    1.27 @@ -81,14 +75,8 @@
    1.28          StringBuilder sb = new StringBuilder();
    1.29          if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("args")) {
    1.30              ExecutableElement ee = (ExecutableElement) e;
    1.31 -            String sep;
    1.32 -            if (!ee.getModifiers().contains(Modifier.STATIC)) {
    1.33 -                sb.append("{ \"self\"");
    1.34 -                sep = ", ";
    1.35 -            } else {
    1.36 -                sb.append("{ ");
    1.37 -                sep = "";
    1.38 -            }
    1.39 +            String sep = "";
    1.40 +            sb.append("{ ");
    1.41              for (VariableElement ve : ee.getParameters()) {
    1.42                  sb.append(sep).append('"').append(ve.getSimpleName())
    1.43                      .append('"');