From 8f1db754005616054192b3f75e54af9929df26cc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 28 Mar 2015 20:57:21 -0700 Subject: 992 - c++ chain spaces for lexical scope --- cpp/027space | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cpp/027space') diff --git a/cpp/027space b/cpp/027space index 2fa6f36d..0e1686f0 100644 --- a/cpp/027space +++ b/cpp/027space @@ -26,7 +26,7 @@ reagent absolutize(reagent x) { //? cout << "not raw: " << x.to_string() << '\n'; //? 1 assert(x.initialized); reagent r = x; - r.set_value(address(r.value, Current_routine.calls.top().default_space)); + r.set_value(address(r.value, space(r))); //? cout << "after absolutize: " << r.value << '\n'; //? 1 if (r.properties.empty()) r.properties.push_back(pair >("", vector())); @@ -35,6 +35,10 @@ reagent absolutize(reagent x) { return r; } +int space(const reagent& x) { + return Current_routine.calls.top().default_space; +} + int address(int offset, int base) { if (base == 0) return offset; // raw return base+offset+1; -- cgit 1.4.1-2-gfad0