| 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 /** | |
| 40 * Instances of this class represent data that has been read from a summary. | 26 * Instances of this class represent data that has been read from a summary. |
| 41 */ | 27 */ |
| 42 abstract class SummaryClass { | 28 abstract class SummaryClass { |
| 43 /** | 29 /** |
| 30 * Translate the data in this class into a JSON map, whose keys are the names |
| 31 * of fields and whose values are the data stored in those fields, |
| 32 * recursively converted into JSON. |
| 33 * |
| 34 * Fields containing their default value are elided. |
| 35 * |
| 36 * Intended for testing and debugging only. |
| 37 */ |
| 38 Map<String, Object> toJson(); |
| 39 |
| 40 /** |
| 44 * Translate the data in this class into a map whose keys are the names of | 41 * Translate the data in this class into a map whose keys are the names of |
| 45 * fields and whose values are the data stored in those fields. | 42 * fields and whose values are the data stored in those fields. |
| 46 * | 43 * |
| 47 * Intended for testing and debugging only. | 44 * Intended for testing and debugging only. |
| 48 */ | 45 */ |
| 49 Map<String, Object> toMap(); | 46 Map<String, Object> toMap(); |
| 47 } |
| 50 | 48 |
| 49 /** |
| 50 * Annotation used in the summary IDL to indicate that a summary class can be |
| 51 * the top level object in an encoded summary. |
| 52 */ |
| 53 class TopLevel { |
| 51 /** | 54 /** |
| 52 * Translate the data in this class into a JSON map, whose keys are the names | 55 * If non-null, identifier that will be stored in bytes 4-7 of the file, |
| 53 * of fields and whose values are the data stored in those fields, | 56 * prior all other file data. Must be exactly 4 Latin1 characters. |
| 54 * recursively converted into JSON. | |
| 55 * | |
| 56 * Fields containing their default value are elided. | |
| 57 * | |
| 58 * Intended for testing and debugging only. | |
| 59 */ | 57 */ |
| 60 Map<String, Object> toJson(); | 58 final String fileIdentifier; |
| 59 |
| 60 const TopLevel([this.fileIdentifier]); |
| 61 } | 61 } |
| OLD | NEW |