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

Side by Side Diff: lib/code_generator.dart

Issue 93743006: Use package names as import prefixes when generating code (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Addressed review commetns 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 | « no previous file | 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;
9 String get classname;
8 String get fqname; 10 String get fqname;
9 String get classname;
10 } 11 }
11 12
12 class CodeGenerator implements ProtobufContainer { 13 class CodeGenerator implements ProtobufContainer {
13 final Stream<List<int>> _streamIn; 14 final Stream<List<int>> _streamIn;
14 final IOSink _streamOut; 15 final IOSink _streamOut;
15 final IOSink _streamErr; 16 final IOSink _streamErr;
16 17
17 CodeGenerator(this._streamIn, this._streamOut, this._streamErr); 18 CodeGenerator(this._streamIn, this._streamOut, this._streamErr);
18 19
19 void generate() { 20 void generate() {
(...skipping 19 matching lines...) Expand all
39 generators.add(generator); 40 generators.add(generator);
40 } 41 }
41 } 42 }
42 43
43 response.file.addAll( 44 response.file.addAll(
44 generators.map((filegen) => filegen.generateResponse())); 45 generators.map((filegen) => filegen.generateResponse()));
45 _streamOut.add(response.writeToBuffer()); 46 _streamOut.add(response.writeToBuffer());
46 }); 47 });
47 } 48 }
48 49
50 String get package => '';
51 String get classname => null;
49 String get fqname => ''; 52 String get fqname => '';
50 String get classname => null;
51 } 53 }
52 54
53 55
54 class GenerationOptions { 56 class GenerationOptions {
55 final Map<String, String> fieldNameOptions; 57 final Map<String, String> fieldNameOptions;
56 58
57 GenerationOptions._(this.fieldNameOptions); 59 GenerationOptions._(this.fieldNameOptions);
58 60
59 // Parse the options in the request. If there was an error in the 61 // Parse the options in the request. If there was an error in the
60 // options null is returned and the error is set on the response. 62 // options null is returned and the error is set on the response.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (errors.length > 0) { 100 if (errors.length > 0) {
99 response.error = errors.join('\n'); 101 response.error = errors.join('\n');
100 return null; 102 return null;
101 } else { 103 } else {
102 return new GenerationOptions._(fieldNameOptions); 104 return new GenerationOptions._(fieldNameOptions);
103 } 105 }
104 } 106 }
105 107
106 String fieldNameOption(String fqname) => fieldNameOptions[fqname]; 108 String fieldNameOption(String fqname) => fieldNameOptions[fqname];
107 } 109 }
OLDNEW
« no previous file with comments | « no previous file | lib/enum_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698