pike.git / src / las.c

version» Context lines:

pike.git/src/las.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: las.c,v 1.341 2003/11/09 01:10:13 mast Exp $ + || $Id: las.c,v 1.342 2003/11/14 00:13:36 mast Exp $   */      #include "global.h" - RCSID("$Id: las.c,v 1.341 2003/11/09 01:10:13 mast Exp $"); + RCSID("$Id: las.c,v 1.342 2003/11/14 00:13:36 mast Exp $");      #include "language.h"   #include "interpret.h"   #include "las.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "lex.h"   #include "pike_types.h"
pike.git/src/las.c:1825:      node *index_node(node *n, char *node_name, struct pike_string *id)   {    node *ret;    JMP_BUF tmp;       check_tree(n,0);       if(SETJMP(tmp))    { -  struct svalue thrown = throw_value; -  throw_value.type = T_INT; -  +     if (node_name) { -  my_yyerror("Couldn't index module '%s'.", node_name); +  handle_compile_exception ("Couldn't index module '%s'.", node_name);    } else { -  yyerror("Couldn't index module."); +  handle_compile_exception ("Couldn't index module.");    } -  -  push_svalue(&thrown); -  low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(Pike_sp-1)) yy_describe_exception(&thrown); -  pop_stack(); -  free_svalue(&thrown); +     }else{    resolv_constant(n);    switch(Pike_sp[-1].type)    {    case T_INT:    if(!Pike_compiler->num_parse_error) {    if (node_name) {    my_yyerror("Failed to index module '%s' with '%s' "    "(module doesn't exist?)",    node_name, id->str);
pike.git/src/las.c:1907:    {    ptrdiff_t c;    DECLARE_CYCLIC();    c = PTR_TO_INT(BEGIN_CYCLIC(Pike_sp[-1].u.refs, id));    if(c>1)    {    my_yyerror("Recursive module dependency in '%s'.",id->str);    pop_stack();    push_int(0);    }else{ -  struct svalue thrown = {PIKE_T_UNKNOWN, 0, - #ifdef HAVE_UNION_INIT -  {0} /* Only to avoid warnings. */ - #endif -  }; -  +  int exception = 0;    SET_CYCLIC_RET(c+1);    ref_push_string(id);    {    JMP_BUF recovery;    STACK_LEVEL_START(2);    if (SETJMP_SP(recovery, 2)) { -  /* f_index() threw an error! */ +  if (node_name) { +  handle_compile_exception ("Error looking up '%s' in module '%s'.", +  id->str, node_name); +  } else { +  handle_compile_exception ("Error looking up '%s' in module.", id->str); +  }    push_undefined(); -  thrown = throw_value; -  throw_value.type = T_INT; +  exception = 1;    } else {    f_index(2);    }    STACK_LEVEL_DONE(1);    UNSETJMP(recovery);    }       if(Pike_sp[-1].type == T_INT &&    !Pike_sp[-1].u.integer &&    Pike_sp[-1].subtype==NUMBER_UNDEFINED)    {    if(Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE)    { -  +  if (!exception) {    if (node_name) {    my_yyerror("Index '%s' not present in module '%s'.",    id->str, node_name);    } else {    my_yyerror("Index '%s' not present in module.", id->str);    } -  -  if (thrown.type != PIKE_T_UNKNOWN) { -  *(Pike_sp++) = thrown; -  dmalloc_touch_svalue(Pike_sp-1); -  thrown.type = PIKE_T_INT; -  low_safe_apply_handler("compile_exception", error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(Pike_sp-1)) yy_describe_exception(&thrown); -  pop_stack(); +     }    }else if (!force_resolve) {    /* Hope it's there in pass 2 */    pop_stack();   #if 0    fprintf(stderr, "Placeholder deployed when indexing ");    print_tree(n);    fprintf(stderr, "with %s\n", id->str);   #endif    ref_push_object(placeholder_object); -  if (thrown.type != PIKE_T_UNKNOWN) -  free_svalue(&thrown); +     }    }       else if ((Pike_compiler->new_program->flags & PROGRAM_PASS_1_DONE) &&    ((Pike_sp[-1].type == T_OBJECT &&    Pike_sp[-1].u.object == placeholder_object) ||    (Pike_sp[-1].type == T_PROGRAM &&    Pike_sp[-1].u.program == placeholder_program)) &&    /* Ugly special case: We must be able to get    * predef::__placeholder_object. */
pike.git/src/las.c:5447:       tmp_callback=add_to_callback(&evaluator_callbacks,    check_evaluation_time,    (void *)&foo,0);       if(apply_low_safe_and_stupid(Pike_compiler->fake_object, jump))    {    if(print_error)    /* Generate error message */    if(!Pike_compiler->catch_level) -  { -  struct svalue thrown = throw_value; -  throw_value.type = T_INT; -  yyerror("Error evaluating constant.\n"); -  push_svalue(&thrown); -  low_safe_apply_handler("compile_exception", -  error_handler, compat_handler, 1); -  if (SAFE_IS_ZERO(Pike_sp-1)) yy_describe_exception(&thrown); -  pop_stack(); -  free_svalue(&thrown); -  } +  handle_compile_exception ("Error evaluating constant.\n");    else {    free_svalue(&throw_value);    throw_value.type = T_INT;    }    else {    free_svalue(&throw_value);    throw_value.type = T_INT;    /* Assume the node will throw errors at runtime too. */    n->tree_info |= OPT_SIDE_EFFECT;    n->node_info |= OPT_SIDE_EFFECT;