[Tizen] fix checking constructor call
authorLukasz Bardeli <l.bardeli@samsung.com>
Wed, 15 Apr 2015 09:53:59 +0000 (11:53 +0200)
committerLukasz Bardeli <l.bardeli@samsung.com>
Wed, 15 Apr 2015 09:53:59 +0000 (11:53 +0200)
[Verification] Code compiles without error

Change-Id: Ia0f11e322483c6b67347b9230cd1f685906d1f6d
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
src/tizen/tizen_api.js

index 5263e2c2ee68f1a6587aa688d05ba9d6ef9e84ec..e03a7af3b24a845e6b4b90f5a1d6b56de98eb163 100644 (file)
@@ -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;