From 19fc9fd9a26973d87fad437ce549ffaba479df54 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 31 May 2012 00:02:26 +0000 Subject: asy 2.16 sources git-svn-id: svn://tug.org/texlive/trunk@26734 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/dec.cc | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'Build/source/utils/asymptote/dec.cc') 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::iterator p=stms.begin(); + p != stms.end(); + ++p) + { + vardec *v = dynamic_cast(*p); + if (v) { + if (var) + // Multiple vardecs. + return 0; + var = v; + } + else if (!dynamic_cast(*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 -- cgit v1.2.3