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
f78d2fad
Commit
f78d2fad
authored
Jun 02, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:mruby/mruby
parents
e65d4938
7752d2ab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
12 deletions
+66
-12
CMakeLists.txt
CMakeLists.txt
+5
-4
src/codegen.c
src/codegen.c
+2
-6
src/struct.c
src/struct.c
+1
-1
test/t/kernel.rb
test/t/kernel.rb
+11
-1
test/t/module.rb
test/t/module.rb
+47
-0
No files found.
CMakeLists.txt
View file @
f78d2fad
...
...
@@ -33,12 +33,13 @@ project(mruby C)
# TODO stop polluting source tree with CMakeFiles/ and CMakeCache.txt
# on build location check failure
# Make sure we are not trying to generate in in-tree build unless building
# with a
MSVC
IDE where it's OK.
if
(
CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT
MSVC_IDE
)
# with a
n MSVC or Xcode
IDE where it's OK.
if
(
CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND
NOT
(
MSVC_IDE OR XCODE
)
)
message
(
FATAL_ERROR
"
\n
In-source builds are not allowed as CMake would overwrite the "
"Makefiles distributed with mruby. Please change to the 'build' "
"subdirectory and run CMake from there."
)
"Makefiles distributed with mruby. Delete any created 'CMakeFiles' "
"subdirectory and 'CMakeCache.txt' file from the current directory, "
"change to the 'build' subdirectory, and re-run CMake from there."
)
endif
()
if
(
COMMAND cmake_policy
)
...
...
src/codegen.c
View file @
f78d2fad
...
...
@@ -208,23 +208,19 @@ genop_peep(codegen_scope *s, mrb_code i, int val)
case
OP_SETCV
:
case
OP_SETCONST
:
case
OP_SETMCNST
:
switch
(
c0
)
{
case
OP_MOVE
:
if
(
c0
==
OP_MOVE
)
{
if
(
GETARG_A
(
i
)
==
GETARG_A
(
i0
))
{
s
->
iseq
[
s
->
pc
-
1
]
=
MKOP_ABx
(
c1
,
GETARG_B
(
i0
),
GETARG_Bx
(
i
));
return
;
}
break
;
}
break
;
case
OP_SETUPVAR
:
switch
(
c0
)
{
case
OP_MOVE
:
if
(
c0
==
OP_MOVE
)
{
if
(
GETARG_A
(
i
)
==
GETARG_A
(
i0
))
{
s
->
iseq
[
s
->
pc
-
1
]
=
MKOP_ABC
(
c1
,
GETARG_B
(
i0
),
GETARG_B
(
i
),
GETARG_C
(
i
));
return
;
}
break
;
}
break
;
case
OP_EPOP
:
...
...
src/struct.c
View file @
f78d2fad
...
...
@@ -416,7 +416,7 @@ mrb_struct_initialize_withArg(mrb_state *mrb, int argc, mrb_value *argv, mrb_val
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"struct size differs"
);
}
st
=
RSTRUCT
(
self
);
st
->
ptr
=
m
alloc
(
sizeof
(
mrb_value
)
*
argc
);
st
->
ptr
=
m
rb_malloc
(
mrb
,
sizeof
(
mrb_value
)
*
argc
);
st
->
len
=
n
;
memcpy
(
st
->
ptr
,
argv
,
sizeof
(
mrb_value
)
*
argc
);
//if (n > argc) {
...
...
test/t/kernel.rb
View file @
f78d2fad
...
...
@@ -112,7 +112,17 @@ assert('Kernel#respond_to?', '15.3.1.2.43') do
respond_to?
:
nil
?
end
# TODO at the moment doesn't comply to ISO assert('Kernel#send', '15.3.1.2.44') do
assert
(
'Kernel#send'
,
'15.3.1.2.44'
)
do
# test with block
l
=
send
(:
lambda
)
do
true
end
l
.
call
and
l
.
class
==
Proc
and
# test with argument
send
(
:respond_to?
,
:nil?
)
and
# test without argument and without block
send
(
:public_methods
).
class
==
Array
end
assert
(
'Kernel#singleton_methods'
,
'15.3.1.2.45'
)
do
singleton_methods
.
class
==
Array
...
...
test/t/module.rb
View file @
f78d2fad
...
...
@@ -5,6 +5,53 @@ assert('Module', '15.2.2') do
Module
.
class
==
Class
end
assert
(
'Module#const_defined?'
,
'15.2.2.4.20'
)
do
module
Test4ConstDefined
Const4Test4ConstDefined
=
true
end
Test4ConstDefined
.
const_defined?
(
:Const4Test4ConstDefined
)
and
not
Test4ConstDefined
.
const_defined?
(
:NotExisting
)
end
assert
(
'Module#const_get'
,
'15.2.2.4.21'
)
do
module
Test4ConstGet
Const4Test4ConstGet
=
42
end
Test4ConstGet
.
const_get
(
:Const4Test4ConstGet
)
==
42
end
assert
(
'Module.const_missing'
,
'15.2.2.4.22'
)
do
e1
=
nil
module
Test4ConstMissing
def
const_missing
(
sym
)
# ATM this redirect doesn't work
puts
"PLEASE GO TO TEST CASE Module.const_missing!"
puts
"IT IS WORKING NOW!! PLEASE FINALIZE."
puts
"Thanks :)"
end
end
begin
Test4ConstMissing
.
const_get
(
:ConstDoesntExist
)
rescue
=>
e2
e1
=
e2
end
e1
.
class
==
NameError
end
assert
(
'Module#const_get'
,
'15.2.2.4.23'
)
do
module
Test4ConstSet
Const4Test4ConstSet
=
42
end
Test4ConstSet
.
const_set
(
:Const4Test4ConstSet
,
23
)
Test4ConstSet
.
const_get
(
:Const4Test4ConstSet
)
==
23
end
# TODO not implemented ATM assert('Module.constants', '15.2.2') do
# TODO not implemented ATM assert('Module.nesting', '15.2.2') do
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