pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1996:    add_ref(ret->name = ident);    free_node(tmp);    return ret;   }      /*! @decl constant UNDEFINED    *!    *! The undefined value; ie a zero for which @[zero_type()] returns 1.    */    - struct node_s *resolve_identifier(struct pike_string *ident) + int low_resolve_identifier(struct pike_string *ident)   {    struct compilation *c = THIS_COMPILATION;    node *ret = NULL;       /* Handle UNDEFINED */    if (ident == UNDEFINED_string) { -  return mkconstantsvaluenode(&svalue_undefined); +  push_undefined(); +  return 1;    }       if(c->resolve_cache)    {    struct svalue *tmp=low_mapping_string_lookup(c->resolve_cache,ident);    if(tmp)    { -  if(!IS_UNDEFINED (tmp)) -  return mkconstantsvaluenode(tmp); -  +  if(IS_UNDEFINED (tmp)) {    return 0;    } -  +  +  push_svalue(tmp); +  return 1;    } -  +  }       CHECK_COMPILER();       ref_push_string(ident);    ref_push_string(c->lex.current_file);    if (c->handler) {    ref_push_object(c->handler);    } else {    push_int(0);    }
pike.git/src/program.c:2061:    my_yyerror("Got placeholder %s (resolver problem) "    "when resolving '%S'.",    get_name_of_type (TYPEOF(Pike_sp[-1])), ident);    } else {    if(!c->resolve_cache)    c->resolve_cache=dmalloc_touch(struct mapping *, allocate_mapping(10));    mapping_string_insert(c->resolve_cache,ident,Pike_sp-1);       if(!IS_UNDEFINED (Pike_sp-1))    { -  ret=mkconstantsvaluenode(Pike_sp-1); +  return 1;    }    }    pop_stack();    -  +  return 0; + } +  + struct node_s *resolve_identifier(struct pike_string *ident) + { +  node *ret = NULL; +  +  if (low_resolve_identifier(ident)) { +  ret = mkconstantsvaluenode(Pike_sp-1); +  pop_stack(); +  }    return ret;   }      /**    * This function is intended to simplify resolving of    * program symbols during compile-time for C-modules.    *    * A typical use-case is for a C-module inheriting    * code written in Pike.    */