Revert "Allow calling init seperately"

This commit is contained in:
Peter Wagenet 2019-07-29 13:12:56 -07:00 committed by GitHub
parent 73e0534a17
commit ca60150948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 66 deletions

View File

@ -82,10 +82,3 @@ hello
hello world
=> nil
```
To run all tests in the repository, run
```shell
rake install
rake
```

View File

@ -100,9 +100,6 @@ module HelixRuntime
if ENV['VERBOSE']
cargo_args << " --verbose"
end
if ENV['CARGO_EXTRA_ARGS']
cargo_args << ENV['CARGO_EXTRA_ARGS']
end
if link_args
rustc_args << "-C link-args=#{link_args}"
end

View File

@ -49,7 +49,3 @@ pub type ToRubyResult = Result<VALUE, Error>;
pub trait ToRuby {
fn to_ruby(self) -> ToRubyResult;
}
pub trait InitRuby {
fn init_ruby();
}

View File

@ -222,44 +222,10 @@ macro_rules! codegen_method {
};
}
#[macro_export]
macro_rules! codegen_ruby_init {
({
type: class,
rust_name: $rust_name:tt,
ruby_name: $ruby_name:tt,
meta: { pub: $pub:tt, reopen: $reopen:tt },
struct: $struct:tt,
methods: $methods:tt
}) => (
impl $crate::InitRuby for $rust_name {
fn init_ruby() {
codegen_class_binding!({
type: class,
rust_name: $rust_name,
ruby_name: $ruby_name,
meta: { pub: $pub, reopen: $reopen },
struct: $struct,
methods: $methods
}, {
type: class,
rust_name: $rust_name,
ruby_name: $ruby_name,
meta: { pub: $pub, reopen: $reopen },
struct: $struct,
methods: $methods
});
}
}
);
}
#[macro_export]
macro_rules! codegen_extra_impls {
($class:tt) => (
codegen_allocator!($class);
codegen_coercions!($class);
codegen_ruby_init!($class);
)
}
}

View File

@ -1,32 +1,18 @@
#[macro_export]
macro_rules! codegen_init {
// Extracts the list of rust class names and calls the actual codegen_init with that
{ [ $({
type: class,
rust_name: $rust_name:tt,
ruby_name: { $($ruby_name:tt) * },
meta: { pub: $pub:tt, reopen: $reopen:tt },
struct: $struct:tt,
methods: [ $($method:tt) * ]
})* ] } => (
codegen_init!{ [ $($rust_name)* ] }
);
{ [ $($rust_name:tt)* ] } => {
{ [ $($class:tt)* ] } => {
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn Init_native() {
use $crate::InitRuby;
$crate::sys::check_version();
$(
$rust_name::init_ruby();
codegen_class_binding!($class, $class);
)*
}
};
}
}
#[macro_export]
macro_rules! codegen_class_binding {
{ $class:tt, {