| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Resolves all cross-references in a set of proto files. | 7 /// Resolves all cross-references in a set of proto files. |
| 8 void link(GenerationOptions options, Iterable<FileGenerator> files) { | 8 void link(GenerationOptions options, Iterable<FileGenerator> files) { |
| 9 GenerationContext ctx = new GenerationContext(options); | 9 GenerationContext ctx = new GenerationContext(options); |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 /// The types available to proto fields. | 42 /// The types available to proto fields. |
| 43 final Map<String, ProtobufContainer> _typeRegistry = | 43 final Map<String, ProtobufContainer> _typeRegistry = |
| 44 <String, ProtobufContainer>{}; | 44 <String, ProtobufContainer>{}; |
| 45 | 45 |
| 46 GenerationContext(this.options); | 46 GenerationContext(this.options); |
| 47 | 47 |
| 48 /// Makes info about a .pb.dart file available for reference, | 48 /// Makes info about a .pb.dart file available for reference, |
| 49 /// using the filename given to us by protoc. | 49 /// using the filename given to us by protoc. |
| 50 void registerProtoFile(FileGenerator f) { | 50 void registerProtoFile(FileGenerator f) { |
| 51 _files[f._fileDescriptor.name] = f; | 51 _files[f.descriptor.name] = f; |
| 52 } | 52 } |
| 53 | 53 |
| 54 /// Makes a message, group, or enum available for reference. | 54 /// Makes a message, group, or enum available for reference. |
| 55 void registerFieldType(String name, ProtobufContainer type) { | 55 void registerFieldType(String name, ProtobufContainer type) { |
| 56 _typeRegistry[name] = type; | 56 _typeRegistry[name] = type; |
| 57 } | 57 } |
| 58 | 58 |
| 59 /// Returns info about a .pb.dart being imported, | 59 /// Returns info about a .pb.dart being imported, |
| 60 /// based on the filename given to us by protoc. | 60 /// based on the filename given to us by protoc. |
| 61 FileGenerator getImportedProtoFile(String name) => _files[name]; | 61 FileGenerator getImportedProtoFile(String name) => _files[name]; |
| 62 | 62 |
| 63 /// Returns info about the type of a message, group, or enum field, | 63 /// Returns info about the type of a message, group, or enum field, |
| 64 /// based on the fully qualified name given to us by protoc. | 64 /// based on the fully qualified name given to us by protoc. |
| 65 ProtobufContainer getFieldType(String name) => _typeRegistry[name]; | 65 ProtobufContainer getFieldType(String name) => _typeRegistry[name]; |
| 66 } | 66 } |
| OLD | NEW |