Index: tracing/tracing/mre/mre_result.html |
diff --git a/tracing/tracing/mre/mre_result.html b/tracing/tracing/mre/mre_result.html |
index 9df0d204ad6b6b77048c081404cab3356b372db4..e5cc92327791bee89ca9855137a3f25495ddea9e 100644 |
--- a/tracing/tracing/mre/mre_result.html |
+++ b/tracing/tracing/mre/mre_result.html |
@@ -12,10 +12,12 @@ found in the LICENSE file. |
tr.exportTo('tr.mre', function() { |
class MreResult { |
constructor(failures, pairs) { |
- if (failures === undefined) |
+ if (failures === undefined) { |
failures = []; |
- if (pairs === undefined) |
+ } |
+ if (pairs === undefined) { |
pairs = {}; |
+ } |
this.failures = failures; |
this.pairs = pairs; |
} |
@@ -25,8 +27,9 @@ tr.exportTo('tr.mre', function() { |
} |
addPair(key, value) { |
- if (key in this.pairs) |
+ if (key in this.pairs) { |
throw new Error('Key ' + key + ' already exists in result.'); |
+ } |
this.pairs[key] = value; |
} |
@@ -35,8 +38,9 @@ tr.exportTo('tr.mre', function() { |
pairs: this.pairs |
}; |
- if (this.failures) |
+ if (this.failures) { |
d.failures = this.failures.map(function(f) {return f.asDict();}); |
+ } |
return d; |
} |
@@ -46,8 +50,9 @@ tr.exportTo('tr.mre', function() { |
} |
static fromDict(resultDict) { |
- if (resultDict.failures !== undefined) |
+ if (resultDict.failures !== undefined) { |
var failures = resultDict.failures.map(tr.mre.Failure.fromDict); |
+ } |
var pairs = resultDict.pairs; |
return new MreResult(failures, pairs); |
} |