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
c9caea64
Commit
c9caea64
authored
Jun 09, 2013
by
Daniel Bovensiepen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Singleton raises TypeError on #new
parent
16424a14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
src/class.c
src/class.c
+3
-0
test/t/class.rb
test/t/class.rb
+3
-7
No files found.
src/class.c
View file @
c9caea64
...
@@ -1047,6 +1047,9 @@ mrb_instance_new(mrb_state *mrb, mrb_value cv)
...
@@ -1047,6 +1047,9 @@ mrb_instance_new(mrb_state *mrb, mrb_value cv)
mrb_value
*
argv
;
mrb_value
*
argv
;
int
argc
;
int
argc
;
if
(
c
->
tt
==
MRB_TT_SCLASS
)
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"can't create instance of singleton class"
);
if
(
ttype
==
0
)
ttype
=
MRB_TT_OBJECT
;
if
(
ttype
==
0
)
ttype
=
MRB_TT_OBJECT
;
o
=
(
struct
RObject
*
)
mrb_obj_alloc
(
mrb
,
ttype
,
c
);
o
=
(
struct
RObject
*
)
mrb_obj_alloc
(
mrb
,
ttype
,
c
);
obj
=
mrb_obj_value
(
o
);
obj
=
mrb_obj_value
(
o
);
...
...
test/t/class.rb
View file @
c9caea64
...
@@ -30,13 +30,9 @@ assert('Class#initialize_copy', '15.2.3.3.2') do
...
@@ -30,13 +30,9 @@ assert('Class#initialize_copy', '15.2.3.3.2') do
end
end
assert
(
'Class#new'
,
'15.2.3.3.3'
)
do
assert
(
'Class#new'
,
'15.2.3.3.3'
)
do
# at the moment no exception on singleton class
assert_raise
(
TypeError
,
'Singleton should raise TypeError'
)
do
#e1 = nil
"a"
.
singleton_class
.
new
#begin
end
# class1 = e1.singleton_class.new
#rescue => e1
# e2 = e1
#end
class
TestClass
class
TestClass
def
initialize
args
,
&
block
def
initialize
args
,
&
block
...
...
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