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

Side by Side Diff: lib/extension_generator.dart

Issue 68953002: Update the protocol buffer compiler plug-in library to the latest Dart SDK (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Addressed review comments (bumped version) Created 7 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 unified diff | Download patch
« no previous file with comments | « Makefile ('k') | lib/file_generator.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of protoc; 5 part of protoc;
6 6
7 class ExtensionGenerator implements ProtobufContainer { 7 class ExtensionGenerator implements ProtobufContainer {
8 final String fqname; 8 final String fqname;
9 final FieldDescriptorProto _descriptor; 9 final FieldDescriptorProto _descriptor;
10 final ProtobufContainer _parent; 10 final ProtobufContainer _parent;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 builder = ',${SP}()${SP}=>${SP}new ${typeName}()'; 62 builder = ',${SP}()${SP}=>${SP}new ${typeName}()';
63 } 63 }
64 } else { 64 } else {
65 if (_descriptor.label == FieldDescriptorProto_Label.LABEL_REPEATED) { 65 if (_descriptor.label == FieldDescriptorProto_Label.LABEL_REPEATED) {
66 initializer = ',${SP}()${SP}=>${SP}new PbList<${baseType}>()'; 66 initializer = ',${SP}()${SP}=>${SP}new PbList<${baseType}>()';
67 } else if (field.hasInitialization) { 67 } else if (field.hasInitialization) {
68 initializer = ',${SP}${field.initialization}'; 68 initializer = ',${SP}${field.initialization}';
69 } 69 }
70 } 70 }
71 71
72 if (field.enum) { 72 if (field.enm) {
73 if (initializer.isEmpty) { 73 if (initializer.isEmpty) {
74 initializer = ',${SP}null'; 74 initializer = ',${SP}null';
75 } 75 }
76 if (builder.isEmpty) { 76 if (builder.isEmpty) {
77 builder = ',${SP}null'; 77 builder = ',${SP}null';
78 } 78 }
79 valueOf = ',${SP}(var v)${SP}=>${SP}${field.baseType}.valueOf(v)'; 79 valueOf = ',${SP}(var v)${SP}=>${SP}${field.baseType}.valueOf(v)';
80 } 80 }
81 81
82 out.println('static final Extension $name${SP}=${SP}' 82 out.println('static final Extension $name${SP}=${SP}'
83 'new Extension(\'$extendee\',${SP}\'$name\',${SP}' 83 'new Extension(\'$extendee\',${SP}\'$name\',${SP}'
84 '${_descriptor.number},${SP}GeneratedMessage.$type' 84 '${_descriptor.number},${SP}GeneratedMessage.$type'
85 '${initializer}${builder}${valueOf}' 85 '${initializer}${builder}${valueOf}'
86 ');'); 86 ');');
87 } 87 }
88 88
89 String get name => classname; 89 String get name => classname;
90 } 90 }
OLDNEW
« no previous file with comments | « Makefile ('k') | lib/file_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698