X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fexpr.c;h=30cb8558d4cc2358506d7a3f66d695e122bf6ab7;hb=5a9b4530f6a84ce3666a94605270bddaf43c9ff2;hp=69d2fbb232091b492b3aa67f86f4d27e5c909aa1;hpb=639ac6b9f7a89f10d02c5d9ef41bca3bad4eaf2b;p=swftools.git diff --git a/lib/as3/expr.c b/lib/as3/expr.c index 69d2fbb..30cb855 100644 --- a/lib/as3/expr.c +++ b/lib/as3/expr.c @@ -65,21 +65,27 @@ static classinfo_t*join_types(classinfo_t*type1, classinfo_t*type2, nodetype_t*t) { - if(TYPE_IS_ANY(type1)) - return TYPE_ANY; - if(t == &node_plus) { - if(TYPE_IS_XMLLIST(type1)) - return type1; + if((TYPE_IS_XMLLIST(type1) || TYPE_IS_XML(type1)) && + (TYPE_IS_XMLLIST(type2) || TYPE_IS_XML(type2))) + return TYPE_OBJECT; if(BOTH_INT(type1, type2)) return TYPE_INT; if(IS_NUMBER_OR_INT(type1) && IS_NUMBER_OR_INT(type2)) return TYPE_NUMBER; - if(TYPE_IS_ANY(type2)) + if(TYPE_IS_DATE(type1) || TYPE_IS_DATE(type2)) + return TYPE_OBJECT; + if(TYPE_IS_STRING(type1) || TYPE_IS_STRING(type2)) { + /* depending on where the strings come from, the result type + of an "add" might be an object or a string, depending on the + verifier's mood. So basically we just don't know the type. */ + return TYPE_VOID; + } + if(TYPE_IS_ANY(type1) || TYPE_IS_ANY(type2)) return TYPE_ANY; - return TYPE_OBJECT; // e.g. string+string = object + return TYPE_OBJECT; // e.g. array+array = object } - + if(type1 == type2) return type1; return TYPE_ANY; @@ -149,7 +155,7 @@ static code_t* toreadwrite(code_t*in, code_t*middlepart, char justassign, char r prefix = abc_dup(prefix); // we need the object, too } use_temp_var = 1; - } else if(m->type == MULTINAMEL) { + } else if(m->type == MULTINAMEL || m->type == MULTINAMELA) { if(!justassign) { /* dupping two values on the stack requires 5 operations and one register- couldn't adobe just have given us a dup2? */ @@ -329,7 +335,6 @@ constant_t node_plus_eval(node_t*n) EVAL_HEADER_LEFTRIGHT; char left_int = left.type == CONSTANT_INT || left.type == CONSTANT_UINT; if(left_int && (right.type == CONSTANT_INT || right.type == CONSTANT_UINT)) { - /* FIXME: what to do about signed/unsigned overflows? */ int i = constant_to_int(&left) + constant_to_int(&right); r.type = CONSTANT_INT; r.i = i;