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

Side by Side Diff: test/protos/dart_options.proto

Issue 2086253002: Allow application of external mixins to generated dart protos. (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Add support for mixins in protos. 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 unified diff | Download patch
OLDNEW
1 // Experimental options controlling Dart code generation. 1 // Experimental options controlling Dart code generation.
2 syntax = "proto2"; 2 syntax = "proto2";
3 3
4 package dart_options; 4 package dart_options;
5 5
6 // This file must be modified for google internal use, 6 // This file must be modified for google internal use,
7 // because custom options only work when the package name 7 // because custom options only work when the package name
8 // agrees with the version of protoc we are using. 8 // agrees with the version of protoc we are using.
9 // (The import statement and "google.protobuf." prefix need to be changed.) 9 // (The import statement and "google.protobuf." prefix need to be changed.)
10 10
11 import "descriptor_2_5_opensource.proto"; 11 import "descriptor_2_5_opensource.proto";
12 12
13 // A mixin to be applied in the 'with' clause of a generated proto in dart.
14 message DartMixin {
15 // Class name of the mixin class.
16 optional string name = 1;
17
18 // File from which the mixin class is imported.
19 // The generated Dart code will use this in an import statement.
20 optional string import_from = 2;
21
22 // Used to apply multiple mixins to a proto.
23 // The mixin listed in parent will always be applied before this one,
24 // making the generated proto implement both mixins.
25 optional string parent = 3;
26 }
27
13 extend google.protobuf.FileOptions { 28 extend google.protobuf.FileOptions {
14 29
30 // Defines the named mixins to be used on messages in this file.
31 // These mixins are in addition to internally defined mixins (e.g PbMapMixin)
32 // and may override them.
skybrian 2016/06/22 20:29:53 Need a warning here: there is no error-checking fo
frederikmutzel 2016/06/23 12:30:16 Done.
33 repeated DartMixin mixins = 28125061;
34
15 // Applies the named mixin to all messages in this file. 35 // Applies the named mixin to all messages in this file.
16 // (May be overridden by the "mixin" option on a message.) 36 // (May be overridden by the "mixin" option on a message.)
17 // For now, "PbMapMixin" is the only available mixin. 37 // For now, "PbMapMixin" is the only available mixin.
18 optional string default_mixin = 96128839; 38 optional string default_mixin = 96128839;
19 } 39 }
20 40
21 extend google.protobuf.MessageOptions { 41 extend google.protobuf.MessageOptions {
22 42
23 // Applies the named mixin. 43 // Applies the named mixin.
24 // For now, "PbMapMixin" is the only available mixin. 44 // For now, "PbMapMixin" is the only available mixin.
25 // The empty string can be used to turn off mixins for this message. 45 // The empty string can be used to turn off mixins for this message.
26 optional string mixin = 96128839; 46 optional string mixin = 96128839;
27 } 47 }
28 48
29 extend google.protobuf.FieldOptions { 49 extend google.protobuf.FieldOptions {
30 50
51 // Specifies a field to override getters/setters from the inherited mixin.
skybrian 2016/06/22 20:29:53 I don't see any implementation of "override" - tha
frederikmutzel 2016/06/23 12:30:16 Right, removed for now.
52 optional bool override = 28205290;
53
31 // Uses the given name for getters, setters and as suffixes for has/clear 54 // Uses the given name for getters, setters and as suffixes for has/clear
32 // methods in the generated Dart file. Should be lowerCamelCase. 55 // methods in the generated Dart file. Should be lowerCamelCase.
33 optional string dart_name = 28700919; 56 optional string dart_name = 28700919;
34 } 57 }
OLDNEW
« test/mixin_test.dart ('K') | « test/mixin_test.dart ('k') | test/protos/mixins.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698