Home /Modules/impl/native_method_metadata_compile.sleela

native_method_metadata_compile.sleela

impl/tests/native_drive/native_method_metadata_compile.sleela · 23 line(s) · sleela

#sleela 3.0
class MathEngine {
    @native
    static int sum(int left, int right) {
        return left + right;
    }

    @native
    static int fallback(int value) {
        return value + 1;
    }

    static int check() {
        return fallback(sum(20, 22));
    }

    // Syntax 3.0 requires void main; the smoke harness selects check() as
    // its entry with slvm_find_func() so it can assert the returned value.
    static void main() {
        int result = check();
    }
}