OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <!-- | 8 <!-- |
9 Include all Diagnostic subclasses here so that DiagnosticMap.addDicts() and | 9 Include all Diagnostic subclasses here so that DiagnosticMap.addDicts() and |
10 DiagnosticMap.fromDict() always have access to all subclasses in the | 10 DiagnosticMap.fromDict() always have access to all subclasses in the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 * @param {string} name | 62 * @param {string} name |
63 * @return {tr.v.d.Diagnostic} | 63 * @return {tr.v.d.Diagnostic} |
64 */ | 64 */ |
65 get: function(name) { | 65 get: function(name) { |
66 return this.diagnosticsByName_[name]; | 66 return this.diagnosticsByName_[name]; |
67 }, | 67 }, |
68 | 68 |
69 /** | 69 /** |
70 * Iterate over this map's key-value-pairs. | 70 * Iterate over this map's key-value-pairs. |
71 * | 71 * |
72 * @param {function(string, tr.v.d.Diagnostic)} cb | 72 * @param {function(string, tr.v.d.Diagnostic)} callback |
73 * @param {Object=} opt_this | 73 * @param {Object=} opt_this |
74 */ | 74 */ |
75 forEach: function(cb, opt_this) { | 75 forEach: function(callback, opt_this) { |
76 tr.b.iterItems(this.diagnosticsByName_, cb, opt_this || this); | 76 tr.b.iterItems(this.diagnosticsByName_, callback, opt_this || this); |
77 }, | 77 }, |
78 | 78 |
79 asDict: function() { | 79 asDict: function() { |
80 var dict = {}; | 80 var dict = {}; |
81 this.forEach(function(name, diagnostic) { | 81 this.forEach(function(name, diagnostic) { |
82 dict[name] = diagnostic.asDict(); | 82 dict[name] = diagnostic.asDict(); |
83 }); | 83 }); |
84 return dict; | 84 return dict; |
85 } | 85 } |
86 }; | 86 }; |
87 | 87 |
88 DiagnosticMap.fromDict = function(d) { | 88 DiagnosticMap.fromDict = function(d) { |
89 var diagnostics = new DiagnosticMap(); | 89 var diagnostics = new DiagnosticMap(); |
90 diagnostics.addDicts(d); | 90 diagnostics.addDicts(d); |
91 return diagnostics; | 91 return diagnostics; |
92 }; | 92 }; |
93 | 93 |
94 return { | 94 return { |
95 DiagnosticMap: DiagnosticMap | 95 DiagnosticMap: DiagnosticMap |
96 }; | 96 }; |
97 }); | 97 }); |
98 </script> | 98 </script> |
OLD | NEW |