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

Side by Side Diff: third_party/protobuf/js/debug.js

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 'Only messages expected: ' + thing); 87 'Only messages expected: ' + thing);
88 var ctor = message.constructor; 88 var ctor = message.constructor;
89 var messageName = ctor.name || ctor.displayName; 89 var messageName = ctor.name || ctor.displayName;
90 var object = { 90 var object = {
91 '$name': messageName 91 '$name': messageName
92 }; 92 };
93 for (var name in ctor.prototype) { 93 for (var name in ctor.prototype) {
94 var match = /^get([A-Z]\w*)/.exec(name); 94 var match = /^get([A-Z]\w*)/.exec(name);
95 if (match && name != 'getExtension' && 95 if (match && name != 'getExtension' &&
96 name != 'getJsPbMessageId') { 96 name != 'getJsPbMessageId') {
97 var val = thing[name](); 97 var has = 'has' + match[1];
98 if (val != null) { 98 if (!thing[has] || thing[has]()) {
99 var val = thing[name]();
99 object[jspb.debug.formatFieldName_(match[1])] = jspb.debug.dump_(val); 100 object[jspb.debug.formatFieldName_(match[1])] = jspb.debug.dump_(val);
100 } 101 }
101 } 102 }
102 } 103 }
103 if (COMPILED && thing['extensionObject_']) { 104 if (COMPILED && thing['extensionObject_']) {
104 object['$extensions'] = 'Recursive dumping of extensions not supported ' + 105 object['$extensions'] = 'Recursive dumping of extensions not supported ' +
105 'in compiled code. Switch to uncompiled or dump extension object ' + 106 'in compiled code. Switch to uncompiled or dump extension object ' +
106 'directly'; 107 'directly';
107 return object; 108 return object;
108 } 109 }
(...skipping 22 matching lines...) Expand all
131 * @param {string} name Name of the field. 132 * @param {string} name Name of the field.
132 * @return {string} 133 * @return {string}
133 * @private 134 * @private
134 */ 135 */
135 jspb.debug.formatFieldName_ = function(name) { 136 jspb.debug.formatFieldName_ = function(name) {
136 // Name may be in TitleCase. 137 // Name may be in TitleCase.
137 return name.replace(/^[A-Z]/, function(c) { 138 return name.replace(/^[A-Z]/, function(c) {
138 return c.toLowerCase(); 139 return c.toLowerCase();
139 }); 140 });
140 }; 141 };
OLDNEW
« no previous file with comments | « third_party/protobuf/js/commonjs/export_testdeps.js ('k') | third_party/protobuf/js/debug_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698