parser

Написать ответ на текущее сообщение

 

 
   команды управления поиском

Ответ

moko 06.10.2015 17:48

Я же говорю, что пару изменений надо сделать. :)

Index: types/pa_vstateless_class.C
===================================================================
RCS file: /home/cvsroot/parser3project/parser3/src/types/pa_vstateless_class.C,v
retrieving revision 1.51
diff -u -r1.51 pa_vstateless_class.C
--- types/pa_vstateless_class.C 16 Mar 2015 09:47:36 -0000 1.51
+++ types/pa_vstateless_class.C 6 Oct 2015 14:47:41 -0000
@@ -22,11 +22,11 @@

/// @TODO why?! request must be different ptr from global [used in VStateless_class.set_method]
void VStateless_class::set_method(const String& aname, Method* amethod) {
- if(flocked)
+/* if(flocked)
throw Exception(PARSER_RUNTIME,
&aname,
"can not add method to system class (maybe you have forgotten .CLASS in ^process[$caller.CLASS]{...}?)");
-
+*/
if(fderived.count()) {
Method *omethod=fmethods.get(aname);
Array_iterator<VStateless_class *> i(fderived);
Index: types/pa_vstateless_class.h
===================================================================
RCS file: /home/cvsroot/parser3project/parser3/src/types/pa_vstateless_class.h,v
retrieving revision 1.77
diff -u -r1.77 pa_vstateless_class.h
--- types/pa_vstateless_class.h 8 Apr 2015 18:08:54 -0000 1.77
+++ types/pa_vstateless_class.h 6 Oct 2015 14:47:41 -0000
@@ -78,8 +78,18 @@

override const VJunction* put_element(const String& aname, Value* avalue) { return put_element(*this, aname, avalue); }
/// put_element with aself for VObject junctions
- virtual const VJunction* put_element(Value& aself, const String& aname, Value* /*avalue*/) {
- aself.bark("element can not be stored to %s", &aname);
+ virtual const VJunction* put_element(Value& aself, const String& aname, Value* avalue) {
+// aself.bark("element can not be stored to %s", &aname);
+
+ Junction* junction=avalue->get_junction();
+ if(!junction) {
+ throw Exception(PARSER_RUNTIME,0, "is '%s', not a method or junction, can not call it", avalue->type());
+ }
+ Method *method=(Method *)junction->method;
+ if(!method) {
+ throw Exception(PARSER_RUNTIME,0, "is '%s', not a method or junction, can not call it", avalue->type());
+ }
+ set_method(aname, method);
return 0;
}