diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-31 00:02:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-31 00:02:26 +0000 |
commit | 19fc9fd9a26973d87fad437ce549ffaba479df54 (patch) | |
tree | f40a9d2592b3cf827970c8bf54a1eebf9cc8f9c0 /Build/source/utils/asymptote/dec.cc | |
parent | 24b3bac312553b2cc61e94fda581aba311967f5c (diff) |
asy 2.16 sources
git-svn-id: svn://tug.org/texlive/trunk@26734 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/dec.cc')
-rw-r--r-- | Build/source/utils/asymptote/dec.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/dec.cc b/Build/source/utils/asymptote/dec.cc index 10154609576..dc15b9d24d6 100644 --- a/Build/source/utils/asymptote/dec.cc +++ b/Build/source/utils/asymptote/dec.cc @@ -201,6 +201,28 @@ bool block::returns() { return true; return false; } + +vardec *block::asVardec() +{ + vardec *var = 0; + for (list<runnable *>::iterator p=stms.begin(); + p != stms.end(); + ++p) + { + vardec *v = dynamic_cast<vardec *>(*p); + if (v) { + if (var) + // Multiple vardecs. + return 0; + var = v; + } + else if (!dynamic_cast<emptyStm *>(*p)) + // Failure due to another runnable in the block. + return 0; + } + + return var; +} void dec::prettyprint(ostream &out, Int indent) @@ -570,6 +592,23 @@ void vardec::transAsTypedefField(coenv &e, record *r) decs->transAsTypedefField(e, base->transAsTyEntry(e, r), r); } +symbol vardec::singleName() +{ + decid *did = decs->singleEntry(); + if (!did) + return symbol::nullsym; + return did->getStart()->getName(); +} + +types::ty *vardec::singleGetType(coenv &e) +{ + decid *did = decs->singleEntry(); + if (!did) + return 0; + return did->getStart()->getType(base->trans(e), e); +} + + // Helper class for imports. This essentially evaluates to the run::loadModule // function. However, that function returns different types of records // depending on the filename given to it, so we cannot add it to the |