launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsMethods.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 17 Jun 2013 19:36:24 +0200
branchclassloader
changeset 1181 b703d9d71f25
parent 1178 4ae766848ce0
child 1423 237dbcd482dc
permissions -rw-r--r--
Initial attempt to pass this into non-static methods
jaroslav@1170
     1
/**
jaroslav@1170
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1170
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@1170
     4
 *
jaroslav@1170
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@1170
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@1170
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@1170
     8
 *
jaroslav@1170
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@1170
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@1170
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@1170
    12
 * GNU General Public License for more details.
jaroslav@1170
    13
 *
jaroslav@1170
    14
 * You should have received a copy of the GNU General Public License
jaroslav@1170
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@1170
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@1170
    17
 */
jaroslav@1170
    18
package org.apidesign.bck2brwsr.launcher.fximpl;
jaroslav@1170
    19
jaroslav@1170
    20
import org.apidesign.bck2brwsr.core.JavaScriptBody;
jaroslav@1170
    21
jaroslav@1170
    22
/**
jaroslav@1170
    23
 *
jaroslav@1170
    24
 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@1170
    25
 */
jaroslav@1170
    26
public class JsMethods {
jaroslav@1170
    27
    @JavaScriptBody(args = {}, body = "return 42;")
jaroslav@1170
    28
    public static Object fortyTwo() {
jaroslav@1170
    29
        return -42;
jaroslav@1170
    30
    }
jaroslav@1170
    31
    
jaroslav@1170
    32
    @JavaScriptBody(args = {"x", "y" }, body = "return x + y;")
jaroslav@1176
    33
    public static native int plus(int x, int y);
jaroslav@1178
    34
    
jaroslav@1178
    35
    @JavaScriptBody(args = {"x"}, body = "return x;")
jaroslav@1178
    36
    public static native int plus(int x);
jaroslav@1181
    37
    
jaroslav@1181
    38
    @JavaScriptBody(args = {}, body = "return this;")
jaroslav@1181
    39
    public static native Object staticThis();
jaroslav@1181
    40
    
jaroslav@1181
    41
    @JavaScriptBody(args = {}, body = "return this;")
jaroslav@1181
    42
    public native Object getThis();
jaroslav@1181
    43
    @JavaScriptBody(args = {"x"}, body = "return x;")
jaroslav@1181
    44
    public native int plusInst(int x);
jaroslav@1170
    45
}