Merge branch 'master' into 2011-09-09-CxScript
Conflicts: include/chaiscript/language/chaiscript_eval.hpp
This commit is contained in:
commit
b615d2a423
@ -43,20 +43,6 @@ namespace chaiscript
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
struct Dynamic_Object_Attribute
|
|
||||||
{
|
|
||||||
static Boxed_Value func(const std::string &t_type_name, const std::string &t_attr_name,
|
|
||||||
Dynamic_Object &t_do)
|
|
||||||
{
|
|
||||||
if (t_do.get_type_name() != t_type_name)
|
|
||||||
{
|
|
||||||
throw exception::bad_boxed_cast("Dynamic object type mismatch");
|
|
||||||
}
|
|
||||||
|
|
||||||
return t_do.get_attr(t_attr_name);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Proxy_Function implementation designed for calling a function
|
* A Proxy_Function implementation designed for calling a function
|
||||||
* that is automatically guarded based on the first param based on the
|
* that is automatically guarded based on the first param based on the
|
||||||
|
@ -1182,8 +1182,16 @@ namespace chaiscript
|
|||||||
virtual ~Attr_Decl_AST_Node() {}
|
virtual ~Attr_Decl_AST_Node() {}
|
||||||
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss){
|
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss){
|
||||||
try {
|
try {
|
||||||
t_ss.add(fun(std::function<Boxed_Value (dispatch::Dynamic_Object &)>(std::bind(&dispatch::detail::Dynamic_Object_Attribute::func, this->children[0]->text,
|
|
||||||
this->children[1]->text, std::placeholders::_1))), this->children[1]->text);
|
t_ss.add(Proxy_Function
|
||||||
|
(new dispatch::detail::Dynamic_Object_Function(
|
||||||
|
this->children[0]->text,
|
||||||
|
fun(std::function<Boxed_Value (dispatch::Dynamic_Object &)>(std::bind(&dispatch::Dynamic_Object::get_attr,
|
||||||
|
std::placeholders::_1,
|
||||||
|
this->children[1]->text
|
||||||
|
)))
|
||||||
|
)
|
||||||
|
), this->children[1]->text);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (const exception::reserved_word_error &) {
|
catch (const exception::reserved_word_error &) {
|
||||||
|
9
unittests/object_attr_same_name.chai
Normal file
9
unittests/object_attr_same_name.chai
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
attr bob::z
|
||||||
|
def bob::bob() { this.z = 10 }
|
||||||
|
|
||||||
|
attr bob2::z
|
||||||
|
def bob2::bob2() { this.z = 12 }
|
||||||
|
|
||||||
|
var b = bob();
|
||||||
|
var b2 = bob2();
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user