mirror of https://github.com/swig/swig
take into account numinputs when counting arguments
This commit is contained in:
parent
1657a0a1ec
commit
edd55210bb
|
@ -0,0 +1,24 @@
|
|||
const ignore_parameter = require('ignore_parameter');
|
||||
|
||||
function check(a, b) {
|
||||
if (a !== b) throw new Error(`'${a}' != '${b}`);
|
||||
}
|
||||
|
||||
check(ignore_parameter.jaguar(200, 0), "hello");
|
||||
check(ignore_parameter.lotus("foo", 1), 101);
|
||||
check(ignore_parameter.tvr("bar", 2), 8.8);
|
||||
check(ignore_parameter.ferrari(), 101);
|
||||
check(ignore_parameter.fiat(17), 17);
|
||||
|
||||
car = new ignore_parameter.SportsCars();
|
||||
check(car.daimler(200, 0), "hello");
|
||||
check(car.astonmartin("foo", 1), 101);
|
||||
check(car.bugatti("bar", 2), 8.8);
|
||||
check(car.lamborghini(), 101);
|
||||
check(car.maseratti(289), 289);
|
||||
check(car.audi(), 8.8);
|
||||
|
||||
new ignore_parameter.MiniCooper(200, 0);
|
||||
new ignore_parameter.MorrisMinor("baz", 0);
|
||||
new ignore_parameter.FordAnglia("quux", 200);
|
||||
new ignore_parameter.AustinAllegro();
|
|
@ -264,8 +264,6 @@ protected:
|
|||
*/
|
||||
Node *getBaseClass(Node *n);
|
||||
|
||||
Parm *skipIgnoredArgs(Parm *p);
|
||||
|
||||
virtual int createNamespace(String *scope);
|
||||
|
||||
virtual Hash *createNamespaceEntry(const char *name, const char *parent, const char *parent_mangled);
|
||||
|
@ -689,17 +687,6 @@ int JSEmitter::initialize(Node * /*n */ ) {
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* skipIgnoredArgs()
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
Parm *JSEmitter::skipIgnoredArgs(Parm *p) {
|
||||
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||
p = Getattr(p, "tmap:in:next");
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* JSEmitter::getBaseClass() : the node of the base class or NULL
|
||||
*
|
||||
|
@ -2173,7 +2160,7 @@ void V8Emitter::marshalInputArgs(Node *n, ParmList *parms, Wrapper *wrapper, Mar
|
|||
Setattr(n, ARGCOUNT, argcount);
|
||||
|
||||
int i = 0;
|
||||
for (p = parms; p; i++) {
|
||||
for (p = parms; p;) {
|
||||
String *arg = NewString("");
|
||||
String *type = Getattr(p, "type");
|
||||
|
||||
|
@ -2185,26 +2172,33 @@ void V8Emitter::marshalInputArgs(Node *n, ParmList *parms, Wrapper *wrapper, Mar
|
|||
case Getter:
|
||||
if (is_member && !is_static && i == 0) {
|
||||
Printv(arg, "info.Holder()", 0);
|
||||
i++;
|
||||
} else {
|
||||
Printf(arg, "args[%d]", i - startIdx);
|
||||
Printf(arg, "args[%d]", i - startIdx);
|
||||
i += GetInt(p, "tmap:in:numinputs");
|
||||
}
|
||||
break;
|
||||
case Function:
|
||||
if (is_member && !is_static && i == 0) {
|
||||
Printv(arg, "args.Holder()", 0);
|
||||
i++;
|
||||
} else {
|
||||
Printf(arg, "args[%d]", i - startIdx);
|
||||
i += GetInt(p, "tmap:in:numinputs");
|
||||
}
|
||||
break;
|
||||
case Setter:
|
||||
if (is_member && !is_static && i == 0) {
|
||||
Printv(arg, "info.Holder()", 0);
|
||||
i++;
|
||||
} else {
|
||||
Printv(arg, "value", 0);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case Ctor:
|
||||
Printf(arg, "args[%d]", i);
|
||||
i += GetInt(p, "tmap:in:numinputs");
|
||||
break;
|
||||
default:
|
||||
Printf(stderr, "Illegal MarshallingMode.");
|
||||
|
|
Loading…
Reference in New Issue