pike.git
/
src
/
program.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/program.c:5893:
* if func isn't given, it is supposed to be a prototype. */ INT32 define_function(struct pike_string *name, struct pike_type *type, unsigned flags, unsigned function_flags, union idptr *func, unsigned opt_flags) { struct compilation *c = THIS_COMPILATION;
+
struct program *prog = Pike_compiler->new_program;
struct identifier *funp,fun; struct reference ref; struct svalue *lfun_type; int run_time_type = T_FUNCTION; INT32 i; int getter_setter = -1; int is_setter = 0; CHECK_COMPILER();
pike.git/src/program.c:5988:
level = REPORT_ERROR; } else if (c->lex.pragmas & ID_STRICT_TYPES) { level = REPORT_WARNING; } yytype_report(level, NULL, 0, gs_type, NULL, 0, type, 0, "Type mismatch for callback function %S:", name); } i = isidentifier(symbol); if ((i >= 0) &&
-
!((ref = PTR_FROM_INT(
Pike_compiler->new_program
, i))->
-
id_flags & ID_INHERITED)) {
+
!((ref = PTR_FROM_INT(
prog
, i))->id_flags & ID_INHERITED)) {
/* Not an inherited symbol. */
-
struct identifier *id = ID_FROM_INT(
Pike_compiler->new_program
, i);
+
struct identifier *id = ID_FROM_INT(
prog
, i);
if (!IDENTIFIER_IS_VARIABLE(id->identifier_flags)) { my_yyerror("Illegal to redefine function %S with variable.", symbol); } else if (id->run_time_type != PIKE_T_GET_SET) { my_yyerror("Illegal to redefine a current variable with a getter/setter: %S.", symbol); } else { if ((ref->id_flags | ID_USED) != (flags | ID_USED)) { if (Pike_compiler->compiler_pass == 1) { yywarning("Modifier mismatch for variable %S.", symbol); } ref->id_flags &= flags | ID_USED; } getter_setter = i; } /* FIXME: Update id->type here. */ } else { struct identifier *id; i = low_define_variable(symbol, symbol_type, flags, ~0, PIKE_T_GET_SET);
-
id = ID_FROM_INT(
Pike_compiler->new_program
, i);
+
id = ID_FROM_INT(
prog
, i);
/* Paranoia. */ id->func.gs_info.getter = -1; id->func.gs_info.setter = -1; getter_setter = i; } /* NOTE: The function needs to have the same PRIVATE/INLINE * behaviour as the variable for overloading to behave * as expected. * * FIXME: Force PRIVATE? */ flags |= ID_PROTECTED /* | ID_PRIVATE | ID_INLINE | ID_USED */; free_type(symbol_type); free_string(symbol); } } if(IDENTIFIER_IS_C_FUNCTION(function_flags))
-
Pike_compiler
->
new_program->
flags |= PROGRAM_HAS_C_METHODS;
+
prog
->flags |= PROGRAM_HAS_C_METHODS;
if (Pike_compiler->compiler_pass == 1) { /* Mark the type as tentative by setting the runtime-type * to T_MIXED. * * NOTE: This should be reset to T_FUNCTION in pass 2. */ run_time_type = T_MIXED; }
pike.git/src/program.c:6055:
{ int overridden; /* already defined */ #ifdef PROGRAM_BUILD_DEBUG fprintf(stderr, "%.*sexisted as identifier #%d\n", c->compilation_depth, "", i); #endif
-
funp=ID_FROM_INT(
Pike_compiler->new_program
, i);
-
ref=
Pike_compiler
->
new_program->
identifier_references[i];
+
funp
=
ID_FROM_INT(
prog
, i);
+
ref
=
prog
->identifier_references[i];
if (funp->identifier_flags & IDENTIFIER_HAS_BODY) /* Keep this flag. */ function_flags |= IDENTIFIER_HAS_BODY; if(!(ref.id_flags & ID_INHERITED)) /* not inherited */ { if( !( IDENTIFIER_IS_FUNCTION(funp->identifier_flags) && ( (!func || func->offset == -1) || (funp->func.offset == -1)))) { my_yyerror("Identifier %S defined twice.", name); if (getter_setter != -1) {
-
struct identifier *id = ID_FROM_INT(
Pike_compiler->new_program
,
-
getter_setter);
+
struct identifier *id = ID_FROM_INT(
prog
, getter_setter);
(&id->func.gs_info.getter)[is_setter] = i; } return i; } /* Note: The type from pass 1 may be incompatible with the one from * pass 2. Only do this in pass 2, and only if the previous * type isn't from pass 1. */ if ((Pike_compiler->compiler_pass == 2) &&
pike.git/src/program.c:6131:
} if(ref.id_flags & ID_INLINE) { #ifdef PROGRAM_BUILD_DEBUG fprintf(stderr, "%.*sidentifier is local\n", c->compilation_depth, ""); #endif /* Hide the previous definition, and make a new definition. */
-
Pike_compiler
->
new_program->
identifier_references[i].id_flags |=
-
ID_PROTECTED;
+
prog
->identifier_references[i].id_flags |= ID_PROTECTED;
goto make_a_new_def; } /* Otherwise we alter the existing definition */ #ifdef PROGRAM_BUILD_DEBUG fprintf(stderr, "%.*saltering the existing definition\n", c->compilation_depth, ""); #endif copy_shared_string(fun.name, name);
pike.git/src/program.c:6158:
fun.identifier_flags=function_flags; if(func) fun.func = *func; else fun.func.offset = -1; fun.opt_flags = opt_flags;
-
ref.identifier_offset=
Pike_compiler
->
new_program->
num_identifiers;
+
ref.identifier_offset
=
prog
->num_identifiers;
debug_add_to_identifiers(fun); } if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED; ref.inherit_offset = 0; ref.id_flags = flags; if (flags & ID_VARIANT) { ref.id_flags |= ID_USED;
-
Pike_compiler
->
new_program->
identifier_references[i] = ref;
+
prog
->identifier_references[i] = ref;
overridden = i; } else { overridden = override_identifier(&ref, name); } if (overridden >= 0) { #ifdef PIKE_DEBUG
-
struct reference *oref =
-
Pike_compiler
->
new_program->
identifier_references+overridden;
+
struct reference *oref =
prog
->identifier_references+overridden;
if((oref->inherit_offset != ref.inherit_offset) || (oref->identifier_offset != ref.identifier_offset) || ((oref->id_flags | ID_USED) != (ref.id_flags | ID_USED))) { fprintf(stderr, "ref: %d:%d 0x%04x\n" "got: %d:%d 0x%04x (%d)\n", ref.inherit_offset, ref.identifier_offset, ref.id_flags, oref->inherit_offset, oref->identifier_offset, oref->id_flags, overridden); Pike_fatal("New function overloading algorithm failed!\n"); } #endif if (getter_setter != -1) {
-
struct identifier *id = ID_FROM_INT(
Pike_compiler->new_program
,
-
getter_setter);
+
struct identifier *id = ID_FROM_INT(
prog
, getter_setter);
INT32 old_i = (&id->func.gs_info.getter)[is_setter]; if ((old_i >= 0) && (old_i != overridden)) { my_yyerror("Multiple definitions for %S.", name); } (&id->func.gs_info.getter)[is_setter] = overridden; } return overridden; } /* NOTE: At this point we already have the identifier in the * new program, and just need to add the reference.
pike.git/src/program.c:6237:
else fun.func.offset = -1; fun.opt_flags = opt_flags; #ifdef PIKE_DEBUG if (a_flag > 5) { fprintf(stderr, "Adding new function #%d: '%s'\n" " identifier_flags:0x%02x opt_flags:0x%04x\n",
-
Pike_compiler
->
new_program->
num_identifiers,
+
prog
->num_identifiers,
fun.name->str, fun.identifier_flags, fun.opt_flags); } #endif /* PIKE_DEBUG */
-
i=
Pike_compiler
->
new_program->
num_identifiers;
+
i
=
prog
->num_identifiers;
debug_add_to_identifiers(fun); if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED; ref.id_flags = flags; ref.identifier_offset = i; ref.inherit_offset = 0; } ref.run_time_type = PIKE_T_UNKNOWN; /* Add the reference. */
-
i=
Pike_compiler
->
new_program->
num_identifier_references;
+
i
=
prog
->num_identifier_references;
add_to_identifier_references(ref); #ifdef PROGRAM_BUILD_DEBUG fprintf(stderr, "%.*sadded new definition #%d\n", c->compilation_depth, "", i); #endif if (getter_setter != -1) {
-
struct identifier *id = ID_FROM_INT(
Pike_compiler->new_program
,
-
getter_setter);
+
struct identifier *id = ID_FROM_INT(
prog
, getter_setter);
INT32 old_i = (&id->func.gs_info.getter)[is_setter]; if (old_i >= 0) { my_yyerror("Multiple definitions for %S.", name); } (&id->func.gs_info.getter)[is_setter] = i; } return i; }