pike.git
/
src
/
program.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/program.c:1:
/* || 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.
688
2008/05/
04
16
:
49
:
07
grubba Exp $
+
|| $Id: program.c,v 1.
689
2008/05/
08
10
:
50
:
19
grubba Exp $
*/ #include "global.h" #include "program.h" #include "object.h" #include "dynamic_buffer.h" #include "pike_types.h" #include "stralloc.h" #include "las.h" #include "lex.h"
pike.git/src/program.c:10183:
*/ return is_compatible_cache[hval].ret; } /* Explains why a is not compatible with b */ void yyexplain_not_compatible(struct program *a, struct program *b, int flags) { int e; struct pike_string *s=findstring("__INIT"); int res = 1;
+
INT32 a_line = 0;
+
INT32 b_line = 0;
+
struct pike_string *a_file;
+
struct pike_string *b_file;
DECLARE_CYCLIC(); /* Optimize the loop somewhat */ if (a->num_identifier_references < b->num_identifier_references) { struct program *tmp = a; a = b; b = tmp; } if (BEGIN_CYCLIC(a, b)) { END_CYCLIC(); return; } SET_CYCLIC_RET(1);
-
+
a_file = get_program_line(a, &a_line);
+
b_file = get_program_line(b, &b_line);
+
for(e=0;e<b->num_identifier_references;e++) { struct identifier *bid; int i; if (b->identifier_references[e].id_flags & (ID_STATIC|ID_HIDDEN)) continue; /* Skip static & hidden */ /* FIXME: What if they aren't static & hidden in a? */ bid = ID_FROM_INT(b,e); if(s == bid->name) continue; /* Skip __INIT */ i = find_shared_string_identifier(bid->name,a); if (i == -1) { continue; /* It's ok... */ } /* Note: Uses weaker check for constant integers. */ if(((bid->run_time_type != PIKE_T_INT) || (ID_FROM_INT(a, i)->run_time_type != PIKE_T_INT)) && !match_types(ID_FROM_INT(a,i)->type, bid->type)) {
-
if (flags & YYTE_IS_WARNING)
-
yywarning
("Identifier %
S
is incompatible
.
"
,
bid->name);
-
else
-
my
_
yyerror
("
Identifier
%
S
is
incompatible.
"
,
bid->name);
+
if (flags & YYTE_IS_WARNING)
{
+
push_int
(
REPORT_WARNING);
+
push_int(REPORT_WARNING);
+
} else {
+
push_int(REPORT_ERROR);
+
push_int(REPORT_ERROR);
+
}
+
ref_push_string(a_file);
+
push_int(a_line);
+
push_constant_text(
"
type_check");
+
push_constant_text("
Identifier %
s
in %O
is incompatible"
);
+
ref_push_string(
bid->name);
+
ref_push_program(a);
+
safe_apply_current2(PC_REPORT_FUN_NUM,
7,
"report");
+
pop
_
stack
(
);
+
ref_push_string(b_file);
+
push_int(b_line);
+
push_constant_text(
"
type_check");
+
push_constant_text("with identifier
%
s
in
%O
"
);
+
ref_push_string(
bid->name);
+
ref_push_program(b);
+
safe_apply_current2(PC_REPORT_FUN_NUM, 7, "report");
+
pop_stack();
yytype_error(NULL, ID_FROM_INT(a,i)->type, bid->type, flags); } }
-
+
free_string(b_file);
+
free_string(a_file);
END_CYCLIC(); return; } /* Explains why a does not implement b */ void yyexplain_not_implements(struct program *a, struct program *b, int flags) { int e; struct pike_string *s=findstring("__INIT"); DECLARE_CYCLIC();