@@ -2252,47 +2252,50 @@ compile_subscript(
22522252 if (compile_member (is_slice , & keeping_dict , cctx ) == FAIL )
22532253 return FAIL ;
22542254 }
2255- else if (* p == '.'
2256- && (type = get_type_on_stack (cctx , 0 )) != & t_unknown
2257- && (type -> tt_type == VAR_CLASS || type -> tt_type == VAR_OBJECT ))
2258- {
2259- // class member: SomeClass.varname
2260- // class method: SomeClass.SomeMethod()
2261- // class constructor: SomeClass.new()
2262- // object member: someObject.varname, this.varname
2263- // object method: someObject.SomeMethod(), this.SomeMethod()
2264- * arg = p ;
2265- if (compile_class_object_index (cctx , arg , type ) == FAIL )
2266- return FAIL ;
2267- }
22682255 else if (* p == '.' && p [1 ] != '.' )
22692256 {
22702257 // dictionary member: dict.name
22712258 if (generate_ppconst (cctx , ppconst ) == FAIL )
22722259 return FAIL ;
22732260 ppconst -> pp_is_const = FALSE;
22742261
2275- * arg = p + 1 ;
2276- if (IS_WHITE_OR_NUL (* * arg ))
2277- {
2278- emsg (_ (e_missing_name_after_dot ));
2279- return FAIL ;
2262+ if ((type = get_type_on_stack (cctx , 0 )) != & t_unknown
2263+ && (type -> tt_type == VAR_CLASS
2264+ || type -> tt_type == VAR_OBJECT ))
2265+ {
2266+ // class member: SomeClass.varname
2267+ // class method: SomeClass.SomeMethod()
2268+ // class constructor: SomeClass.new()
2269+ // object member: someObject.varname, this.varname
2270+ // object method: someObject.SomeMethod(), this.SomeMethod()
2271+ * arg = p ;
2272+ if (compile_class_object_index (cctx , arg , type ) == FAIL )
2273+ return FAIL ;
22802274 }
2281- p = * arg ;
2282- if (eval_isdictc (* p ))
2283- while (eval_isnamec (* p ))
2284- MB_PTR_ADV (p );
2285- if (p == * arg )
2275+ else
22862276 {
2287- semsg (_ (e_syntax_error_at_str ), * arg );
2288- return FAIL ;
2277+ * arg = p + 1 ;
2278+ if (IS_WHITE_OR_NUL (* * arg ))
2279+ {
2280+ emsg (_ (e_missing_name_after_dot ));
2281+ return FAIL ;
2282+ }
2283+ p = * arg ;
2284+ if (eval_isdictc (* p ))
2285+ while (eval_isnamec (* p ))
2286+ MB_PTR_ADV (p );
2287+ if (p == * arg )
2288+ {
2289+ semsg (_ (e_syntax_error_at_str ), * arg );
2290+ return FAIL ;
2291+ }
2292+ if (keeping_dict && generate_instr (cctx , ISN_CLEARDICT ) == NULL )
2293+ return FAIL ;
2294+ if (generate_STRINGMEMBER (cctx , * arg , p - * arg ) == FAIL )
2295+ return FAIL ;
2296+ keeping_dict = TRUE;
2297+ * arg = p ;
22892298 }
2290- if (keeping_dict && generate_instr (cctx , ISN_CLEARDICT ) == NULL )
2291- return FAIL ;
2292- if (generate_STRINGMEMBER (cctx , * arg , p - * arg ) == FAIL )
2293- return FAIL ;
2294- keeping_dict = TRUE;
2295- * arg = p ;
22962299 }
22972300 else
22982301 break ;
0 commit comments