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

Side by Side Diff: lib/code_generator.dart

Issue 128003003: Fix issue with importing packages where the package name included a dot (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Update pubspec version Created 6 years, 11 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 unified diff | Download patch
« no previous file with comments | « Makefile ('k') | lib/enum_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 abstract class ProtobufContainer { 7 abstract class ProtobufContainer {
8 String get package; 8 String get package;
9 String get classname; 9 String get classname;
10 String get fqname; 10 String get fqname;
11 String get packageImportPrefix => package.replaceAll('.', r'$');
11 } 12 }
12 13
13 class CodeGenerator implements ProtobufContainer { 14 class CodeGenerator extends ProtobufContainer {
14 final Stream<List<int>> _streamIn; 15 final Stream<List<int>> _streamIn;
15 final IOSink _streamOut; 16 final IOSink _streamOut;
16 final IOSink _streamErr; 17 final IOSink _streamErr;
17 18
18 CodeGenerator(this._streamIn, this._streamOut, this._streamErr); 19 CodeGenerator(this._streamIn, this._streamOut, this._streamErr);
19 20
20 void generate() { 21 void generate() {
21 _streamIn 22 _streamIn
22 .fold(new BytesBuilder(), (builder, data) => builder..add(data)) 23 .fold(new BytesBuilder(), (builder, data) => builder..add(data))
23 .then((builder) => builder.takeBytes()) 24 .then((builder) => builder.takeBytes())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (errors.length > 0) { 101 if (errors.length > 0) {
101 response.error = errors.join('\n'); 102 response.error = errors.join('\n');
102 return null; 103 return null;
103 } else { 104 } else {
104 return new GenerationOptions._(fieldNameOptions); 105 return new GenerationOptions._(fieldNameOptions);
105 } 106 }
106 } 107 }
107 108
108 String fieldNameOption(String fqname) => fieldNameOptions[fqname]; 109 String fieldNameOption(String fqname) => fieldNameOptions[fqname];
109 } 110 }
OLDNEW
« no previous file with comments | « Makefile ('k') | lib/enum_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698