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

Unified Diff: tracing/tracing/extras/chrome/cc/util.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 9 months 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 | « tracing/tracing/extras/chrome/cc/tile.html ('k') | tracing/tracing/extras/chrome/chrome_auditor.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/extras/chrome/cc/util.html
diff --git a/tracing/tracing/extras/chrome/cc/util.html b/tracing/tracing/extras/chrome/cc/util.html
index cdc024e5e60fa9bce1b01a95286fc0122ed8e8f1..6dc6e312aba19219ec60608a37806f76cada486d 100644
--- a/tracing/tracing/extras/chrome/cc/util.html
+++ b/tracing/tracing/extras/chrome/cc/util.html
@@ -15,8 +15,9 @@ found in the LICENSE file.
tr.exportTo('tr.e.cc', function() {
var convertedNameCache = {};
function convertNameToJSConvention(name) {
- if (name in convertedNameCache)
+ if (name in convertedNameCache) {
return convertedNameCache[name];
+ }
if (name[0] === '_' ||
name[name.length - 1] === '_') {
@@ -30,8 +31,9 @@ tr.exportTo('tr.e.cc', function() {
return words[0];
}
- for (var i = 1; i < words.length; i++)
+ for (var i = 1; i < words.length; i++) {
words[i] = words[i][0].toUpperCase() + words[i].substring(1);
+ }
convertedNameCache[name] = words.join('');
return convertedNameCache[name];
@@ -62,10 +64,12 @@ tr.exportTo('tr.e.cc', function() {
function moveRequiredFieldsFromArgsToToplevel(object, fields) {
for (var i = 0; i < fields.length; i++) {
var key = fields[i];
- if (object.args[key] === undefined)
+ if (object.args[key] === undefined) {
throw Error('Expected field ' + key + ' not found in args');
- if (object[key] !== undefined)
+ }
+ if (object[key] !== undefined) {
throw Error('Field ' + key + ' already in object');
+ }
object[key] = object.args[key];
delete object.args[key];
}
@@ -74,10 +78,10 @@ tr.exportTo('tr.e.cc', function() {
function moveOptionalFieldsFromArgsToToplevel(object, fields) {
for (var i = 0; i < fields.length; i++) {
var key = fields[i];
- if (object.args[key] === undefined)
- continue;
- if (object[key] !== undefined)
+ if (object.args[key] === undefined) continue;
+ if (object[key] !== undefined) {
throw Error('Field ' + key + ' already in object');
+ }
object[key] = object.args[key];
delete object.args[key];
}
@@ -88,19 +92,20 @@ tr.exportTo('tr.e.cc', function() {
}
function preInitializeObjectInner(object, hasRecursed) {
- if (!(object instanceof Object))
- return;
+ if (!(object instanceof Object)) return;
if (object instanceof Array) {
- for (var i = 0; i < object.length; i++)
+ for (var i = 0; i < object.length; i++) {
preInitializeObjectInner(object[i], true);
+ }
return;
}
if (hasRecursed &&
(object instanceof tr.model.ObjectSnapshot ||
- object instanceof tr.model.ObjectInstance))
+ object instanceof tr.model.ObjectInstance)) {
return;
+ }
for (var key in object) {
var newKey = convertNameToJSConvention(key);
« no previous file with comments | « tracing/tracing/extras/chrome/cc/tile.html ('k') | tracing/tracing/extras/chrome/chrome_auditor.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698