Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: src/string.js

Issue 8701006: Clean up JavaScript files to better follow coding standard. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mirror-debugger.js ('k') | src/v8natives.js » ('j') | src/v8natives.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 4ac6089f3b0c3bfebcaf5209c40aaf8f48c5805d..91858293b350b2ed0c9ed0bba7fb499f70d5a4c1 100644
--- a/src/string.js
+++ b/src/string.js
@@ -46,16 +46,18 @@
// ECMA-262 section 15.5.4.2
function StringToString() {
- if (!IS_STRING(this) && !IS_STRING_WRAPPER(this))
+ if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
throw new $TypeError('String.prototype.toString is not generic');
+ }
return %_ValueOf(this);
}
// ECMA-262 section 15.5.4.3
function StringValueOf() {
- if (!IS_STRING(this) && !IS_STRING_WRAPPER(this))
+ if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
throw new $TypeError('String.prototype.valueOf is not generic');
+ }
return %_ValueOf(this);
}
@@ -531,30 +533,36 @@ function StringSlice(start, end) {
var s_len = s.length;
var start_i = TO_INTEGER(start);
var end_i = s_len;
- if (end !== void 0)
+ if (end !== void 0) {
end_i = TO_INTEGER(end);
+ }
if (start_i < 0) {
start_i += s_len;
- if (start_i < 0)
+ if (start_i < 0) {
start_i = 0;
+ }
} else {
- if (start_i > s_len)
+ if (start_i > s_len) {
start_i = s_len;
+ }
}
if (end_i < 0) {
end_i += s_len;
- if (end_i < 0)
+ if (end_i < 0) {
end_i = 0;
+ }
} else {
- if (end_i > s_len)
+ if (end_i > s_len) {
end_i = s_len;
+ }
}
var num_c = end_i - start_i;
- if (num_c < 0)
+ if (num_c < 0) {
num_c = 0;
+ }
return SubString(s, start_i, start_i + num_c);
}
@@ -692,7 +700,7 @@ function StringSubstring(start, end) {
}
}
- return (start_i + 1 == end_i
+ return ((start_i + 1 == end_i)
? %_StringCharAt(s, start_i)
: %_SubString(s, start_i, end_i));
}
@@ -736,7 +744,7 @@ function StringSubstr(start, n) {
var end = start + len;
if (end > s.length) end = s.length;
- return (start + 1 == end
+ return ((start + 1 == end)
? %_StringCharAt(s, start)
: %_SubString(s, start, end));
}
« no previous file with comments | « src/mirror-debugger.js ('k') | src/v8natives.js » ('j') | src/v8natives.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698