summaryrefslogtreecommitdiff
path: root/graphics/asymptote/genv.cc
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/genv.cc')
-rw-r--r--graphics/asymptote/genv.cc42
1 files changed, 26 insertions, 16 deletions
diff --git a/graphics/asymptote/genv.cc b/graphics/asymptote/genv.cc
index 8471e3b620..fe8e1b5cab 100644
--- a/graphics/asymptote/genv.cc
+++ b/graphics/asymptote/genv.cc
@@ -89,9 +89,12 @@ record *genv::loadModule(symbol id, string filename) {
return r;
}
-record *genv::loadTemplatedModule(symbol id, string filename,
- mem::vector<absyntax::namedTyEntry*> *args)
-{
+record *genv::loadTemplatedModule(
+ symbol id,
+ string filename,
+ mem::vector<absyntax::namedTyEntry*> *args,
+ trans::frame *parent
+) {
// Hackish way to load an external library.
#if 0
if (endswith(".so", filename)) {
@@ -106,7 +109,7 @@ record *genv::loadTemplatedModule(symbol id, string filename,
em.sync();
- record *r=ast->transAsTemplatedFile(*this, id, args);
+ record *r=ast->transAsTemplatedFile(*this, id, args, parent);
inTranslation.remove(filename);
@@ -140,24 +143,31 @@ record *genv::getModule(symbol id, string filename) {
return r;
}
-
}
-record *genv::getTemplatedModule(symbol id, string filename, string sigHandle,
- mem::vector<absyntax::namedTyEntry*>* args)
-{
+record *genv::getTemplatedModule(
+ symbol id,
+ string filename,
+ string sigHandle,
+ mem::vector<absyntax::namedTyEntry*>* args,
+ frame *parent
+) {
checkRecursion(filename);
- importIndex_t Index(filename,sigHandle);
- record *r=loadTemplatedModule(id, filename, args);
- // Don't add an erroneous module to the dictionary in interactive mode, as
- // the user may try to load it again.
- if (!interact::interactive || !em.errors()) {
- imap[Index]=r;
- }
+ importIndex_t Index(filename,sigHandle);
- return r;
+ record *r=imap[Index];
+ if (r)
+ return r;
+ else {
+ record *r=loadTemplatedModule(id, filename, args, parent);
+ // Don't add an erroneous module to the dictionary in interactive mode, as
+ // the user may try to load it again.
+ if (!interact::interactive || !em.errors())
+ imap[Index]=r;
+ return r;
+ }
}