| 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 * Data structures representing an API definition, and visitor base classes | 6 * Data structures representing an API definition, and visitor base classes |
| 7 * for visiting those data structures. | 7 * for visiting those data structures. |
| 8 */ | 8 */ |
| 9 library api; | 9 library api; |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 : this.experimental = experimental ?? false; | 45 : this.experimental = experimental ?? false; |
| 46 } | 46 } |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Base class for visiting the API definition. | 49 * Base class for visiting the API definition. |
| 50 */ | 50 */ |
| 51 abstract class ApiVisitor<T> { | 51 abstract class ApiVisitor<T> { |
| 52 /** | 52 /** |
| 53 * Dispatch the given [type] to the visitor. | 53 * Dispatch the given [type] to the visitor. |
| 54 */ | 54 */ |
| 55 T visitTypeDecl(TypeDecl type) => type.accept(this); | 55 T visitTypeDecl(TypeDecl type) => type.accept(this) as T; |
| 56 T visitTypeEnum(TypeEnum typeEnum); | 56 T visitTypeEnum(TypeEnum typeEnum); |
| 57 T visitTypeList(TypeList typeList); | 57 T visitTypeList(TypeList typeList); |
| 58 T visitTypeMap(TypeMap typeMap); | 58 T visitTypeMap(TypeMap typeMap); |
| 59 T visitTypeObject(TypeObject typeObject); | 59 T visitTypeObject(TypeObject typeObject); |
| 60 T visitTypeReference(TypeReference typeReference); | 60 T visitTypeReference(TypeReference typeReference); |
| 61 | 61 |
| 62 T visitTypeUnion(TypeUnion typeUnion); | 62 T visitTypeUnion(TypeUnion typeUnion); |
| 63 } | 63 } |
| 64 | 64 |
| 65 /** | 65 /** |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 /** | 501 /** |
| 502 * The field that is used to disambiguate this union | 502 * The field that is used to disambiguate this union |
| 503 */ | 503 */ |
| 504 final String field; | 504 final String field; |
| 505 | 505 |
| 506 TypeUnion(this.choices, this.field, dom.Element html, {bool experimental}) | 506 TypeUnion(this.choices, this.field, dom.Element html, {bool experimental}) |
| 507 : super(html, experimental); | 507 : super(html, experimental); |
| 508 | 508 |
| 509 accept(ApiVisitor visitor) => visitor.visitTypeUnion(this); | 509 accept(ApiVisitor visitor) => visitor.visitTypeUnion(this); |
| 510 } | 510 } |
| OLD | NEW |