summaryrefslogtreecommitdiff
path: root/src/scope.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-02 01:55:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-02 01:55:55 -0400
commitcda19829bd1100d6563b48ddb121f2afc1c55d95 (patch)
tree5b6ab0d1eb7ec1b0b3eccf817678d0aa9a3feb47 /src/scope.h
parent017492ef5e80003073c5d053252d4a68a44260ae (diff)
parentfb7cafa8965c89bbd66b09f827bd5989a87c983b (diff)
downloadfork-ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.tar.gz
fork-ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.tar.bz2
fork-ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.zip
Merge branch 'next'
Diffstat (limited to 'src/scope.h')
-rw-r--r--src/scope.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/scope.h b/src/scope.h
index 30ba6823..1e6f24a1 100644
--- a/src/scope.h
+++ b/src/scope.h
@@ -354,6 +354,30 @@ inline T& find_scope(child_scope_t& scope, bool skip_this = true)
return reinterpret_cast<T&>(scope); // never executed
}
+class value_scope_t : public scope_t
+{
+ value_t value;
+
+ value_t get_value(call_scope_t&) {
+ return value;
+ }
+
+public:
+ value_scope_t(const value_t& _value) : value(_value) {}
+
+ virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind,
+ const string& name)
+ {
+ if (kind != symbol_t::FUNCTION)
+ return NULL;
+
+ if (name == "value")
+ return MAKE_FUNCTOR(value_scope_t::get_value);
+
+ return NULL;
+ }
+};
+
} // namespace ledger
#endif // _SCOPE_H