From: Roberto Raggi Date: Mon, 21 May 2012 13:22:22 +0000 (+0200) Subject: More work on the Array prototype. X-Git-Tag: upstream/5.2.1~669^2~659^2~1166 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5877cbbbee2c9f50231239095b48a85ebd3fa8a;p=platform%2Fupstream%2Fqtdeclarative.git More work on the Array prototype. --- diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp index 4744faa..01944f0 100644 --- a/qv4ecmaobjects.cpp +++ b/qv4ecmaobjects.cpp @@ -1132,6 +1132,15 @@ ArrayPrototype::ArrayPrototype(Context *ctx, FunctionObject *ctor) setProperty(ctx, QLatin1String("sort"), method_sort, 1); setProperty(ctx, QLatin1String("splice"), method_splice, 2); setProperty(ctx, QLatin1String("unshift"), method_unshift, 1); + setProperty(ctx, QLatin1String("indexOf"), method_indexOf, 0); + setProperty(ctx, QLatin1String("lastIndexOf"), method_lastIndexOf, 0); + setProperty(ctx, QLatin1String("every"), method_every, 0); + setProperty(ctx, QLatin1String("some"), method_some, 0); + setProperty(ctx, QLatin1String("forEach"), method_forEach, 0); + setProperty(ctx, QLatin1String("map"), method_map, 0); + setProperty(ctx, QLatin1String("filter"), method_filter, 0); + setProperty(ctx, QLatin1String("reduce"), method_reduce, 0); + setProperty(ctx, QLatin1String("reduceRight"), method_reduceRight, 0); } void ArrayPrototype::method_toString(Context *ctx) @@ -1372,6 +1381,96 @@ void ArrayPrototype::method_unshift(Context *ctx) } } +void ArrayPrototype::method_indexOf(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_lastIndexOf(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_every(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_some(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_forEach(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_map(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_filter(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_reduce(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + +void ArrayPrototype::method_reduceRight(Context *ctx) +{ + Value self = ctx->thisObject; + if (ArrayObject *instance = self.asArrayObject()) { + Q_UNIMPLEMENTED(); + } else { + assert(!"generic implementation"); + } +} + // // Function object // diff --git a/qv4ecmaobjects_p.h b/qv4ecmaobjects_p.h index a1a5528..b09ef1c 100644 --- a/qv4ecmaobjects_p.h +++ b/qv4ecmaobjects_p.h @@ -132,6 +132,15 @@ protected: static void method_sort(Context *ctx); static void method_splice(Context *ctx); static void method_unshift(Context *ctx); + static void method_indexOf(Context *ctx); + static void method_lastIndexOf(Context *ctx); + static void method_every(Context *ctx); + static void method_some(Context *ctx); + static void method_forEach(Context *ctx); + static void method_map(Context *ctx); + static void method_filter(Context *ctx); + static void method_reduce(Context *ctx); + static void method_reduceRight(Context *ctx); }; struct FunctionCtor: FunctionObject