| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** | 5 /** |
| 6 * Base functionality which code generated summary classes are built upon. | 6 * Base functionality which code generated summary classes are built upon. |
| 7 */ | 7 */ |
| 8 library analyzer.src.summary.base; | 8 library analyzer.src.summary.base; |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Annotation used in the summary IDL to indicate the id of a field. The set | 11 * Annotation used in the summary IDL to indicate the id of a field. The set |
| 12 * of ids used by a class must cover the contiguous range from 0 to N-1, where | 12 * of ids used by a class must cover the contiguous range from 0 to N-1, where |
| 13 * N is the number of fields. | 13 * N is the number of fields. |
| 14 * | 14 * |
| 15 * In order to preserve forwards and backwards compatibility, id numbers must | 15 * In order to preserve forwards and backwards compatibility, id numbers must |
| 16 * be stable between releases. So when new fields are added they should take | 16 * be stable between releases. So when new fields are added they should take |
| 17 * the next available id without renumbering other fields. | 17 * the next available id without renumbering other fields. |
| 18 */ | 18 */ |
| 19 class Id { | 19 class Id { |
| 20 final int value; | 20 final int value; |
| 21 | 21 |
| 22 const Id(this.value); | 22 const Id(this.value); |
| 23 } | 23 } |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Annotation used in the summary IDL to indicate that a summary class can be |
| 27 * the top level object in an encoded summary. |
| 28 */ |
| 29 class TopLevel { |
| 30 /** |
| 31 * If non-null, identifier that will be stored in bytes 4-7 of the file, |
| 32 * prior all other file data. Must be exactly 4 Latin1 characters. |
| 33 */ |
| 34 final String fileIdentifier; |
| 35 |
| 36 const TopLevel([this.fileIdentifier]); |
| 37 } |
| 38 |
| 39 /** |
| 26 * Instances of this class represent data that has been read from a summary. | 40 * Instances of this class represent data that has been read from a summary. |
| 27 */ | 41 */ |
| 28 abstract class SummaryClass { | 42 abstract class SummaryClass { |
| 29 /** | 43 /** |
| 30 * Translate the data in this class into a map whose keys are the names of | 44 * Translate the data in this class into a map whose keys are the names of |
| 31 * fields and whose values are the data stored in those fields. | 45 * fields and whose values are the data stored in those fields. |
| 32 * | 46 * |
| 33 * Intended for testing and debugging only. | 47 * Intended for testing and debugging only. |
| 34 */ | 48 */ |
| 35 Map<String, Object> toMap(); | 49 Map<String, Object> toMap(); |
| 36 | 50 |
| 37 /** | 51 /** |
| 38 * Translate the data in this class into a JSON map, whose keys are the names | 52 * Translate the data in this class into a JSON map, whose keys are the names |
| 39 * of fields and whose values are the data stored in those fields, | 53 * of fields and whose values are the data stored in those fields, |
| 40 * recursively converted into JSON. | 54 * recursively converted into JSON. |
| 41 * | 55 * |
| 42 * Fields containing their default value are elided. | 56 * Fields containing their default value are elided. |
| 43 * | 57 * |
| 44 * Intended for testing and debugging only. | 58 * Intended for testing and debugging only. |
| 45 */ | 59 */ |
| 46 Map<String, Object> toJson(); | 60 Map<String, Object> toJson(); |
| 47 } | 61 } |
| OLD | NEW |