diff --git a/SWIG/Source/Swig/parms.c b/SWIG/Source/Swig/parms.c index ff8614224..645c872a1 100644 --- a/SWIG/Source/Swig/parms.c +++ b/SWIG/Source/Swig/parms.c @@ -23,10 +23,10 @@ char cvsroot_parms_c[] = "$Header$"; /* ------------------------------------------------------------------------ * NewParm() * - * Create a new parameter from datatype 'type' and name 'n'. + * Create a new parameter from datatype 'type' and name 'name'. * ------------------------------------------------------------------------ */ -Parm *NewParm(SwigType *type, const String_or_char *n) { +Parm *NewParm(SwigType *type, const String_or_char *name) { Parm *p = NewHash(); if (type) { @@ -34,7 +34,23 @@ Parm *NewParm(SwigType *type, const String_or_char *n) { Setattr(p,"type",ntype); Delete(ntype); } - Setattr(p,"name",n); + Setattr(p,"name",name); + return p; +} + +/* ------------------------------------------------------------------------ + * NewParmFromNode() + * + * Create a new parameter from datatype 'type' and name 'name'. + * Sets the file and line number for the parameter for error handling by + * making a (shallow) copy of file and line number from Node 'n'. + * ------------------------------------------------------------------------ */ + +Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) { + Parm *p = NewParm(type, name); + Setfile(p, Getfile(n)); + Setline(p, Getline(n)); + return p; } diff --git a/SWIG/Source/Swig/swig.h b/SWIG/Source/Swig/swig.h index afc54d762..a97e5536b 100644 --- a/SWIG/Source/Swig/swig.h +++ b/SWIG/Source/Swig/swig.h @@ -332,7 +332,8 @@ extern SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symt /* Parameters are really just hidden behind a DOH object. The following interface will probably be simplified even further. */ -extern Parm *NewParm(SwigType *type, const String_or_char *n); +extern Parm *NewParm(SwigType *type, const String_or_char *name); +extern Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n); extern Parm *CopyParm(Parm *p); extern ParmList *CopyParmList(ParmList *); extern int ParmList_len(ParmList *);