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

Unified Diff: test/protos/dart_options.proto

Issue 2103743002: Rename mixin protos and add a check for undefined mixin name (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: test/protos/dart_options.proto
diff --git a/test/protos/dart_options.proto b/test/protos/dart_options.proto
index 7de2170eb7133a287e5872e6e3e0f8c7ce701e22..80565186350af9a55e6f606d170d3df01808aa59 100644
--- a/test/protos/dart_options.proto
+++ b/test/protos/dart_options.proto
@@ -3,44 +3,46 @@ syntax = "proto2";
package dart_options;
-// This file must be modified for google internal use,
+// This file must be modified for Google internal use,
// because custom options only work when the package name
// agrees with the version of protoc we are using.
// (The import statement and "google.protobuf." prefix need to be changed.)
import "descriptor_2_5_opensource.proto";
-// A mixin to be applied in the 'with' clause of a generated proto in dart.
+// A mixin that can be used in the 'with' clause of the generated Dart class
+// for a proto message.
message DartMixin {
- // Class name of the mixin class.
+ // The name of the mixin class.
optional string name = 1;
- // File from which the mixin class is imported.
+ // A URI pointing to the Dart library that defines the mixin.
// The generated Dart code will use this in an import statement.
optional string import_from = 2;
- // Used to apply multiple mixins to a proto.
- // The mixin listed in parent will always be applied before this one,
- // making the generated proto implement both mixins.
+ // The name of another mixin to be applied ahead of this one.
+ // The generated class for the message will inherit from all mixins
+ // in the parent chain.
optional string parent = 3;
}
-// Defines mixins imported from dart files to be used on messages in this file.
-message ImportedMixins {
+// Defines additional Dart imports to be used with messages in this file.
+message Imports {
- // The DartMixins to be imported.
+ // Mixins to be used on messages in this file.
+ // These mixins are in addition to internally defined mixins (e.g PbMapMixin)
+ // and may override them.
+ //
+ // Warning: mixins are experimental. The protoc Dart plugin doesn't check
+ // for name conflicts between mixin class members and generated class members,
+ // so the generated code may contain errors. Therefore, running dartanalyzer
+ // on the generated file is a good idea.
repeated DartMixin mixins = 1;
}
extend google.protobuf.FileOptions {
- // Defines the named mixins to be used on messages in this file.
- // These mixins are in addition to internally defined mixins (e.g PbMapMixin)
- // and may override them.
- // Warning: there is no checking at compile time for name conflicts between
- // identifiers defined in the mixin and proto-generated identifiers.
- // Running dartanalyzer on the generated file might find some of them.
- optional ImportedMixins imported_mixins = 28125061;
+ optional Imports imports = 28125061;
// Applies the named mixin to all messages in this file.
// (May be overridden by the "mixin" option on a message.)

Powered by Google App Engine
This is Rietveld 408576698