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 protobuf; | 5 part of protobuf; |
6 | 6 |
7 /// Modifies a GeneratedMessage so that it's read-only. | 7 /// Modifies a GeneratedMessage so that it's read-only. |
8 abstract class ReadonlyMessageMixin { | 8 abstract class ReadonlyMessageMixin { |
9 BuilderInfo get info_; | 9 BuilderInfo get info_; |
10 | 10 |
11 bool get _isReadOnly => true; | 11 bool get _isReadOnly => true; |
12 | 12 |
13 void addExtension(Extension extension, var value) => | 13 void addExtension(Extension extension, var value) => |
14 _readonly("addExtension"); | 14 _readonly("addExtension"); |
15 | 15 |
16 void clear() => _readonly("clear"); | 16 void clear() => _readonly("clear"); |
17 | 17 |
18 void clearExtension(Extension extension) => _readonly("clearExtension"); | 18 void clearExtension(Extension extension) => _readonly("clearExtension"); |
19 | 19 |
20 void clearField(int tagNumber) => _readonly("clearField"); | 20 void clearField(int tagNumber) => _readonly("clearField"); |
21 | 21 |
22 List createRepeatedField(int tagNumber, FieldInfo fi) { | 22 List/*<T>*/ createRepeatedField/*<T>*/(int tagNumber, FieldInfo/*<T>*/ fi) { |
23 _readonly("createRepeatedField"); | 23 _readonly("createRepeatedField"); |
24 return null; // not reached | 24 return null; // not reached |
25 } | 25 } |
26 | 26 |
27 void mergeFromBuffer(List<int> input, | 27 void mergeFromBuffer(List<int> input, |
28 [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) => | 28 [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) => |
29 _readonly("mergeFromBuffer"); | 29 _readonly("mergeFromBuffer"); |
30 | 30 |
31 void mergeFromCodedBufferReader(CodedBufferReader input, | 31 void mergeFromCodedBufferReader(CodedBufferReader input, |
32 [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) => | 32 [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) => |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 UnknownFieldSetField _getField(int number) { | 91 UnknownFieldSetField _getField(int number) { |
92 _readonly("a merge method"); | 92 _readonly("a merge method"); |
93 return null; // not reached | 93 return null; // not reached |
94 } | 94 } |
95 | 95 |
96 void _readonly(String methodName) { | 96 void _readonly(String methodName) { |
97 throw new UnsupportedError( | 97 throw new UnsupportedError( |
98 "attempted to call $methodName on a read-only UnknownFieldSet"); | 98 "attempted to call $methodName on a read-only UnknownFieldSet"); |
99 } | 99 } |
100 } | 100 } |
OLD | NEW |