diff options
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 |