Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 32f6cc2fc9cfd94b5ede18d425dad5fdaa7431d8..9f11393df4b80c6d28d1f94f067c80d87c70908e 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -127,8 +127,9 @@ function GlobalParseInt(string, radix) { |
// The spec says ToString should be evaluated before ToInt32. |
string = TO_STRING_INLINE(string); |
radix = TO_INT32(radix); |
- if (!(radix == 0 || (2 <= radix && radix <= 36))) |
+ if (!(radix == 0 || (2 <= radix && radix <= 36))) { |
return $NaN; |
+ } |
} |
if (%_HasCachedArrayIndex(string) && |
@@ -329,8 +330,9 @@ function ObjectLookupSetter(name) { |
function ObjectKeys(obj) { |
- if (!IS_SPEC_OBJECT(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["keys"]); |
+ } |
if (%IsJSProxy(obj)) { |
var handler = %GetHandler(obj); |
var names = CallTrap0(handler, "keys", DerivedKeysTrap); |
@@ -461,7 +463,7 @@ function ToPropertyDescriptor(obj) { |
// For Harmony proxies. |
function ToCompletePropertyDescriptor(obj) { |
- var desc = ToPropertyDescriptor(obj) |
+ var desc = ToPropertyDescriptor(obj); |
if (IsGenericDescriptor(desc) || IsDataDescriptor(desc)) { |
if (!desc.hasValue()) desc.setValue(void 0); |
if (!desc.hasWritable()) desc.setWritable(false); |
@@ -845,17 +847,19 @@ function DefineOwnProperty(obj, p, desc, should_throw) { |
// ES5 section 15.2.3.2. |
function ObjectGetPrototypeOf(obj) { |
- if (!IS_SPEC_OBJECT(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]); |
+ } |
return %GetPrototype(obj); |
} |
// ES5 section 15.2.3.3 |
function ObjectGetOwnPropertyDescriptor(obj, p) { |
- if (!IS_SPEC_OBJECT(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", |
["getOwnPropertyDescriptor"]); |
+ } |
var desc = GetOwnProperty(obj, p); |
return FromPropertyDescriptor(desc); |
} |
@@ -872,7 +876,7 @@ function ToStringArray(obj, trap) { |
for (var index = 0; index < n; index++) { |
var s = ToString(obj[index]); |
if (s in names) { |
- throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]) |
+ throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]); |
} |
array[index] = s; |
names[s] = 0; |
@@ -883,9 +887,9 @@ function ToStringArray(obj, trap) { |
// ES5 section 15.2.3.4. |
function ObjectGetOwnPropertyNames(obj) { |
- if (!IS_SPEC_OBJECT(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]); |
Yang
2011/11/25 15:56:02
Might as well insert a line break in here to keep
|
- |
+ } |
// Special handling for proxies. |
if (%IsJSProxy(obj)) { |
var handler = %GetHandler(obj); |
@@ -902,8 +906,9 @@ function ObjectGetOwnPropertyNames(obj) { |
if (%GetInterceptorInfo(obj) & 1) { |
var indexedInterceptorNames = |
%GetIndexedInterceptorElementNames(obj); |
- if (indexedInterceptorNames) |
+ if (indexedInterceptorNames) { |
propertyNames = propertyNames.concat(indexedInterceptorNames); |
+ } |
} |
// Find all the named properties. |
@@ -929,8 +934,9 @@ function ObjectGetOwnPropertyNames(obj) { |
// We need to check for the exact property value since for intrinsic |
// properties like toString if(propertySet["toString"]) will always |
// succeed. |
- if (propertySet[name] === true) |
+ if (propertySet[name] === true) { |
continue; |
+ } |
propertySet[name] = true; |
propertyNames[j++] = name; |
} |
@@ -1006,8 +1012,9 @@ function GetOwnEnumerablePropertyNames(properties) { |
// ES5 section 15.2.3.7. |
function ObjectDefineProperties(obj, properties) { |
- if (!IS_SPEC_OBJECT(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); |
+ } |
var props = ToObject(properties); |
var names = GetOwnEnumerablePropertyNames(props); |
var descriptors = new InternalArray(); |
@@ -1232,8 +1239,9 @@ function BooleanToString() { |
function BooleanValueOf() { |
// NOTE: Both Boolean objects and values can enter here as |
// 'this'. This is not as dictated by ECMA-262. |
- if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this)) |
+ if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this)) { |
throw new $TypeError('Boolean.prototype.valueOf is not generic'); |
+ } |
return %_ValueOf(this); |
} |
@@ -1273,8 +1281,9 @@ function NumberToString(radix) { |
// 'this'. This is not as dictated by ECMA-262. |
var number = this; |
if (!IS_NUMBER(this)) { |
- if (!IS_NUMBER_WRAPPER(this)) |
+ if (!IS_NUMBER_WRAPPER(this)) { |
throw new $TypeError('Number.prototype.toString is not generic'); |
+ } |
// Get the value of this number in case it's an object. |
number = %_ValueOf(this); |
} |
@@ -1307,8 +1316,9 @@ function NumberToLocaleString() { |
function NumberValueOf() { |
// NOTE: Both Number objects and values can enter here as |
// 'this'. This is not as dictated by ECMA-262. |
- if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this)) |
+ if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this)) { |
throw new $TypeError('Number.prototype.valueOf is not generic'); |
+ } |
return %_ValueOf(this); |
} |