diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
commit | 16d128e5e10d541a78654b86409d5a3539f07708 (patch) | |
tree | 66de0af63c3811bb3040c16e9b52c11985f70811 /Build/source/utils/asymptote/application.h | |
parent | b20f78c549859ec0e8610bdd3ad904245e86b489 (diff) |
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/application.h')
-rw-r--r-- | Build/source/utils/asymptote/application.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/Build/source/utils/asymptote/application.h b/Build/source/utils/asymptote/application.h index 994f0bb1970..060afeafdb3 100644 --- a/Build/source/utils/asymptote/application.h +++ b/Build/source/utils/asymptote/application.h @@ -16,6 +16,11 @@ #include "coenv.h" #include "exp.h" +// Defined in runtime.in: +namespace run { + void pushDefault(vm::stack *Stack); +} + using absyntax::arglist; using absyntax::varinit; using absyntax::arrayinit; @@ -38,12 +43,20 @@ typedef mem::vector<score> score_vector; typedef mem::vector<tempExp *> temp_vector; struct arg : public gc { + types::ty *t; + + arg(types::ty *t) + : t(t) {} virtual ~arg() {} + + virtual void trans(coenv &e, temp_vector &) = 0; +}; + +struct varinitArg : public arg { varinit *v; - types::ty *t; - arg(varinit *v, types::ty *t) - : v(v), t(t) {} + varinitArg(varinit *v, types::ty *t) + : arg(t), v(v) {} virtual void trans(coenv &e, temp_vector &) { // Open signatures can match overloaded variables, but there is no way to @@ -57,10 +70,16 @@ struct arg : public gc { } }; + // Pushes a default argument token on the stack as a placeholder for the // argument. struct defaultArg : public arg { - defaultArg(types::ty *t); + defaultArg(types::ty *t) + : arg(t) {} + + virtual void trans(coenv &e, temp_vector &) { + e.c.encode(inst::builtin, run::pushDefault); + } }; // Handles translation of all the arguments matched to the rest formal. @@ -96,11 +115,11 @@ public: // used to ensure left-to-right order of evaluation of keyword arguments, even // if they are given out of the order specified in the declaration. class sequencer { - struct sequencedArg : public arg { + struct sequencedArg : public varinitArg { sequencer &parent; size_t i; sequencedArg(varinit *v, types::ty *t, sequencer &parent, size_t i) - : arg(v, t), parent(parent), i(i) {} + : varinitArg(v, t), parent(parent), i(i) {} void trans(coenv &e, temp_vector &temps) { parent.trans(e, i, temps); @@ -138,7 +157,7 @@ class sequencer { advance(e, i, temps); // Translate using the base method. - args[i]->arg::trans(e,temps); + args[i]->varinitArg::trans(e,temps); // Push null to indicate the argument has been translated. temps.push_back(0); |