diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-28 02:18:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-28 02:18:52 +0000 |
commit | c59fe5fe4739f0c61560f05d4e42b4e552219b27 (patch) | |
tree | 8cf79e85e394b3177a28d374415840a4e0a025ad /Build/source/utils/asymptote/access.cc | |
parent | 771db15706dbf3f4af8b630dcb15646a3e5fda00 (diff) |
asy 2.10
git-svn-id: svn://tug.org/texlive/trunk@22633 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/access.cc')
-rw-r--r-- | Build/source/utils/asymptote/access.cc | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/Build/source/utils/asymptote/access.cc b/Build/source/utils/asymptote/access.cc index b3935fed922..f71dba71bf3 100644 --- a/Build/source/utils/asymptote/access.cc +++ b/Build/source/utils/asymptote/access.cc @@ -57,6 +57,29 @@ void bltinAccess::encode(action act, position pos, coder &e, frame *) encode(act, pos, e); } +/* callableAccess */ +void callableAccess::encode(action act, position pos, coder &e) +{ + switch (act) { + case READ: + e.encode(inst::constpush, (item)f); + break; + case WRITE: + bltinError(pos); + break; + case CALL: + this->encode(READ, pos, e); + e.encode(inst::popcall); + break; + } +} + +void callableAccess::encode(action act, position pos, coder &e, frame *) +{ + e.encode(inst::pop); + encode(act, pos, e); +} + /* frameAccess */ void frameAccess::encode(action act, position pos, coder &e) @@ -84,6 +107,12 @@ void frameAccess::encode(action act, position pos, coder &e, frame *top) } /* localAccess */ +static void frameError(position pos) { + // A local variable is being used when its frame is not active. + em.error(pos); + em << "static use of dynamic variable"; +} + void localAccess::encode(action act, position pos, coder &e) { // Get the active frame of the virtual machine. @@ -91,16 +120,17 @@ void localAccess::encode(action act, position pos, coder &e) if (level == active) { e.encode(act == WRITE ? inst::varsave : inst::varpush, offset); - if (act == CALL) - e.encode(inst::popcall); + } + else if (e.encode(level)) { + e.encode(act == WRITE ? inst::fieldsave : inst::fieldpush, + offset); } else { - // Put the parent frame (in local variable 0) on the stack. - e.encode(inst::varpush,0); - - // Encode the access from that frame. - this->encode(act, pos, e, active->getParent()); + frameError(pos); } + + if (act == CALL) + e.encode(inst::popcall); } void localAccess::encode(action act, position pos, coder &e, frame *top) @@ -112,9 +142,7 @@ void localAccess::encode(action act, position pos, coder &e, frame *top) e.encode(inst::popcall); } else { - // The local variable is being used when its frame is not active. - em.error(pos); - em << "static use of dynamic variable"; + frameError(pos); } } |