From b338c76c0c35c15dd588e158b862a9850f9bfdc1 Mon Sep 17 00:00:00 2001 From: Lukasz Bardeli Date: Wed, 15 Apr 2015 11:53:59 +0200 Subject: [PATCH] [Tizen] fix checking constructor call [Verification] Code compiles without error Change-Id: Ia0f11e322483c6b67347b9230cd1f685906d1f6d Signed-off-by: Lukasz Bardeli --- src/tizen/tizen_api.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/tizen/tizen_api.js b/src/tizen/tizen_api.js index 5263e2c2..e03a7af3 100644 --- a/src/tizen/tizen_api.js +++ b/src/tizen/tizen_api.js @@ -87,9 +87,9 @@ var AbstractFilter = function() {}; * Represents a set of filters. */ exports.AttributeFilter = function(attrName, matchFlag, matchValue) { - if (!(this instanceof exports.AttributeFilter)) { - throw new WebAPIException('TypeError', 'Constructor cannot be called as function.'); - } + + xwalk.utils.validator.isConstructorCall(this, exports.AttributeFilter); + var name_ = ''; var flag_ = 'EXACTLY'; var value_ = null; @@ -194,9 +194,9 @@ exports.AttributeFilter.prototype.constructor = exports.AttributeFilter; * within a particular range. */ exports.AttributeRangeFilter = function(attrName, start, end) { - if (!(this instanceof exports.AttributeRangeFilter)) { - throw new WebAPIException('TypeError', 'Constructor cannot be called as function.'); - } + + xwalk.utils.validator.isConstructorCall(this, exports.AttributeRangeFilter); + var name_ = ''; var start_ = null; var end_ = null; @@ -305,9 +305,9 @@ exports.AttributeRangeFilter.prototype.constructor = exports.AttributeRangeFilte * Represents a set of filters. */ exports.CompositeFilter = function(type, filters) { - if (!(this instanceof exports.CompositeFilter)) { - throw new WebAPIException('TypeError', 'Constructor cannot be called as function.'); - } + + xwalk.utils.validator.isConstructorCall(this, exports.CompositeFilter); + var filterTypes = Object.keys(CompositeFilterType); var type_ = filterTypes[0]; @@ -386,9 +386,9 @@ exports.CompositeFilter.prototype.constructor = exports.CompositeFilter; * SortMode is a common interface used for sorting of queried data. */ exports.SortMode = function(attrName, order) { - if (!(this instanceof exports.SortMode)) { - throw new WebAPIException('TypeError', 'Constructor cannot be called as function.'); - } + + xwalk.utils.validator.isConstructorCall(this, exports.SortMode); + var sortModeOrder = Object.keys(SortModeOrder); var attributeName_ = ''; @@ -429,9 +429,8 @@ exports.SortMode.prototype.constructor = exports.SortMode; * Represents a point (latitude and longitude) in the map coordinate system. */ exports.SimpleCoordinates = function(lat, lng) { - if (!(this instanceof exports.SimpleCoordinates)) { - throw new WebAPIException('TypeError', 'Constructor cannot be called as function.'); - } + + xwalk.utils.validator.isConstructorCall(this, exports.SimpleCoordinates); var latitude = 0; var longitude = 0; -- 2.34.1