mirror of https://github.com/tildeio/helix
Revert "Allow calling init seperately"
This commit is contained in:
parent
73e0534a17
commit
ca60150948
|
@ -82,10 +82,3 @@ hello
|
||||||
hello world
|
hello world
|
||||||
=> nil
|
=> nil
|
||||||
```
|
```
|
||||||
|
|
||||||
To run all tests in the repository, run
|
|
||||||
|
|
||||||
```shell
|
|
||||||
rake install
|
|
||||||
rake
|
|
||||||
```
|
|
||||||
|
|
|
@ -100,9 +100,6 @@ module HelixRuntime
|
||||||
if ENV['VERBOSE']
|
if ENV['VERBOSE']
|
||||||
cargo_args << " --verbose"
|
cargo_args << " --verbose"
|
||||||
end
|
end
|
||||||
if ENV['CARGO_EXTRA_ARGS']
|
|
||||||
cargo_args << ENV['CARGO_EXTRA_ARGS']
|
|
||||||
end
|
|
||||||
if link_args
|
if link_args
|
||||||
rustc_args << "-C link-args=#{link_args}"
|
rustc_args << "-C link-args=#{link_args}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,7 +49,3 @@ pub type ToRubyResult = Result<VALUE, Error>;
|
||||||
pub trait ToRuby {
|
pub trait ToRuby {
|
||||||
fn to_ruby(self) -> ToRubyResult;
|
fn to_ruby(self) -> ToRubyResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait InitRuby {
|
|
||||||
fn init_ruby();
|
|
||||||
}
|
|
|
@ -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_export]
|
||||||
macro_rules! codegen_extra_impls {
|
macro_rules! codegen_extra_impls {
|
||||||
($class:tt) => (
|
($class:tt) => (
|
||||||
codegen_allocator!($class);
|
codegen_allocator!($class);
|
||||||
codegen_coercions!($class);
|
codegen_coercions!($class);
|
||||||
codegen_ruby_init!($class);
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! codegen_init {
|
macro_rules! codegen_init {
|
||||||
// Extracts the list of rust class names and calls the actual codegen_init with that
|
{ [ $($class:tt)* ] } => {
|
||||||
{ [ $({
|
|
||||||
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)* ] } => {
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Init_native() {
|
pub extern "C" fn Init_native() {
|
||||||
use $crate::InitRuby;
|
|
||||||
$crate::sys::check_version();
|
$crate::sys::check_version();
|
||||||
|
|
||||||
$(
|
$(
|
||||||
$rust_name::init_ruby();
|
codegen_class_binding!($class, $class);
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! codegen_class_binding {
|
macro_rules! codegen_class_binding {
|
||||||
{ $class:tt, {
|
{ $class:tt, {
|
||||||
|
|
Loading…
Reference in New Issue