pike.git/
src/
program.c
Branch:
Tag:
Non-build tags
All tags
No tags
2007-10-12
2007-10-12 12:59:12 by Henrik Grubbström (Grubba) <grubba@grubba.org>
30893e83c1dc1b4acae543ec7b378d697aa5b84d (
36
lines) (+
25
/-
11
)
[
Show
|
Annotate
]
Branch:
7.9
Fixed issues with the type checking for overloading of functions.
Rev: src/program.c:1.623
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: program.c,v 1.
622
2007/10/
11
15
:
46
:
57
grubba Exp $
+
|| $Id: program.c,v 1.
623
2007/10/
12
12
:
59
:
12
grubba Exp $
*/ #include "global.h"
1997:
/* Check if the symbol was used before it was inherited. */ if (sub_ref->id_flags & ID_USED) {
-
if (!pike_types_le(ID_FROM_PTR(inh->prog, sub_ref)->type,
+
struct identifier *sub_id = ID_FROM_PTR(inh->prog, sub_ref);
+
if (
IDENTIFIER_IS_FUNCTION(sub_id->identifier_flags)) {
+
if (
!pike_types_le(ID_FROM_PTR(
Pike_compiler->new_program,
+
new_ref)->type, sub_id->type)) {
+
yywarning("Type mismatch when overloading function %S.", name);
+
yytype_error(NULL,
+
ID_FROM_PTR(
inh->prog, sub_ref)->type,
+
ID_FROM_PTR(Pike_compiler->new_program, new_ref)->type,
+
YYTE_IS_WARNING);
+
}
+
} else {
+
/* Variable or constant. */
+
if (!pike_types_le(sub_id->type,
ID_FROM_PTR(Pike_compiler->new_program, new_ref)->type)) { yywarning("Type mismatch when overloading %S.", name);
2008:
} } }
+
}
is_used = ref->id_flags & ID_USED; *ref=*new_ref;
2098:
{ if (funp->id_flags & ID_USED) { /* Verify that the types are compatible. */
-
if (!pike_types_le(
fun
->type,
funb
->type)) {
+
if (!pike_types_le(
funb
->type,
fun
->type)) {
yywarning("Type mismatch when overloading %S.", fun->name); yytype_error(NULL, fun->type, funb->type, YYTE_IS_WARNING); }
2110:
{ if (funpb->id_flags & ID_USED) { /* Verify that the types are compatible. */
-
if (!pike_types_le(
funb
->type,
fun
->type)) {
+
if (!pike_types_le(
fun
->type,
funb
->type)) {
yywarning("Type mismatch when overloading %S.", fun->name); yytype_error(NULL, funb->type, fun->type, YYTE_IS_WARNING); }