jsweet/transpiler/src/test/java/source/syntax/SpecialFunctions.java
2017-01-04 16:16:42 +01:00

50 lines
1.3 KiB
Java

/*
* JSweet - http://www.jsweet.org
* Copyright (C) 2015 CINCHEO SAS <renaud.pawlak@cincheo.fr>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package source.syntax;
import static jsweet.util.Globals.$apply;
import static jsweet.util.Globals.$new;
public class SpecialFunctions {
void m(ApplyI1 a1, ConstrI1 c1) {
a1.apply();
a1.apply("test");
c1.$new("test");
}
void m2(Object o) {
@SuppressWarnings("unused")
Object result1 = $apply(o, "param");
@SuppressWarnings("unused")
Object result2 = $new(o, "param");
}
}
@jsweet.lang.Interface
abstract class ApplyI1 extends def.js.Object {
abstract public String apply();
abstract public ApplyI1 apply(String a);
}
@jsweet.lang.Interface
abstract class ConstrI1 extends def.js.Object {
abstract public ConstrI1 $new(String a);
}