@@ -197,14 +197,15 @@ int64_t obj_getInt(PikaObj* self, char* argPath) {
197
197
}
198
198
199
199
Arg * obj_getArg (PikaObj * self , char * argPath ) {
200
- PIKA_BOOL isClass = PIKA_FALSE ;
201
- PikaObj * obj = obj_getHostObjWithIsTemp (self , argPath , & isClass );
200
+ PIKA_BOOL is_temp = PIKA_FALSE ;
201
+ PikaObj * obj = obj_getHostObjWithIsTemp (self , argPath , & is_temp );
202
202
if (NULL == obj ) {
203
203
return NULL ;
204
204
}
205
+ Arg * res = NULL ;
205
206
char * argName = strPointToLastToken (argPath , '.' );
206
- Arg * res = args_getArg (obj -> list , argName );
207
- if (isClass ) {
207
+ res = args_getArg (obj -> list , argName );
208
+ if (is_temp ) {
208
209
obj_setArg (self , "_buf" , res );
209
210
res = obj_getArg (self , "_buf" );
210
211
obj_deinit (obj );
@@ -520,13 +521,13 @@ static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
520
521
}
521
522
522
523
PikaObj * obj_getObj (PikaObj * self , char * objPath ) {
523
- PIKA_BOOL isClass = PIKA_FALSE ;
524
- return __obj_getObjWithKeepDeepth (self , objPath , & isClass , 0 );
524
+ PIKA_BOOL is_temp = PIKA_FALSE ;
525
+ return __obj_getObjWithKeepDeepth (self , objPath , & is_temp , 0 );
525
526
}
526
527
527
528
PikaObj * obj_getHostObj (PikaObj * self , char * objPath ) {
528
- PIKA_BOOL isClass = PIKA_FALSE ;
529
- return __obj_getObjWithKeepDeepth (self , objPath , & isClass , 1 );
529
+ PIKA_BOOL is_temp = PIKA_FALSE ;
530
+ return __obj_getObjWithKeepDeepth (self , objPath , & is_temp , 1 );
530
531
}
531
532
532
533
PikaObj * obj_getHostObjWithIsTemp (PikaObj * self ,
@@ -594,6 +595,30 @@ PikaObj* methodArg_getDefContext(Arg* method_arg) {
594
595
return context ;
595
596
}
596
597
598
+ void _update_proxy (PikaObj * self , char * name ) {
599
+ #if PIKA_NANO_ENABLE
600
+ return ;
601
+ #endif
602
+ if (!(self -> proxy & PIKA_PROXY_GETATTRIBUTE )) {
603
+ if (strEqu (name , "__getattribute__" )) {
604
+ self -> proxy |= PIKA_PROXY_GETATTRIBUTE ;
605
+ return ;
606
+ }
607
+ }
608
+ if (!(self -> proxy & PIKA_PROXY_GETATTR )) {
609
+ if (strEqu (name , "__getattr__" )) {
610
+ self -> proxy |= PIKA_PROXY_GETATTR ;
611
+ return ;
612
+ }
613
+ }
614
+ if (!(self -> proxy & PIKA_PROXY_SETATTR )) {
615
+ if (strEqu (name , "__setattr__" )) {
616
+ self -> proxy |= PIKA_PROXY_SETATTR ;
617
+ return ;
618
+ }
619
+ }
620
+ }
621
+
597
622
static void obj_saveMethodInfo (PikaObj * self , MethodInfo * method_info ) {
598
623
Args buffs = {0 };
599
624
method_info -> pars = method_info -> dec ;
@@ -612,6 +637,7 @@ static void obj_saveMethodInfo(PikaObj* self, MethodInfo* method_info) {
612
637
sizeof (method_info_def_context ));
613
638
arg = arg_append (arg , method_info -> pars , size_pars + 1 );
614
639
640
+ _update_proxy (self , method_info -> name );
615
641
args_setArg (self -> list , arg );
616
642
strsDeinit (& buffs );
617
643
}
@@ -1001,6 +1027,7 @@ PikaObj* New_PikaObj(void) {
1001
1027
self -> list = New_args (NULL );
1002
1028
self -> refcnt = 0 ;
1003
1029
self -> constructor = NULL ;
1030
+ self -> proxy = 0 ;
1004
1031
return self ;
1005
1032
}
1006
1033
0 commit comments