Skip to content

Commit

Permalink
Revert "Make PbMapMixin implement Map<String, dynamic>"
Browse files Browse the repository at this point in the history
We don't have a way to put type parameters on a mixin,
so we can't do this yet.

This reverts commit 97e5bb7.

BUG=
R=kevmoo@google.com

Review URL: https://codereview.chromium.org//2055973002 .
  • Loading branch information
Brian Slesinsky committed Jun 9, 2016
1 parent 97e5bb7 commit 7bc0bbb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.5.1+5

* Revert previous change because it causes strong mode type error
in the generated code. We will revisit this in a new version of
mixin support.

## 0.5.1+4

* Use a more refined implementation of `Map` in `PbMapMixin`
Expand Down
10 changes: 5 additions & 5 deletions lib/src/protobuf/mixins/map_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "package:protobuf/protobuf.dart" show BuilderInfo;
///
/// This mixin is enabled via an option in
/// dart_options.proto in dart-protoc-plugin.
abstract class PbMapMixin implements Map<String, dynamic> {
abstract class PbMapMixin implements Map {
// GeneratedMessage properties and methods used by this mixin.

BuilderInfo get info_;
Expand All @@ -29,8 +29,8 @@ abstract class PbMapMixin implements Map<String, dynamic> {
}

@override
void operator []=(String key, val) {
var tag = getTagNumber(key);
operator []=(key, val) {
var tag = getTagNumber(key as String);
if (tag == null) {
throw new ArgumentError(
"field '${key}' not found in ${info_.messageName}");
Expand All @@ -39,13 +39,13 @@ abstract class PbMapMixin implements Map<String, dynamic> {
}

@override
Iterable<String> get keys => info_.byName.keys;
get keys => info_.byName.keys;

@override
bool containsKey(Object key) => info_.byName.containsKey(key);

@override
int get length => info_.byName.length;
get length => info_.byName.length;

@override
remove(key) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: protobuf
version: 0.5.1+4
version: 0.5.1+5
author: Dart Team <misc@dartlang.org>
description: Runtime library for protobuf support.
homepage: https://github.com/dart-lang/dart-protobuf
Expand Down
2 changes: 1 addition & 1 deletion test/map_mixin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:test/test.dart' show test, expect, same, throws;
import 'mock_util.dart' show MockMessage, mockInfo;

// A minimal protobuf implementation compatible with PbMapMixin.
class Rec extends MockMessage with MapMixin<String, dynamic>, PbMapMixin {
class Rec extends MockMessage with MapMixin, PbMapMixin {
get info_ => _info;
static final _info = mockInfo("Rec", () => new Rec());

Expand Down

0 comments on commit 7bc0bbb

Please sign in to comment.