Skip to content

Commit

Permalink
Add declaration of clone() method
Browse files Browse the repository at this point in the history
(The protoc plugin automatically generates it.)

BUG=google#26
[email protected]

Review URL: https://chromiumcodereview.appspot.com//1425873002.
  • Loading branch information
Brian Slesinsky committed Oct 27, 2015
1 parent 9b0dc86 commit f9d8a67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const List<String> GeneratedMessage_reservedNames = const [
'eventPlugin',
'createRepeatedField',
'unknownFields',
'clone',
r'$_get',
r'$_has',
r'$_setBool',
Expand Down
4 changes: 4 additions & 0 deletions lib/src/protobuf/generated_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ abstract class GeneratedMessage {
/// to protobuf fields.
EventPlugin get eventPlugin => null;

/// Creates a deep copy of the fields in this message.
/// (The generated code uses [mergeFromMessage].)
GeneratedMessage clone();

UnknownFieldSet get unknownFields => _fieldSet._ensureUnknownFields();

bool get _isReadOnly => false;
Expand Down
2 changes: 2 additions & 0 deletions test/readonly_message_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ throwsError(Type expectedType, String expectedMessage) => throwsA(
class Rec extends GeneratedMessage with ReadonlyMessageMixin {
@override
BuilderInfo info_ = new BuilderInfo("rec");
@override
clone() => throw new UnimplementedError();
}

main() {
Expand Down

0 comments on commit f9d8a67

Please sign in to comment.