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
1c3d05b5
Commit
1c3d05b5
authored
Aug 16, 2014
by
go kikuta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor class.c methods (fix indent, remove unneed temp value. )
parent
ea959d44
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
32 deletions
+19
-32
src/class.c
src/class.c
+19
-32
No files found.
src/class.c
View file @
1c3d05b5
...
...
@@ -1444,7 +1444,7 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
mrb_str_append
(
mrb
,
str
,
mrb_any_to_s
(
mrb
,
v
));
break
;
}
mrb_str_cat_lit
(
mrb
,
str
,
">"
);
return
mrb_str_cat_lit
(
mrb
,
str
,
">"
);
}
else
{
struct
RClass
*
c
;
...
...
@@ -1470,14 +1470,12 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
break
;
}
mrb_str_concat
(
mrb
,
str
,
mrb_ptr_to_str
(
mrb
,
c
));
mrb_str_cat_lit
(
mrb
,
str
,
">"
);
return
mrb_str_cat_lit
(
mrb
,
str
,
">"
);
}
else
{
str
=
path
;
return
path
;
}
}
return
str
;
}
static
mrb_value
...
...
@@ -1610,25 +1608,23 @@ static mrb_value
mrb_mod_cvar_defined
(
mrb_state
*
mrb
,
mrb_value
mod
)
{
mrb_value
id
;
mrb_bool
defined_p
;
id
=
get_sym_or_str_arg
(
mrb
);
if
(
mrb_symbol_p
(
id
))
{
check_cv_name_sym
(
mrb
,
mrb_symbol
(
id
));
defined_p
=
mrb_cv_defined
(
mrb
,
mod
,
mrb_symbol
(
id
));
return
mrb_bool_value
(
mrb_cv_defined
(
mrb
,
mod
,
mrb_symbol
(
id
)
));
}
else
{
mrb_value
sym
;
check_cv_name_str
(
mrb
,
id
);
sym
=
mrb_check_intern_str
(
mrb
,
id
);
if
(
mrb_nil_p
(
sym
))
{
defined_p
=
FALSE
;
return
mrb_bool_value
(
FALSE
)
;
}
else
{
defined_p
=
mrb_cv_defined
(
mrb
,
mod
,
mrb_symbol
(
sym
));
return
mrb_bool_value
(
mrb_cv_defined
(
mrb
,
mod
,
mrb_symbol
(
sym
)
));
}
}
return
mrb_bool_value
(
defined_p
);
}
/* 15.2.2.4.17 */
...
...
@@ -1764,22 +1760,20 @@ static mrb_value
mrb_mod_method_defined
(
mrb_state
*
mrb
,
mrb_value
mod
)
{
mrb_value
id
;
mrb_bool
method_defined_p
;
id
=
get_sym_or_str_arg
(
mrb
);
if
(
mrb_symbol_p
(
id
))
{
method_defined_p
=
mrb_obj_respond_to
(
mrb
,
mrb_class_ptr
(
mod
),
mrb_symbol
(
id
));
return
mrb_bool_value
(
mrb_obj_respond_to
(
mrb
,
mrb_class_ptr
(
mod
),
mrb_symbol
(
id
)
));
}
else
{
mrb_value
sym
=
mrb_check_intern_str
(
mrb
,
id
);
if
(
mrb_nil_p
(
sym
))
{
method_defined_p
=
FALSE
;
return
mrb_false_value
()
;
}
else
{
method_defined_p
=
mrb_obj_respond_to
(
mrb
,
mrb_class_ptr
(
mod
),
mrb_symbol
(
sym
));
return
mrb_bool_value
(
mrb_obj_respond_to
(
mrb
,
mrb_class_ptr
(
mod
),
mrb_symbol
(
sym
)
));
}
}
return
mrb_bool_value
(
method_defined_p
);
}
static
void
...
...
@@ -1824,17 +1818,7 @@ mrb_mod_remove_method(mrb_state *mrb, mrb_value mod)
return
mod
;
}
static
void
check_const_name_sym
(
mrb_state
*
mrb
,
mrb_sym
id
)
{
const
char
*
s
;
mrb_int
len
;
s
=
mrb_sym2name_len
(
mrb
,
id
,
&
len
);
if
(
len
<
1
||
!
ISUPPER
(
*
s
))
{
mrb_name_error
(
mrb
,
id
,
"wrong constant name %S"
,
mrb_sym2str
(
mrb
,
id
));
}
}
static
void
check_const_name_str
(
mrb_state
*
mrb
,
mrb_value
str
)
...
...
@@ -1844,30 +1828,33 @@ check_const_name_str(mrb_state *mrb, mrb_value str)
}
}
static
void
check_const_name_sym
(
mrb_state
*
mrb
,
mrb_sym
id
)
{
check_const_name_str
(
mrb
,
mrb_sym2str
(
mrb
,
id
));
}
static
mrb_value
mrb_mod_const_defined
(
mrb_state
*
mrb
,
mrb_value
mod
)
{
mrb_value
id
;
mrb_bool
const_defined_p
;
id
=
get_sym_or_str_arg
(
mrb
);
if
(
mrb_type
(
id
)
==
MRB_TT_SYMBOL
)
{
check_const_name_sym
(
mrb
,
mrb_symbol
(
id
));
const_defined_p
=
mrb_const_defined
(
mrb
,
mod
,
mrb_symbol
(
id
));
return
mrb_bool_value
(
mrb_const_defined
(
mrb
,
mod
,
mrb_symbol
(
id
)
));
}
else
{
mrb_value
sym
;
check_const_name_str
(
mrb
,
id
);
sym
=
mrb_check_intern_str
(
mrb
,
id
);
if
(
mrb_nil_p
(
sym
))
{
const_defined_p
=
FALSE
;
return
mrb_false_value
()
;
}
else
{
const_defined_p
=
mrb_const_defined
(
mrb
,
mod
,
mrb_symbol
(
sym
));
return
mrb_bool_value
(
mrb_const_defined
(
mrb
,
mod
,
mrb_symbol
(
sym
)
));
}
}
return
mrb_bool_value
(
const_defined_p
);
}
static
mrb_value
...
...
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