pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2014-12-04
2014-12-04 19:22:57 by Tobias S. Josefowitz <tobij@tobij.de>
d00f08ff094bccf00700dbc43127c169881761ac (
22
lines) (+
5
/-
17
)
[
Show
|
Annotate
]
Branch:
bill/master_archive_support
Program.inherits(): turns out you can do that in 4 lines of code.
1011:
errname Program.inherits; optflags OPT_TRY_OPTIMIZE; {
-
if
(TYPEOF(
*
child)
=
=
PIKE
_
T
_
PROGRAM)
-
RETURN low_get_storage
(child
->u.program, parent
)
!= -1
;
-
else if (TYPEOF(*child) == PIKE_T_OBJECT) {
-
struct program *p = child->u.object->prog;
+
struct
program
*
p
=
program
_
from
_
svalue
(child);
-
if (!p)
RETURN 0;
-
if (SUBTYPEOF(*child)) {
-
p = (p->inherits + SUBTYPEOF(*child))->prog;
-
if (p->flags & PROGRAM
_
USES
_
PARENT)
-
RETURN 0;
-
} else if ((p->flags & PROGRAM
_
USES_PARENT)
-
&& PARENT_INFO
(
child->u
.
object)->parent
-
&& PARENT_INFO(child->u.
object)
->parent->prog)
-
RETURN 0
;
+
if (!p)
+
SIMPLE
_
ARG
_
TYPE
_
ERROR
(
"Program
.
inherits",
1,
"program|
object
"
);
RETURN low_get_storage(p, parent) != -1; }
-
SIMPLE_ARG_TYPE_ERROR("Program.inherits", 1, "program|object");
-
}
-
+
/*! @decl string defined(program p) *! @belongs Program *!