From: Roberto Raggi Date: Mon, 21 May 2012 12:11:12 +0000 (+0200) Subject: Implement Array.prototype.sort X-Git-Tag: upstream/5.2.1~669^2~659^2~1172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d72f4a477c7586d317cc9dc7c1372d67b8f7cece;p=platform%2Fupstream%2Fqtdeclarative.git Implement Array.prototype.sort --- diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp index daee5e9..a6e9239 100644 --- a/qv4ecmaobjects.cpp +++ b/qv4ecmaobjects.cpp @@ -1318,7 +1318,10 @@ void ArrayPrototype::method_slice(Context *ctx) void ArrayPrototype::method_sort(Context *ctx) { Value self = ctx->thisObject; + Value comparefn = ctx->argument(0); if (ArrayObject *instance = self.asArrayObject()) { + instance->value.sort(ctx, comparefn); + ctx->result = ctx->thisObject; } else { assert(!"generic implementation of Array.prototype.sort"); }