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

Side by Side Diff: lib/src/protobuf/field_info.dart

Issue 1277863003: cleanup: move fieldType constants and functions to a separate file (Closed) Base URL: git@github.com:dart-lang/dart-protobuf.git@master
Patch Set: _validateMessage should call _baseType, not callers Created 5 years, 4 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
« no previous file with comments | « lib/src/protobuf/coded_buffer_writer.dart ('k') | lib/src/protobuf/field_type.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 7 /**
8 * An object representing a protobuf message field. 8 * An object representing a protobuf message field.
9 */ 9 */
10 class FieldInfo { 10 class FieldInfo {
11 final String name; 11 final String name;
12 final int tagNumber; 12 final int tagNumber;
13 final int type; 13 final int type;
14 final MakeDefaultFunc makeDefault; 14 final MakeDefaultFunc makeDefault;
15 final CreateBuilderFunc subBuilder; 15 final CreateBuilderFunc subBuilder;
16 final ValueOfFunc valueOf; 16 final ValueOfFunc valueOf;
17 17
18 FieldInfo(this.name, this.tagNumber, int type, 18 FieldInfo(this.name, this.tagNumber, int type,
19 [dynamic defaultOrMaker, 19 [dynamic defaultOrMaker,
20 this.subBuilder, 20 this.subBuilder,
21 this.valueOf]) 21 this.valueOf])
22 : this.type = type, 22 : this.type = type,
23 this.makeDefault = findMakeDefault(type, defaultOrMaker); 23 this.makeDefault = findMakeDefault(type, defaultOrMaker);
24 24
25 static MakeDefaultFunc findMakeDefault(int type, dynamic defaultOrMaker) { 25 static MakeDefaultFunc findMakeDefault(int type, dynamic defaultOrMaker) {
26 if (defaultOrMaker == null) return GeneratedMessage._defaultForType(type); 26 if (defaultOrMaker == null) return FieldType._defaultForType(type);
27 if (defaultOrMaker is MakeDefaultFunc) return defaultOrMaker; 27 if (defaultOrMaker is MakeDefaultFunc) return defaultOrMaker;
28 return () => defaultOrMaker; 28 return () => defaultOrMaker;
29 } 29 }
30 30
31 String toString() => name; 31 String toString() => name;
32 } 32 }
OLDNEW
« no previous file with comments | « lib/src/protobuf/coded_buffer_writer.dart ('k') | lib/src/protobuf/field_type.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698