--- parser3/src/main/compile_tools.C 2009/06/07 13:15:54 1.67 +++ parser3/src/main/compile_tools.C 2012/03/16 09:24:12 1.69 @@ -1,12 +1,10 @@ /** @file Parser: compiler support helper functions. - Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_COMPILE_TOOLS_C="$Date: 2009/06/07 13:15:54 $"; - #include "compile_tools.h" #include "pa_string.h" #include "pa_array.h" @@ -15,6 +13,8 @@ static const char * const IDENT_COMPILE_ #include "pa_vdouble.h" #include "pa_vmethod_frame.h" +volatile const char * IDENT_COMPILE_TOOLS_C="$Id: compile_tools.C,v 1.69 2012/03/16 09:24:12 moko Exp $" IDENT_COMPILE_TOOLS_H; + Value* LA2V(ArrayOperation& literal_string_array, int offset, OP::OPCODE code) { return literal_string_array[offset+0].code==code?literal_string_array[offset+2/*skip opcode&origin*/].value :0; @@ -86,6 +86,24 @@ bool maybe_make_self(ArrayOperation& opc } +Method::Call_type GetMethodCallType(Parse_control& pc, ArrayOperation& literal_array) { + const String* full_name=LA2S(literal_array); + int pos=full_name->pos(':'); + if(pos > 0) { + const String call_type=full_name->mid(0, pos); + if(call_type!=method_call_type_static) + throw Exception("parser.compile", + &call_type, + "incorrect method call type. the only valid call type method prefix is '"METHOD_CALL_TYPE_STATIC"'" + ); + const String *sole_name=&full_name->mid(pos+1, full_name->length()); + // replace full method name (static:method) by sole method name (method). it will be used later. + change_string_literal_value(literal_array, *sole_name); + return Method::CT_STATIC; + } + return pc.get_methods_call_type(); +} + void push_LS(Parse_control& pc, lexical_state new_state) { if(pc.ls_sp