Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
208bafba
Commit
208bafba
authored
May 06, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Kernel#fail definition to mruby-kernel-ext mrbgem.
parent
98a61083
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
7 deletions
+28
-7
include/mruby/error.h
include/mruby/error.h
+3
-0
mrbgems/mruby-kernel-ext/mrbgem.rake
mrbgems/mruby-kernel-ext/mrbgem.rake
+5
-0
mrbgems/mruby-kernel-ext/src/kernel.c
mrbgems/mruby-kernel-ext/src/kernel.c
+15
-0
mrbgems/mruby-kernel-ext/test/kernel.rb
mrbgems/mruby-kernel-ext/test/kernel.rb
+4
-0
src/kernel.c
src/kernel.c
+1
-3
test/t/kernel.rb
test/t/kernel.rb
+0
-4
No files found.
include/mruby/error.h
View file @
208bafba
...
@@ -21,6 +21,9 @@ void mrb_print_backtrace(mrb_state *mrb);
...
@@ -21,6 +21,9 @@ void mrb_print_backtrace(mrb_state *mrb);
mrb_value
mrb_exc_backtrace
(
mrb_state
*
mrb
,
mrb_value
exc
);
mrb_value
mrb_exc_backtrace
(
mrb_state
*
mrb
,
mrb_value
exc
);
mrb_value
mrb_get_backtrace
(
mrb_state
*
mrb
);
mrb_value
mrb_get_backtrace
(
mrb_state
*
mrb
);
/* declaration for fail method */
mrb_value
mrb_f_raise
(
mrb_state
*
,
mrb_value
);
#if defined(__cplusplus)
#if defined(__cplusplus)
}
/* extern "C" { */
}
/* extern "C" { */
#endif
#endif
...
...
mrbgems/mruby-kernel-ext/mrbgem.rake
0 → 100644
View file @
208bafba
MRuby
::
Gem
::
Specification
.
new
(
'mruby-kernel-ext'
)
do
|
spec
|
spec
.
license
=
'MIT'
spec
.
author
=
'mruby developers'
spec
.
summary
=
'extensional Kernel module'
end
mrbgems/mruby-kernel-ext/src/kernel.c
0 → 100644
View file @
208bafba
#include <mruby.h>
#include <mruby/error.h>
void
mrb_mruby_kernel_ext_gem_init
(
mrb_state
*
mrb
)
{
struct
RClass
*
krn
=
mrb
->
kernel_module
;
mrb_define_module_function
(
mrb
,
krn
,
"fail"
,
mrb_f_raise
,
MRB_ARGS_NONE
());
}
void
mrb_mruby_kernel_ext_gem_final
(
mrb_state
*
mrb
)
{
}
mrbgems/mruby-kernel-ext/test/kernel.rb
0 → 100644
View file @
208bafba
assert
(
'Kernel.fail, Kernel#fail'
)
do
assert_raise
(
RuntimeError
)
{
fail
}
assert_raise
(
RuntimeError
)
{
Kernel
.
fail
}
end
src/kernel.c
View file @
208bafba
...
@@ -924,7 +924,7 @@ mrb_obj_public_methods(mrb_state *mrb, mrb_value self)
...
@@ -924,7 +924,7 @@ mrb_obj_public_methods(mrb_state *mrb, mrb_value self)
* raise "Failed to create socket"
* raise "Failed to create socket"
* raise ArgumentError, "No parameters", caller
* raise ArgumentError, "No parameters", caller
*/
*/
static
mrb_value
mrb_value
mrb_f_raise
(
mrb_state
*
mrb
,
mrb_value
self
)
mrb_f_raise
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
mrb_value
a
[
2
],
exc
;
mrb_value
a
[
2
],
exc
;
...
@@ -1189,8 +1189,6 @@ mrb_init_kernel(mrb_state *mrb)
...
@@ -1189,8 +1189,6 @@ mrb_init_kernel(mrb_state *mrb)
mrb_define_method
(
mrb
,
krn
,
"to_s"
,
mrb_any_to_s
,
MRB_ARGS_NONE
());
/* 15.3.1.3.46 */
mrb_define_method
(
mrb
,
krn
,
"to_s"
,
mrb_any_to_s
,
MRB_ARGS_NONE
());
/* 15.3.1.3.46 */
mrb_define_method
(
mrb
,
krn
,
"__case_eqq"
,
mrb_obj_ceqq
,
MRB_ARGS_REQ
(
1
));
/* internal */
mrb_define_method
(
mrb
,
krn
,
"__case_eqq"
,
mrb_obj_ceqq
,
MRB_ARGS_REQ
(
1
));
/* internal */
mrb_define_module_function
(
mrb
,
krn
,
"fail"
,
mrb_f_raise
,
MRB_ARGS_NONE
());
mrb_include_module
(
mrb
,
mrb
->
object_class
,
mrb
->
kernel_module
);
mrb_include_module
(
mrb
,
mrb
->
object_class
,
mrb
->
kernel_module
);
mrb_alias_method
(
mrb
,
mrb
->
module_class
,
mrb_intern_lit
(
mrb
,
"dup"
),
mrb_intern_lit
(
mrb
,
"clone"
));
mrb_alias_method
(
mrb
,
mrb
->
module_class
,
mrb_intern_lit
(
mrb
,
"dup"
),
mrb_intern_lit
(
mrb
,
"clone"
));
}
}
test/t/kernel.rb
View file @
208bafba
...
@@ -563,7 +563,3 @@ assert('stack extend') do
...
@@ -563,7 +563,3 @@ assert('stack extend') do
end
end
end
end
assert
(
'Kernel.fail, Kernel#fail'
)
do
assert_raise
(
RuntimeError
)
{
fail
}
assert_raise
(
RuntimeError
)
{
Kernel
.
fail
}
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment