pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2009-02-21
2009-02-21 12:54:38 by Henrik Grubbström (Grubba) <grubba@grubba.org>
99f32f40624546568fba7b5e32f56682432ab4b0 (
26
lines) (+
18
/-
8
)
[
Show
|
Annotate
]
Branch:
7.9
function_name() now knows how to adjust the names of named lambdas.
Rev: src/builtin.cmod:1.227
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: builtin.cmod,v 1.
226
2008
/
11/
02
19
:
57
:
58
grubba Exp $
+
|| $Id: builtin.cmod,v 1.
227
2009
/
02
/
21
12
:
54
:
38
grubba Exp $
*/ #include "global.h"
950:
RETURN prog; }
+
/* Cut the string at the first NUL. */
+
static struct pike_string *delambda(struct pike_string *str)
+
{
+
PCHARP pcharp = MKPCHARP_STR(str);
+
ptrdiff_t len = pcharp_strlen(pcharp);
+
if (len == str->len) {
+
/* Common case. */
+
add_ref(str);
+
return str;
+
}
+
return make_shared_binary_pcharp(pcharp, len);
+
}
+
/*! @decl string function_name(function f) *! *! Return the name of the function @[f].
1020:
struct pike_trampoline *t; t=((struct pike_trampoline *)func->u.object->storage);
-
/* FIXME: Adjust lambda names. */
-
+
if(t->frame->current_object->prog)
-
REF_
RETURN ID_FROM_INT(t->frame->current_object->prog,
-
t->func)->name;
+
RETURN
delambda(
ID_FROM_INT(t->frame->current_object->prog,
+
t->func)->name
)
;
}
-
/* FIXME: Adjust lambda names. */
-
-
REF_
RETURN ID_FROM_INT(func->u.object->prog, func->subtype)->name;
+
RETURN
delambda(
ID_FROM_INT(func->u.object->prog, func->subtype)->name
)
;
} pop_n_elems(args); push_int(0);