diff --git a/pkg/analysis_server/tool/spec/from_html.dart b/pkg/analysis_server/tool/spec/from_html.dart index bf64d224dc3..d3a1ce7d212 100644 --- a/pkg/analysis_server/tool/spec/from_html.dart +++ b/pkg/analysis_server/tool/spec/from_html.dart @@ -529,7 +529,7 @@ class ApiReader { throw Exception('$context: name not specified'); } - context = '$context.$name}'; + context = '$context.$name'; checkAttributes(html, ['name'], context, optionalAttributes: [ 'optional', diff --git a/pkg/analysis_server/tool/spec/to_html.dart b/pkg/analysis_server/tool/spec/to_html.dart index 0bcc45e9a06..61381993ef3 100644 --- a/pkg/analysis_server/tool/spec/to_html.dart +++ b/pkg/analysis_server/tool/spec/to_html.dart @@ -754,6 +754,7 @@ class TypeVisitor extends HierarchicalApiVisitor writeln('{'); indent(() { for (var field in typeObject.fields) { + if (field.experimental) continue; write('"'); if (fieldsToBold.contains(field.name)) { b(() { diff --git a/pkg/analyzer_plugin/tool/spec/from_html.dart b/pkg/analyzer_plugin/tool/spec/from_html.dart index cd144a93ab8..53dc875dde0 100644 --- a/pkg/analyzer_plugin/tool/spec/from_html.dart +++ b/pkg/analyzer_plugin/tool/spec/from_html.dart @@ -478,11 +478,22 @@ class ApiReader { /// Child elements can occur in any order. TypeObjectField typeObjectFieldFromHtml(dom.Element html, String context) { checkName(html, 'field', context); + var name = html.attributes['name']; - context = '$context.${name ?? 'field'}'; + if (name == null) { + throw Exception('$context: name not specified'); + } + + context = '$context.$name'; checkAttributes(html, ['name'], context, - optionalAttributes: ['optional', 'value', 'deprecated']); + optionalAttributes: [ + 'optional', + 'value', + 'deprecated', + 'experimental' + ]); var deprecated = html.attributes['deprecated'] == 'true'; + var experimental = html.attributes['experimental'] == 'true'; var optional = false; var optionalString = html.attributes['optional']; if (optionalString != null) { @@ -500,8 +511,11 @@ class ApiReader { } var value = html.attributes['value']; var type = processContentsAsType(html, context); - return TypeObjectField(name!, type, html, - optional: optional, value: value, deprecated: deprecated); + return TypeObjectField(name, type, html, + optional: optional, + value: value, + deprecated: deprecated, + experimental: experimental); } /// Create a [TypeObject] from an HTML description. diff --git a/pkg/analyzer_plugin/tool/spec/to_html.dart b/pkg/analyzer_plugin/tool/spec/to_html.dart index 52fbdbe77fc..852a05f3713 100644 --- a/pkg/analyzer_plugin/tool/spec/to_html.dart +++ b/pkg/analyzer_plugin/tool/spec/to_html.dart @@ -644,6 +644,9 @@ class ToHtmlVisitor extends HierarchicalApiVisitor @override void visitTypeObjectField(TypeObjectField typeObjectField) { + if (typeObjectField.experimental) { + return; + } dt('field', () { b(() { if (typeObjectField.deprecated) { @@ -748,6 +751,7 @@ class TypeVisitor extends HierarchicalApiVisitor writeln('{'); indent(() { for (var field in typeObject.fields) { + if (field.experimental) continue; write('"'); final fieldsToBold = this.fieldsToBold; if (fieldsToBold != null && fieldsToBold.contains(field.name)) {