diff --git a/shared/yeast/doc/yeast.md b/shared/yeast/doc/yeast.md index 3e3e1cd3610f..fdd0f230cb17 100644 --- a/shared/yeast/doc/yeast.md +++ b/shared/yeast/doc/yeast.md @@ -235,6 +235,17 @@ yeast::trees!(ctx, (identifier #{name}) // an identifier from a Rust variable ``` +For reviewing locations, `DumpOptions::show_abridged_source` prints each node's +source range with every direct child replaced by its field name in Unicode +angle brackets. This keeps delimiters and other parent-owned syntax visible +without repeating entire subtrees: + +```text +return_expr source="return ⟨value⟩" + value: + call_expr source="⟨callee⟩(⟨argument⟩)" +``` + ### Optional fields (`?`) A `?` on a field's value makes that field fallible. If a `#{expr}` anywhere diff --git a/shared/yeast/src/dump.rs b/shared/yeast/src/dump.rs index 0e2e57e6f82a..ddcf3ae12b4e 100644 --- a/shared/yeast/src/dump.rs +++ b/shared/yeast/src/dump.rs @@ -15,6 +15,9 @@ pub struct DumpOptions { pub show_locations: bool, /// Whether to include source text for leaf nodes. pub show_content: bool, + /// Whether to include each node's source range with direct-child ranges + /// replaced by their field names in `⟨angle brackets⟩`. + pub show_abridged_source: bool, } impl Default for DumpOptions { @@ -22,6 +25,7 @@ impl Default for DumpOptions { Self { show_locations: false, show_content: true, + show_abridged_source: false, } } } @@ -226,6 +230,10 @@ fn dump_node( } } + if options.show_abridged_source { + write_source_skeleton(ast, node, source, out); + } + if let Some(context) = type_check { if let Some(err) = type_error_for_node(context.schema, node, context.expected, context.parent_field) @@ -409,6 +417,10 @@ fn dump_node_inline( } } + if options.show_abridged_source { + write_source_skeleton(ast, node, source, out); + } + if let Some(context) = type_check { if let Some(err) = type_error_for_node(context.schema, node, context.expected, context.parent_field) @@ -424,6 +436,246 @@ fn is_leaf(node: &Node) -> bool { node.fields.is_empty() } +enum SourceSkeleton { + Missing, + Text(String), + Invalid(String), +} + +fn write_source_skeleton(ast: &Ast, node: &Node, source: &str, out: &mut String) { + match source_skeleton(ast, node, source) { + SourceSkeleton::Missing => write!(out, " source=").unwrap(), + SourceSkeleton::Text(text) => write!(out, " source={text:?}").unwrap(), + SourceSkeleton::Invalid(error) => write!(out, " source=").unwrap(), + } +} + +fn node_source_range(node: &Node) -> Option { + match node.content { + NodeContent::Range(range) => Some(range), + _ => node.source_range, + } +} + +fn source_skeleton(ast: &Ast, node: &Node, source: &str) -> SourceSkeleton { + let Some(parent) = node_source_range(node) else { + return SourceSkeleton::Missing; + }; + let parent = parent.start_byte..parent.end_byte; + if parent.start > parent.end || source.get(parent.clone()).is_none() { + return SourceSkeleton::Invalid(format!( + "node range {}..{} is outside the source or not on UTF-8 boundaries", + parent.start, parent.end + )); + } + + let mut children = Vec::new(); + for (field_id, child_ids) in &node.fields { + let field_name = if *field_id == CHILD_FIELD { + "child" + } else { + ast.field_name_for_id(*field_id).unwrap_or("?") + }; + for child_id in child_ids { + let Some(child) = ast.get_node(*child_id) else { + continue; + }; + if !child.is_named() { + continue; + } + let Some(child) = node_source_range(child) else { + continue; + }; + let child = child.start_byte..child.end_byte; + if child.start > child.end || source.get(child.clone()).is_none() { + return SourceSkeleton::Invalid(format!( + "child range {}..{} is outside the source or not on UTF-8 boundaries", + child.start, child.end + )); + } + if child.start < parent.start || child.end > parent.end { + return SourceSkeleton::Invalid(format!( + "child range {}..{} is outside node range {}..{}", + child.start, child.end, parent.start, parent.end + )); + } + if child.start == child.end { + continue; + } + children.push((child, field_name)); + } + } + children.sort_by_key(|(range, field_name)| (range.start, range.end, *field_name)); + + let mut result = String::new(); + let mut cursor = parent.start; + for (range, field_name) in children { + if cursor < range.start { + result.push_str(source.get(cursor..range.start).unwrap()); + } + result.push('⟨'); + result.push_str(field_name); + result.push('⟩'); + cursor = cursor.max(range.end); + } + result.push_str(source.get(cursor..parent.end).unwrap()); + SourceSkeleton::Text(result) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{NodeContent, Point, Range}; + use std::collections::BTreeMap; + + fn range(start: usize, end: usize) -> Range { + Range { + start_byte: start, + end_byte: end, + start_point: Point::new(0, start), + end_point: Point::new(0, end), + } + } + + fn dump_with_children(source: &str, parent_range: Range, children: &[(&str, Range)]) -> String { + let mut ast = Ast::with_schema(crate::schema::Schema::new()); + let parent_kind = ast.register_kind("parent"); + let child_kind = ast.register_kind("child"); + let mut fields = BTreeMap::new(); + for (field_name, range) in children { + let field = ast.register_field(field_name); + let child = ast.create_node_with_range( + child_kind, + NodeContent::Range(*range), + BTreeMap::new(), + true, + None, + ); + fields.entry(field).or_insert_with(Vec::new).push(child); + } + let parent = ast.create_node_with_range( + parent_kind, + NodeContent::Range(parent_range), + fields, + true, + None, + ); + ast.set_root(parent); + + dump_ast_with_options( + &ast, + parent, + source, + &DumpOptions { + show_locations: false, + show_content: false, + show_abridged_source: true, + }, + ) + } + + #[test] + fn source_skeleton_elides_direct_children_and_ignores_empty_ranges() { + let source = "αbefore(child)afterω"; + let child_start = source.find("child").unwrap(); + let child_end = child_start + "child".len(); + let dump = dump_with_children( + source, + range(0, source.len()), + &[ + ("value", range(child_start, child_end)), + ("marker", range(child_start, child_start)), + ], + ); + + assert!(dump.starts_with("parent source=\"αbefore(⟨value⟩)afterω\"\n")); + } + + #[test] + fn source_skeleton_preserves_unnamed_tokens() { + let source = "x = 1"; + let runner: crate::Runner = crate::Runner::new(tree_sitter_ruby::LANGUAGE.into(), &[]); + let ast = runner.run(source).unwrap(); + let dump = dump_ast_with_options( + &ast, + ast.get_root(), + source, + &DumpOptions { + show_locations: false, + show_content: false, + show_abridged_source: true, + }, + ); + + assert!(dump.contains("assignment source=\"⟨left⟩ = ⟨right⟩\"")); + } + + #[test] + fn source_skeleton_validates_empty_child_ranges() { + let cases = [ + ( + "abcdef", + range(0, 3), + range(4, 4), + "child range 4..4 is outside node range 0..3", + ), + ( + "abcdef", + range(0, 6), + range(7, 7), + "child range 7..7 is outside the source or not on UTF-8 boundaries", + ), + ( + "αbc", + range(0, 4), + range(1, 1), + "child range 1..1 is outside the source or not on UTF-8 boundaries", + ), + ]; + + for (source, parent, child, error) in cases { + let dump = dump_with_children(source, parent, &[("marker", child)]); + assert!( + dump.starts_with(&format!("parent source=\n")), + "unexpected dump: {dump}" + ); + } + } + + #[test] + fn source_skeleton_keeps_adjacent_child_fields_separate() { + let source = "abcdef"; + let dump = dump_with_children( + source, + range(0, source.len()), + &[("left", range(1, 3)), ("right", range(3, 5))], + ); + + assert!(dump.starts_with("parent source=\"a⟨left⟩⟨right⟩f\"\n")); + } + + #[test] + fn source_skeleton_keeps_overlapping_child_fields_separate() { + let source = "abcdef"; + let dump = dump_with_children( + source, + range(0, source.len()), + &[("left", range(1, 4)), ("right", range(3, 5))], + ); + + assert!(dump.starts_with("parent source=\"a⟨left⟩⟨right⟩f\"\n")); + } + + #[test] + fn source_skeleton_reports_children_outside_the_parent() { + let source = "abcdefghi"; + let dump = dump_with_children(source, range(0, 6), &[("child", range(7, 9))]); + + assert!(dump + .starts_with("parent source=\n")); + } +} + fn node_content(node: &Node, source: &str) -> String { match &node.content { NodeContent::DynamicString(s) if !s.is_empty() => s.clone(), diff --git a/unified/extractor/tests/corpus/swift/closures/closure-with-capture-list.output b/unified/extractor/tests/corpus/swift/closures/closure-with-capture-list.output index 64de98c7b745..1e28176add2b 100644 --- a/unified/extractor/tests/corpus/swift/closures/closure-with-capture-list.output +++ b/unified/extractor/tests/corpus/swift/closures/closure-with-capture-list.output @@ -60,24 +60,24 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "f" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "f" source="f" value: - function_expr + function_expr source="⟨body⟩⟨capture_declaration⟩" capture_declaration: - variable_declaration - modifier: modifier "weak" - pattern: identifier "self" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩" + modifier: modifier "weak" source="weak" + pattern: identifier "self" source="self" body: - block + block source="{ [weak self] in ⟨stmt⟩ }" stmt: - call_expr + call_expr source="⟨callee⟩()" callee: - member_access_expr - base: identifier "self" - member_name_node: identifier "doThing" + member_access_expr source="⟨base⟩?.⟨member_name_node⟩" + base: identifier "self" source="self" + member_name_node: identifier "doThing" source="doThing" diff --git a/unified/extractor/tests/corpus/swift/closures/closure-with-explicit-parameters.output b/unified/extractor/tests/corpus/swift/closures/closure-with-explicit-parameters.output index dca87eb8bebc..a44783d172d1 100644 --- a/unified/extractor/tests/corpus/swift/closures/closure-with-explicit-parameters.output +++ b/unified/extractor/tests/corpus/swift/closures/closure-with-explicit-parameters.output @@ -62,24 +62,24 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "f" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "f" source="f" value: - function_expr + function_expr source="⟨body⟩⟨parameter⟩⟨return_type⟩" parameter: - parameter - type: identifier "Int" - pattern: identifier "x" - return_type: identifier "Int" + parameter source="⟨pattern⟩: ⟨type⟩" + type: identifier "Int" source="Int" + pattern: identifier "x" source="x" + return_type: identifier "Int" source="Int" body: - block + block source="{ (x: Int) -> Int in ⟨stmt⟩ }" stmt: - binary_expr - left: identifier "x" - operator: infix_operator "*" - right: int_literal "2" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "*" source="*" + right: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/closures/closure-with-shorthand-parameters.output b/unified/extractor/tests/corpus/swift/closures/closure-with-shorthand-parameters.output index 2473ae994abe..6de0b9bea57c 100644 --- a/unified/extractor/tests/corpus/swift/closures/closure-with-shorthand-parameters.output +++ b/unified/extractor/tests/corpus/swift/closures/closure-with-shorthand-parameters.output @@ -39,19 +39,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "f" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "f" source="f" value: - function_expr + function_expr source="⟨body⟩" body: - block + block source="{ ⟨stmt⟩ }" stmt: - binary_expr - left: identifier "$0" - operator: infix_operator "+" - right: identifier "$1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "$0" source="$0" + operator: infix_operator "+" source="+" + right: identifier "$1" source="$1" diff --git a/unified/extractor/tests/corpus/swift/closures/multi-statement-closure.output b/unified/extractor/tests/corpus/swift/closures/multi-statement-closure.output index 83b9fec3302a..36649bd5ac0d 100644 --- a/unified/extractor/tests/corpus/swift/closures/multi-statement-closure.output +++ b/unified/extractor/tests/corpus/swift/closures/multi-statement-closure.output @@ -93,34 +93,34 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "f" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "f" source="f" value: - function_expr + function_expr source="⟨body⟩⟨parameter⟩⟨return_type⟩" parameter: - parameter - type: identifier "Int" - pattern: identifier "x" - return_type: identifier "Int" + parameter source="⟨pattern⟩: ⟨type⟩" + type: identifier "Int" source="Int" + pattern: identifier "x" source="x" + return_type: identifier "Int" source="Int" body: - block + block source="{ (x: Int) -> Int in\n ⟨stmt⟩\n ⟨stmt⟩\n}" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "y" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "y" source="y" value: - binary_expr - left: identifier "x" - operator: infix_operator "+" - right: int_literal "1" - return_expr + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "+" source="+" + right: int_literal "1" source="1" + return_expr source="return ⟨value⟩" value: - binary_expr - left: identifier "y" - operator: infix_operator "*" - right: int_literal "2" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "y" source="y" + operator: infix_operator "*" source="*" + right: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/closures/trailing-closure.output b/unified/extractor/tests/corpus/swift/closures/trailing-closure.output index 399075b488db..ad75555b1002 100644 --- a/unified/extractor/tests/corpus/swift/closures/trailing-closure.output +++ b/unified/extractor/tests/corpus/swift/closures/trailing-closure.output @@ -39,23 +39,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - call_expr + call_expr source="⟨callee⟩⟨argument⟩" callee: - member_access_expr - base: identifier "xs" - member_name_node: identifier "map" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "xs" source="xs" + member_name_node: identifier "map" source="map" argument: - argument + argument source="xs.map ⟨value⟩" value: - function_expr + function_expr source="⟨body⟩" body: - block + block source="{ ⟨stmt⟩ }" stmt: - binary_expr - left: identifier "$0" - operator: infix_operator "*" - right: int_literal "2" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "$0" source="$0" + operator: infix_operator "*" source="*" + right: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/collections/array-literal.output b/unified/extractor/tests/corpus/swift/collections/array-literal.output index b6fd3a4331bc..51c65ac2a0f0 100644 --- a/unified/extractor/tests/corpus/swift/collections/array-literal.output +++ b/unified/extractor/tests/corpus/swift/collections/array-literal.output @@ -41,16 +41,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "xs" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "xs" source="xs" value: - array_literal + array_literal source="[⟨element⟩, ⟨element⟩, ⟨element⟩]" element: - int_literal "1" - int_literal "2" - int_literal "3" + int_literal "1" source="1" + int_literal "2" source="2" + int_literal "3" source="3" diff --git a/unified/extractor/tests/corpus/swift/collections/dictionary-literal.output b/unified/extractor/tests/corpus/swift/collections/dictionary-literal.output index f2a2be74c780..7993dd1a841a 100644 --- a/unified/extractor/tests/corpus/swift/collections/dictionary-literal.output +++ b/unified/extractor/tests/corpus/swift/collections/dictionary-literal.output @@ -52,11 +52,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "d" - value: map_literal "[\"a\": 1, \"b\": 2]" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "d" source="d" + value: map_literal "[\"a\": 1, \"b\": 2]" source="[\"a\": 1, \"b\": 2]" diff --git a/unified/extractor/tests/corpus/swift/collections/dictionary-subscript.output b/unified/extractor/tests/corpus/swift/collections/dictionary-subscript.output index bf67e55bd23d..b7719365bbc6 100644 --- a/unified/extractor/tests/corpus/swift/collections/dictionary-subscript.output +++ b/unified/extractor/tests/corpus/swift/collections/dictionary-subscript.output @@ -41,16 +41,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "v" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "v" source="v" value: - call_expr - callee: identifier "d" + call_expr source="⟨callee⟩[⟨argument⟩]" + callee: identifier "d" source="d" argument: - argument - value: string_literal "\"key\"" + argument source="⟨value⟩" + value: string_literal "\"key\"" source="\"key\"" diff --git a/unified/extractor/tests/corpus/swift/collections/empty-array-literal-with-type.output b/unified/extractor/tests/corpus/swift/collections/empty-array-literal-with-type.output index 5e562153961b..28958f323827 100644 --- a/unified/extractor/tests/corpus/swift/collections/empty-array-literal-with-type.output +++ b/unified/extractor/tests/corpus/swift/collections/empty-array-literal-with-type.output @@ -37,15 +37,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "xs" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "xs" source="xs" type: - generic_type_expr - base: identifier "Array" - type_argument: identifier "Int" - value: array_literal "[]" + generic_type_expr source="⟨base⟩⟨type_argument⟩" + base: identifier "Array" source="[Int]" + type_argument: identifier "Int" source="Int" + value: array_literal "[]" source="[]" diff --git a/unified/extractor/tests/corpus/swift/collections/set-literal.output b/unified/extractor/tests/corpus/swift/collections/set-literal.output index 071c7c4fcb70..97cf2cf6a72a 100644 --- a/unified/extractor/tests/corpus/swift/collections/set-literal.output +++ b/unified/extractor/tests/corpus/swift/collections/set-literal.output @@ -56,20 +56,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "s" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "s" source="s" type: - generic_type_expr - base: identifier "Set" - type_argument: identifier "Int" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "Set" source="Set" + type_argument: identifier "Int" source="Int" value: - array_literal + array_literal source="[⟨element⟩, ⟨element⟩, ⟨element⟩]" element: - int_literal "1" - int_literal "2" - int_literal "3" + int_literal "1" source="1" + int_literal "2" source="2" + int_literal "3" source="3" diff --git a/unified/extractor/tests/corpus/swift/collections/subscript-access.output b/unified/extractor/tests/corpus/swift/collections/subscript-access.output index 6067a9a90684..771004ff717f 100644 --- a/unified/extractor/tests/corpus/swift/collections/subscript-access.output +++ b/unified/extractor/tests/corpus/swift/collections/subscript-access.output @@ -38,16 +38,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "first" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "first" source="first" value: - call_expr - callee: identifier "xs" + call_expr source="⟨callee⟩[⟨argument⟩]" + callee: identifier "xs" source="xs" argument: - argument - value: int_literal "0" + argument source="⟨value⟩" + value: int_literal "0" source="0" diff --git a/unified/extractor/tests/corpus/swift/collections/tuple-literal.output b/unified/extractor/tests/corpus/swift/collections/tuple-literal.output index 4a8a54078d9c..653bce662689 100644 --- a/unified/extractor/tests/corpus/swift/collections/tuple-literal.output +++ b/unified/extractor/tests/corpus/swift/collections/tuple-literal.output @@ -45,19 +45,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "t" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "t" source="t" value: - tuple_expr + tuple_expr source="(⟨element⟩ ⟨element⟩ ⟨element⟩)" element: - argument - value: int_literal "1" - argument - value: string_literal "\"two\"" - argument - value: float_literal "3.0" + argument source="⟨value⟩," + value: int_literal "1" source="1" + argument source="⟨value⟩," + value: string_literal "\"two\"" source="\"two\"" + argument source="⟨value⟩" + value: float_literal "3.0" source="3.0" diff --git a/unified/extractor/tests/corpus/swift/collections/tuple-member-access.output b/unified/extractor/tests/corpus/swift/collections/tuple-member-access.output index ed31af94f0aa..d5eb860a528e 100644 --- a/unified/extractor/tests/corpus/swift/collections/tuple-member-access.output +++ b/unified/extractor/tests/corpus/swift/collections/tuple-member-access.output @@ -31,14 +31,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "n" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "n" source="n" value: - member_access_expr - base: identifier "t" - member_name_node: identifier "0" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "t" source="t" + member_name_node: identifier "0" source="0" diff --git a/unified/extractor/tests/corpus/swift/control-flow/binding-modifier-does-not-leak-to-sibling.output b/unified/extractor/tests/corpus/swift/control-flow/binding-modifier-does-not-leak-to-sibling.output index 1a50d875f783..f960f16a50f9 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/binding-modifier-does-not-leak-to-sibling.output +++ b/unified/extractor/tests/corpus/swift/control-flow/binding-modifier-does-not-leak-to-sibling.output @@ -84,28 +84,28 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" - value: int_literal "1" - switch_expr - value: identifier "y" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" + value: int_literal "1" source="1" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n}" + value: identifier "y" source="y" case: - switch_case - pattern: identifier "someConstant" + switch_case source="⟨body⟩⟨pattern⟩" + pattern: identifier "someConstant" source="someConstant" body: - block + block source="case someConstant:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"matched\"" - switch_case + argument source="⟨value⟩" + value: string_literal "\"matched\"" source="\"matched\"" + switch_case source="⟨body⟩" body: - block - stmt: break_expr "break" + block source="default:\n ⟨stmt⟩" + stmt: break_expr "break" source="break" diff --git a/unified/extractor/tests/corpus/swift/control-flow/defer-statement.output b/unified/extractor/tests/corpus/swift/control-flow/defer-statement.output index 0a9adb11a990..78f25fbd9551 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/defer-statement.output +++ b/unified/extractor/tests/corpus/swift/control-flow/defer-statement.output @@ -75,18 +75,18 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "withCleanup" + function_declaration source="⟨body⟩⟨name_node⟩" + name_node: identifier "withCleanup" source="withCleanup" body: - block + block source="func withCleanup() {\n ⟨stmt⟩\n ⟨stmt⟩\n}" stmt: - unsupported_node "defer { print(\"cleanup\") }" - call_expr - callee: identifier "print" + unsupported_node "defer { print(\"cleanup\") }" source="defer { print(\"cleanup\") }" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"work\"" + argument source="⟨value⟩" + value: string_literal "\"work\"" source="\"work\"" diff --git a/unified/extractor/tests/corpus/swift/control-flow/discard-statement.output b/unified/extractor/tests/corpus/swift/control-flow/discard-statement.output index c4418dba888b..b2c21eee642e 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/discard-statement.output +++ b/unified/extractor/tests/corpus/swift/control-flow/discard-statement.output @@ -63,20 +63,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "Resource" + class_like_declaration source="⟨modifier⟩⟨base_type⟩⟨name_node⟩⟨member⟩" + modifier: modifier "struct" source="struct" + name_node: identifier "Resource" source="Resource" base_type: - base_type - type: unsupported_node "~Copyable" + base_type source="struct Resource: ⟨type⟩ {\n consuming func close() {\n discard self\n }\n}" + type: unsupported_node "~Copyable" source="~Copyable" member: - function_declaration - modifier: modifier "consuming" - name_node: identifier "close" + function_declaration source="⟨modifier⟩⟨body⟩⟨name_node⟩" + modifier: modifier "consuming" source="consuming" + name_node: identifier "close" source="close" body: - block - stmt: unsupported_node "discard self" + block source="consuming func close() {\n ⟨stmt⟩\n }" + stmt: unsupported_node "discard self" source="discard self" diff --git a/unified/extractor/tests/corpus/swift/control-flow/fallthrough.output b/unified/extractor/tests/corpus/swift/control-flow/fallthrough.output index a0920ac436aa..c5752060af62 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/fallthrough.output +++ b/unified/extractor/tests/corpus/swift/control-flow/fallthrough.output @@ -82,29 +82,29 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "classify" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩" + name_node: identifier "classify" source="classify" parameter: - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "x" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "x" source="x" body: - block + block source="func classify(_ x: Int) {\n ⟨stmt⟩\n}" stmt: - switch_expr - value: identifier "x" + switch_expr source="switch ⟨value⟩ {\n ⟨case⟩\n ⟨case⟩\n }" + value: identifier "x" source="x" case: - switch_case - pattern: int_literal "1" + switch_case source="⟨body⟩⟨pattern⟩" + pattern: int_literal "1" source="1" body: - block - stmt: unsupported_node "fallthrough" - switch_case + block source="case 1:\n ⟨stmt⟩" + stmt: unsupported_node "fallthrough" source="fallthrough" + switch_case source="⟨body⟩" body: - block - stmt: break_expr "break" + block source="default:\n ⟨stmt⟩" + stmt: break_expr "break" source="break" diff --git a/unified/extractor/tests/corpus/swift/control-flow/guard-let.output b/unified/extractor/tests/corpus/swift/control-flow/guard-let.output index 2eb1682529f1..aefb475a5bde 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/guard-let.output +++ b/unified/extractor/tests/corpus/swift/control-flow/guard-let.output @@ -36,26 +36,26 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - guard_if_stmt + guard_if_stmt source="guard ⟨condition⟩ else ⟨else⟩" condition: - pattern_guard_expr + pattern_guard_expr source="⟨pattern⟩⟨value⟩" pattern: - call_expr + call_expr source="⟨argument⟩⟨callee⟩" callee: - member_access_expr - base: identifier "Optional" - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: identifier "Optional" source="let value = optional" + member_name_node: identifier "some" source="let value = optional" argument: - argument + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "value" - value: identifier "optional" + expr_pattern source="⟨modifier⟩⟨expr⟩" + modifier: modifier "let" source="let value = optional" + expr: identifier "value" source="value" + value: identifier "optional" source="optional" else: - block - stmt: return_expr "return" + block source="{ ⟨stmt⟩ }" + stmt: return_expr "return" source="return" diff --git a/unified/extractor/tests/corpus/swift/control-flow/if-case-let-with-shadowing-in-condition-value.output b/unified/extractor/tests/corpus/swift/control-flow/if-case-let-with-shadowing-in-condition-value.output index 1b44ec1e7707..07ae6d16afae 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/if-case-let-with-shadowing-in-condition-value.output +++ b/unified/extractor/tests/corpus/swift/control-flow/if-case-let-with-shadowing-in-condition-value.output @@ -112,46 +112,46 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n\n⟨stmt⟩" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - pattern_guard_expr + pattern_guard_expr source="case ⟨pattern⟩ = ⟨value⟩" pattern: - expr_pattern - modifier: modifier "let" - expr: identifier "x" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "x" source="x" value: - binary_expr - left: identifier "x" - operator: infix_operator "+" - right: int_literal "10" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "+" source="+" + right: int_literal "10" source="10" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "x" - if_expr + argument source="⟨value⟩" + value: identifier "x" source="x" + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - pattern_guard_expr + pattern_guard_expr source="case ⟨pattern⟩ = ⟨value⟩" pattern: - expr_pattern - modifier: modifier "var" - expr: identifier "y" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "var" source="var" + expr: identifier "y" source="y" value: - binary_expr - left: identifier "y" - operator: infix_operator "+" - right: int_literal "10" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "y" source="y" + operator: infix_operator "+" source="+" + right: int_literal "10" source="10" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - binary_expr - left: identifier "y" - operator: infix_operator "+=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "y" source="y" + operator: infix_operator "+=" source="+=" + right: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/control-flow/if-else-if-chain.output b/unified/extractor/tests/corpus/swift/control-flow/if-else-if-chain.output index 82c5b6c468ca..b6e3c1bcd939 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/if-else-if-chain.output +++ b/unified/extractor/tests/corpus/swift/control-flow/if-else-if-chain.output @@ -108,44 +108,44 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩ else ⟨else⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: int_literal "1" + argument source="⟨value⟩" + value: int_literal "1" source="1" else: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩ else ⟨else⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator "<" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "<" source="<" + right: int_literal "0" source="0" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: int_literal "2" + argument source="⟨value⟩" + value: int_literal "2" source="2" else: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: int_literal "3" + argument source="⟨value⟩" + value: int_literal "3" source="3" diff --git a/unified/extractor/tests/corpus/swift/control-flow/if-else.output b/unified/extractor/tests/corpus/swift/control-flow/if-else.output index 86c3b9cd876c..121d7e747e89 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/if-else.output +++ b/unified/extractor/tests/corpus/swift/control-flow/if-else.output @@ -73,32 +73,32 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩ else ⟨else⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "x" + argument source="⟨value⟩" + value: identifier "x" source="x" else: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument + argument source="⟨value⟩" value: - unary_expr - operand: identifier "x" - operator: prefix_operator "-" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: identifier "x" source="x" + operator: prefix_operator "-" source="-" diff --git a/unified/extractor/tests/corpus/swift/control-flow/if-let-optional-binding.output b/unified/extractor/tests/corpus/swift/control-flow/if-let-optional-binding.output index 1a09a2874e9a..e878953ff7b4 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/if-let-optional-binding.output +++ b/unified/extractor/tests/corpus/swift/control-flow/if-let-optional-binding.output @@ -49,31 +49,31 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - pattern_guard_expr + pattern_guard_expr source="⟨pattern⟩⟨value⟩" pattern: - call_expr + call_expr source="⟨argument⟩⟨callee⟩" callee: - member_access_expr - base: identifier "Optional" - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: identifier "Optional" source="let value = optional" + member_name_node: identifier "some" source="let value = optional" argument: - argument + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "value" - value: identifier "optional" + expr_pattern source="⟨modifier⟩⟨expr⟩" + modifier: modifier "let" source="let value = optional" + expr: identifier "value" source="value" + value: identifier "optional" source="optional" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "value" + argument source="⟨value⟩" + value: identifier "value" source="value" diff --git a/unified/extractor/tests/corpus/swift/control-flow/if-statement.output b/unified/extractor/tests/corpus/swift/control-flow/if-statement.output index c0a7cfd021d8..b5616ee887da 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/if-statement.output +++ b/unified/extractor/tests/corpus/swift/control-flow/if-statement.output @@ -48,21 +48,21 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "x" + argument source="⟨value⟩" + value: identifier "x" source="x" diff --git a/unified/extractor/tests/corpus/swift/control-flow/nested-enum-case-pattern.output b/unified/extractor/tests/corpus/swift/control-flow/nested-enum-case-pattern.output index 4d0afdcb77db..0d403fd592ea 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/nested-enum-case-pattern.output +++ b/unified/extractor/tests/corpus/swift/control-flow/nested-enum-case-pattern.output @@ -155,68 +155,68 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - switch_expr - value: identifier "event" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n⟨case⟩\n}" + value: identifier "event" source="event" case: - switch_case + switch_case source="⟨body⟩⟨pattern⟩" pattern: - expr_pattern - modifier: modifier "let" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" expr: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩ ⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "received" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "received" source="received" argument: - argument + argument source="⟨value⟩" value: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)," callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "some" source="some" argument: - argument - value: identifier "value" - argument - value: identifier "timestamp" + argument source="⟨value⟩" + value: identifier "value" source="value" + argument source="⟨value⟩" + value: identifier "timestamp" source="timestamp" body: - block + block source="case let .received(.some(value), timestamp):\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩ ⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "value" - argument - value: identifier "timestamp" - switch_case + argument source="⟨value⟩," + value: identifier "value" source="value" + argument source="⟨value⟩" + value: identifier "timestamp" source="timestamp" + switch_case source="⟨body⟩⟨pattern⟩" pattern: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: identifier "Type" - member_name_node: identifier "some" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "Type" source="Type" + member_name_node: identifier "some" source="some" argument: - argument + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "value" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "value" source="value" body: - block + block source="case Type.some(let value):\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "value" - switch_case + argument source="⟨value⟩" + value: identifier "value" source="value" + switch_case source="⟨body⟩" body: - block - stmt: break_expr "break" + block source="default:\n ⟨stmt⟩" + stmt: break_expr "break" source="break" diff --git a/unified/extractor/tests/corpus/swift/control-flow/switch-case-item-where-clauses.output b/unified/extractor/tests/corpus/swift/control-flow/switch-case-item-where-clauses.output index 77adadc261b1..a14f115a3f72 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/switch-case-item-where-clauses.output +++ b/unified/extractor/tests/corpus/swift/control-flow/switch-case-item-where-clauses.output @@ -150,62 +150,62 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - switch_expr - value: identifier "n" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n⟨case⟩\n}" + value: identifier "n" source="n" case: - switch_case + switch_case source="⟨body⟩⟨pattern⟩" pattern: - conditional_pattern + conditional_pattern source="⟨pattern⟩ where ⟨condition⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" pattern: - expr_pattern - modifier: modifier "let" - expr: identifier "x" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "x" source="x" body: - block + block source="case let x where x > 0:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"positive\"" - switch_case + argument source="⟨value⟩" + value: string_literal "\"positive\"" source="\"positive\"" + switch_case source="⟨body⟩⟨pattern⟩" pattern: - or_pattern + or_pattern source="case ⟨pattern⟩ ⟨pattern⟩:\n print(\"non-positive\")" pattern: - conditional_pattern + conditional_pattern source="⟨pattern⟩ where ⟨condition⟩," condition: - binary_expr - left: identifier "y" - operator: infix_operator "<" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "y" source="y" + operator: infix_operator "<" source="<" + right: int_literal "0" source="0" pattern: - expr_pattern - modifier: modifier "let" - expr: identifier "y" - int_literal "0" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "y" source="y" + int_literal "0" source="0" body: - block + block source="case let y where y < 0, 0:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"non-positive\"" - switch_case + argument source="⟨value⟩" + value: string_literal "\"non-positive\"" source="\"non-positive\"" + switch_case source="⟨body⟩" body: - block + block source="default:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"other\"" + argument source="⟨value⟩" + value: string_literal "\"other\"" source="\"other\"" diff --git a/unified/extractor/tests/corpus/swift/control-flow/switch-expression-pattern.output b/unified/extractor/tests/corpus/swift/control-flow/switch-expression-pattern.output index 533f717b827e..e86af77df08d 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/switch-expression-pattern.output +++ b/unified/extractor/tests/corpus/swift/control-flow/switch-expression-pattern.output @@ -300,96 +300,96 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - switch_expr - value: identifier "subject" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n⟨case⟩\n}" + value: identifier "subject" source="subject" case: - switch_case + switch_case source="⟨body⟩⟨pattern⟩" pattern: - or_pattern + or_pattern source="case ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩,\n ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩,\n ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩, ⟨pattern⟩:\n consume(value)" pattern: - identifier "value" - binary_expr - left: identifier "value" - operator: infix_operator "+" - right: identifier "offset" - unary_expr - operand: identifier "value" - operator: prefix_operator "-" - binary_expr - left: identifier "lower" - operator: infix_operator "..." - right: identifier "upper" - call_expr - callee: identifier "makeValue" - member_access_expr + identifier "value" source="value" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "value" source="value" + operator: infix_operator "+" source="+" + right: identifier "offset" source="offset" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: identifier "value" source="value" + operator: prefix_operator "-" source="-" + binary_expr source="⟨left⟩⟨operator⟩⟨right⟩" + left: identifier "lower" source="lower" + operator: infix_operator "..." source="..." + right: identifier "upper" source="upper" + call_expr source="⟨callee⟩()" + callee: identifier "makeValue" source="makeValue" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" base: - call_expr - callee: identifier "makeValue" - member_name_node: identifier "member" - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "inferred" - tuple_expr + call_expr source="⟨callee⟩()" + callee: identifier "makeValue" source="makeValue" + member_name_node: identifier "member" source="member" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "inferred" source="inferred" + tuple_expr source="(⟨element⟩ ⟨element⟩)" element: - argument - value: identifier "value" - argument - value: identifier "offset" - array_literal - element: identifier "value" - map_literal "[key: value]" - call_expr + argument source="⟨value⟩," + value: identifier "value" source="value" + argument source="⟨value⟩" + value: identifier "offset" source="offset" + array_literal source="[⟨element⟩]" + element: identifier "value" source="value" + map_literal "[key: value]" source="[key: value]" + call_expr source="⟨argument⟩⟨callee⟩" callee: - member_access_expr - base: identifier "Optional" - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: identifier "Optional" source="optional?" + member_name_node: identifier "some" source="optional?" argument: - argument - value: identifier "optional" - unary_expr - operand: identifier "value" - operator: prefix_operator "try" - unary_expr - operand: identifier "value" - operator: postfix_operator "!" - type_cast_expr - expr: identifier "value" - operator: infix_operator "as" - type: identifier "Target" - type_test_expr - expr: identifier "value" - operator: infix_operator "is" - type: identifier "Target" - unary_expr - operand: identifier "value" - operator: prefix_operator "await" + argument source="⟨value⟩?" + value: identifier "optional" source="optional" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: identifier "value" source="value" + operator: prefix_operator "try" source="try value" + unary_expr source="⟨operand⟩⟨operator⟩" + operand: identifier "value" source="value" + operator: postfix_operator "!" source="value!" + type_cast_expr source="⟨expr⟩⟨operator⟩⟨type⟩" + expr: identifier "value" source="value" + operator: infix_operator "as" source="value as Target" + type: identifier "Target" source="Target" + type_test_expr source="⟨expr⟩⟨operator⟩⟨type⟩" + expr: identifier "value" source="value" + operator: infix_operator "is" source="value is Target" + type: identifier "Target" source="Target" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: identifier "value" source="value" + operator: prefix_operator "await" source="await value" body: - block + block source="case value, value + offset, -value, lower...upper, makeValue(), makeValue().member,\n .inferred, (value, offset), [value], [key: value], optional?, try value,\n value!, value as Target, value is Target, await value:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "consume" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "consume" source="consume" argument: - argument - value: identifier "value" - switch_case + argument source="⟨value⟩" + value: identifier "value" source="value" + switch_case source="⟨body⟩⟨pattern⟩" pattern: - if_expr - condition: identifier "condition" - then: identifier "value" - else: identifier "fallback" + if_expr source="⟨condition⟩ ? ⟨then⟩ : ⟨else⟩" + condition: identifier "condition" source="condition" + then: identifier "value" source="value" + else: identifier "fallback" source="fallback" body: - block + block source="case condition ? value : fallback:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "consume" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "consume" source="consume" argument: - argument - value: identifier "fallback" - switch_case + argument source="⟨value⟩" + value: identifier "fallback" source="fallback" + switch_case source="⟨body⟩" body: - block - stmt: break_expr "break" + block source="default:\n ⟨stmt⟩" + stmt: break_expr "break" source="break" diff --git a/unified/extractor/tests/corpus/swift/control-flow/switch-statement.output b/unified/extractor/tests/corpus/swift/control-flow/switch-statement.output index 3ba92e37ab8f..90372a736d22 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/switch-statement.output +++ b/unified/extractor/tests/corpus/swift/control-flow/switch-statement.output @@ -120,43 +120,43 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - switch_expr - value: identifier "x" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n⟨case⟩\n}" + value: identifier "x" source="x" case: - switch_case - pattern: int_literal "1" + switch_case source="⟨body⟩⟨pattern⟩" + pattern: int_literal "1" source="1" body: - block + block source="case 1:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"one\"" - switch_case + argument source="⟨value⟩" + value: string_literal "\"one\"" source="\"one\"" + switch_case source="⟨body⟩⟨pattern⟩" pattern: - or_pattern + or_pattern source="case ⟨pattern⟩, ⟨pattern⟩:\n print(\"two or three\")" pattern: - int_literal "2" - int_literal "3" + int_literal "2" source="2" + int_literal "3" source="3" body: - block + block source="case 2, 3:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"two or three\"" - switch_case + argument source="⟨value⟩" + value: string_literal "\"two or three\"" source="\"two or three\"" + switch_case source="⟨body⟩" body: - block + block source="default:\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"other\"" + argument source="⟨value⟩" + value: string_literal "\"other\"" source="\"other\"" diff --git a/unified/extractor/tests/corpus/swift/control-flow/switch-with-binding-pattern.output b/unified/extractor/tests/corpus/swift/control-flow/switch-with-binding-pattern.output index 5820da95f35c..8d4d98ec7078 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/switch-with-binding-pattern.output +++ b/unified/extractor/tests/corpus/swift/control-flow/switch-with-binding-pattern.output @@ -115,52 +115,52 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - switch_expr - value: identifier "shape" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n}" + value: identifier "shape" source="shape" case: - switch_case + switch_case source="⟨body⟩⟨pattern⟩" pattern: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "circle" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "circle" source="circle" argument: - argument + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "r" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "r" source="r" body: - block + block source="case .circle(let r):\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "r" - switch_case + argument source="⟨value⟩" + value: identifier "r" source="r" + switch_case source="⟨body⟩⟨pattern⟩" pattern: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "square" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "square" source="square" argument: - argument + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "s" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "s" source="s" body: - block + block source="case .square(let s):\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "s" + argument source="⟨value⟩" + value: identifier "s" source="s" diff --git a/unified/extractor/tests/corpus/swift/control-flow/switch-with-labeled-case-pattern-arguments.output b/unified/extractor/tests/corpus/swift/control-flow/switch-with-labeled-case-pattern-arguments.output index aca699ad6f74..8f7a0ae5f1f1 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/switch-with-labeled-case-pattern-arguments.output +++ b/unified/extractor/tests/corpus/swift/control-flow/switch-with-labeled-case-pattern-arguments.output @@ -123,53 +123,53 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - switch_expr - value: identifier "x" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n}" + value: identifier "x" source="x" case: - switch_case + switch_case source="⟨body⟩⟨pattern⟩" pattern: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "implicit" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "implicit" source="implicit" argument: - argument - name_node: identifier "isAcknowledged" - value: boolean_literal "false" + argument source="⟨name_node⟩: ⟨value⟩" + name_node: identifier "isAcknowledged" source="isAcknowledged" + value: boolean_literal "false" source="false" body: - block + block source="case .implicit(isAcknowledged: false):\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"yes\"" - switch_case + argument source="⟨value⟩" + value: string_literal "\"yes\"" source="\"yes\"" + switch_case source="⟨body⟩⟨pattern⟩" pattern: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩ ⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "thread" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "thread" source="thread" argument: - argument - name_node: identifier "threadRowId" - value: identifier "_" - argument + argument source="⟨name_node⟩: ⟨value⟩," + name_node: identifier "threadRowId" source="threadRowId" + value: identifier "_" source="_" + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "rowId" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "rowId" source="rowId" body: - block + block source="case .thread(threadRowId: _, let rowId):\n ⟨stmt⟩" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "rowId" + argument source="⟨value⟩" + value: identifier "rowId" source="rowId" diff --git a/unified/extractor/tests/corpus/swift/control-flow/ternary-expression.output b/unified/extractor/tests/corpus/swift/control-flow/ternary-expression.output index 299d84c7822f..e864a67ea560 100644 --- a/unified/extractor/tests/corpus/swift/control-flow/ternary-expression.output +++ b/unified/extractor/tests/corpus/swift/control-flow/ternary-expression.output @@ -46,22 +46,22 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "y" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "y" source="y" value: - if_expr + if_expr source="⟨condition⟩ ? ⟨then⟩ : ⟨else⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" - then: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" + then: int_literal "1" source="1" else: - unary_expr - operand: int_literal "1" - operator: prefix_operator "-" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: int_literal "1" source="1" + operator: prefix_operator "-" source="-" diff --git a/unified/extractor/tests/corpus/swift/desugar/additive-expression-is-desugared.output b/unified/extractor/tests/corpus/swift/desugar/additive-expression-is-desugared.output index 30d9570f3bee..3ee44dd60a05 100644 --- a/unified/extractor/tests/corpus/swift/desugar/additive-expression-is-desugared.output +++ b/unified/extractor/tests/corpus/swift/desugar/additive-expression-is-desugared.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: int_literal "1" - operator: infix_operator "+" - right: int_literal "2" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: int_literal "1" source="1" + operator: infix_operator "+" source="+" + right: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/desugar/another-additive-expression-is-desugared.output b/unified/extractor/tests/corpus/swift/desugar/another-additive-expression-is-desugared.output index e27b9c7089ec..e655642a6640 100644 --- a/unified/extractor/tests/corpus/swift/desugar/another-additive-expression-is-desugared.output +++ b/unified/extractor/tests/corpus/swift/desugar/another-additive-expression-is-desugared.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "foo" - operator: infix_operator "+" - right: identifier "bar" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "foo" source="foo" + operator: infix_operator "+" source="+" + right: identifier "bar" source="bar" diff --git a/unified/extractor/tests/corpus/swift/desugar/import-with-deeply-nested-path-three-parts.output b/unified/extractor/tests/corpus/swift/desugar/import-with-deeply-nested-path-three-parts.output index 85e830e07383..a35890d96301 100644 --- a/unified/extractor/tests/corpus/swift/desugar/import-with-deeply-nested-path-three-parts.output +++ b/unified/extractor/tests/corpus/swift/desugar/import-with-deeply-nested-path-three-parts.output @@ -23,19 +23,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - import_declaration + import_declaration source="⟨pattern⟩⟨imported_expr⟩" imported_expr: - member_access_expr + member_access_expr source="⟨base⟩.⟨member_name_node⟩" base: - member_access_expr - base: identifier "Foundation" - member_name_node: identifier "Networking" - member_name_node: identifier "URLSession" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "Foundation" source="Foundation" + member_name_node: identifier "Networking" source="Networking" + member_name_node: identifier "URLSession" source="URLSession" pattern: - named_pattern - name_node: identifier "URLSession" - sub_pattern: bulk_importing_pattern "import Foundation.Networking.URLSession" + named_pattern source="⟨sub_pattern⟩⟨name_node⟩" + name_node: identifier "URLSession" source="URLSession" + sub_pattern: bulk_importing_pattern "import Foundation.Networking.URLSession" source="import Foundation.Networking.URLSession" diff --git a/unified/extractor/tests/corpus/swift/desugar/import-with-dotted-path-two-parts.output b/unified/extractor/tests/corpus/swift/desugar/import-with-dotted-path-two-parts.output index 966d399f070d..3f069a347481 100644 --- a/unified/extractor/tests/corpus/swift/desugar/import-with-dotted-path-two-parts.output +++ b/unified/extractor/tests/corpus/swift/desugar/import-with-dotted-path-two-parts.output @@ -20,16 +20,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - import_declaration + import_declaration source="⟨pattern⟩⟨imported_expr⟩" imported_expr: - member_access_expr - base: identifier "Foundation" - member_name_node: identifier "Networking" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "Foundation" source="Foundation" + member_name_node: identifier "Networking" source="Networking" pattern: - named_pattern - name_node: identifier "Networking" - sub_pattern: bulk_importing_pattern "import Foundation.Networking" + named_pattern source="⟨sub_pattern⟩⟨name_node⟩" + name_node: identifier "Networking" source="Networking" + sub_pattern: bulk_importing_pattern "import Foundation.Networking" source="import Foundation.Networking" diff --git a/unified/extractor/tests/corpus/swift/desugar/scoped-import-uses-name-pattern.output b/unified/extractor/tests/corpus/swift/desugar/scoped-import-uses-name-pattern.output index 6983e5408fbc..cd7415127b7e 100644 --- a/unified/extractor/tests/corpus/swift/desugar/scoped-import-uses-name-pattern.output +++ b/unified/extractor/tests/corpus/swift/desugar/scoped-import-uses-name-pattern.output @@ -21,14 +21,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - import_declaration - modifier: modifier "struct" + import_declaration source="import ⟨modifier⟩ ⟨imported_expr⟩⟨pattern⟩" + modifier: modifier "struct" source="struct" imported_expr: - member_access_expr - base: identifier "Foundation" - member_name_node: identifier "Date" - pattern: identifier "Date" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "Foundation" source="Foundation" + member_name_node: identifier "Date" source="Date" + pattern: identifier "Date" source="Date" diff --git a/unified/extractor/tests/corpus/swift/desugar/simple-import-with-single-name.output b/unified/extractor/tests/corpus/swift/desugar/simple-import-with-single-name.output index a7c401563932..d52673da8dda 100644 --- a/unified/extractor/tests/corpus/swift/desugar/simple-import-with-single-name.output +++ b/unified/extractor/tests/corpus/swift/desugar/simple-import-with-single-name.output @@ -17,13 +17,13 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - import_declaration - imported_expr: identifier "Foundation" + import_declaration source="⟨pattern⟩⟨imported_expr⟩" + imported_expr: identifier "Foundation" source="Foundation" pattern: - named_pattern - name_node: identifier "Foundation" - sub_pattern: bulk_importing_pattern "import Foundation" + named_pattern source="⟨sub_pattern⟩⟨name_node⟩" + name_node: identifier "Foundation" source="Foundation" + sub_pattern: bulk_importing_pattern "import Foundation" source="import Foundation" diff --git a/unified/extractor/tests/corpus/swift/expressions/array-type-constructor.output b/unified/extractor/tests/corpus/swift/expressions/array-type-constructor.output index 6f33fc0321a4..2ab188e028f7 100644 --- a/unified/extractor/tests/corpus/swift/expressions/array-type-constructor.output +++ b/unified/extractor/tests/corpus/swift/expressions/array-type-constructor.output @@ -124,50 +124,50 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "values" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "values" source="values" value: - call_expr + call_expr source="⟨callee⟩" callee: - generic_type_expr - base: identifier "Array" + generic_type_expr source="⟨base⟩⟨type_argument⟩" + base: identifier "Array" source="[Result]()" type_argument: - generic_type_expr - base: identifier "Result" - type_argument: identifier "Void" - variable_declaration - modifier: modifier "let" - pattern: identifier "initialized" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "Result" source="Result" + type_argument: identifier "Void" source="Void" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "initialized" source="initialized" value: - call_expr + call_expr source="⟨argument⟩⟨callee⟩⟨argument⟩" callee: - generic_type_expr - base: identifier "Array" + generic_type_expr source="⟨base⟩⟨type_argument⟩" + base: identifier "Array" source="[Result](unsafeUninitializedCapacity: 1) { _, count in\n\tcount = 0\n}" type_argument: - generic_type_expr - base: identifier "Result" - type_argument: identifier "Void" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "Result" source="Result" + type_argument: identifier "Void" source="Void" argument: - argument - name_node: identifier "unsafeUninitializedCapacity" - value: int_literal "1" - argument + argument source="⟨name_node⟩: ⟨value⟩" + name_node: identifier "unsafeUninitializedCapacity" source="unsafeUninitializedCapacity" + value: int_literal "1" source="1" + argument source="[Result](unsafeUninitializedCapacity: 1) ⟨value⟩" value: - function_expr + function_expr source="⟨body⟩⟨parameter⟩⟨parameter⟩" parameter: - parameter - pattern: identifier "_" - parameter - pattern: identifier "count" + parameter source="⟨pattern⟩," + pattern: identifier "_" source="_" + parameter source="⟨pattern⟩" + pattern: identifier "count" source="count" body: - block + block source="{ _, count in\n\t⟨stmt⟩\n}" stmt: - binary_expr - left: identifier "count" - operator: infix_operator "=" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "count" source="count" + operator: infix_operator "=" source="=" + right: int_literal "0" source="0" diff --git a/unified/extractor/tests/corpus/swift/expressions/array-type-metatype.output b/unified/extractor/tests/corpus/swift/expressions/array-type-metatype.output index 080cf34bb3c1..98c721af9fab 100644 --- a/unified/extractor/tests/corpus/swift/expressions/array-type-metatype.output +++ b/unified/extractor/tests/corpus/swift/expressions/array-type-metatype.output @@ -48,20 +48,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "type" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "type" source="type" value: - member_access_expr + member_access_expr source="⟨base⟩⟨member_name_node⟩" base: - generic_type_expr - base: identifier "Array" + generic_type_expr source="⟨base⟩⟨type_argument⟩" + base: identifier "Array" source="[Result].self" type_argument: - generic_type_expr - base: identifier "Result" - type_argument: identifier "Void" - member_name_node: identifier "self" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "Result" source="Result" + type_argument: identifier "Void" source="Void" + member_name_node: identifier "self" source="self" diff --git a/unified/extractor/tests/corpus/swift/expressions/consume-expression.output b/unified/extractor/tests/corpus/swift/expressions/consume-expression.output index aedba985574d..3b9f369f8ad9 100644 --- a/unified/extractor/tests/corpus/swift/expressions/consume-expression.output +++ b/unified/extractor/tests/corpus/swift/expressions/consume-expression.output @@ -62,20 +62,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "original" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "original" source="original" value: - array_literal + array_literal source="[⟨element⟩, ⟨element⟩, ⟨element⟩]" element: - int_literal "1" - int_literal "2" - int_literal "3" - variable_declaration - modifier: modifier "let" - pattern: identifier "consumed" - value: unsupported_node "consume original" + int_literal "1" source="1" + int_literal "2" source="2" + int_literal "3" source="3" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "consumed" source="consumed" + value: unsupported_node "consume original" source="consume original" diff --git a/unified/extractor/tests/corpus/swift/expressions/copy-expression.output b/unified/extractor/tests/corpus/swift/expressions/copy-expression.output index 448dd95e78b3..523e8c9dddec 100644 --- a/unified/extractor/tests/corpus/swift/expressions/copy-expression.output +++ b/unified/extractor/tests/corpus/swift/expressions/copy-expression.output @@ -62,20 +62,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "original" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "original" source="original" value: - array_literal + array_literal source="[⟨element⟩, ⟨element⟩, ⟨element⟩]" element: - int_literal "1" - int_literal "2" - int_literal "3" - variable_declaration - modifier: modifier "let" - pattern: identifier "copied" - value: unsupported_node "copy original" + int_literal "1" source="1" + int_literal "2" source="2" + int_literal "3" source="3" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "copied" source="copied" + value: unsupported_node "copy original" source="copy original" diff --git a/unified/extractor/tests/corpus/swift/expressions/generic-specialization-expression.output b/unified/extractor/tests/corpus/swift/expressions/generic-specialization-expression.output index b8b3a5a7903f..f952f5a44509 100644 --- a/unified/extractor/tests/corpus/swift/expressions/generic-specialization-expression.output +++ b/unified/extractor/tests/corpus/swift/expressions/generic-specialization-expression.output @@ -42,16 +42,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "numbers" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "numbers" source="numbers" value: - call_expr + call_expr source="⟨callee⟩()" callee: - generic_type_expr - base: identifier "Array" - type_argument: identifier "Int" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "Array" source="Array" + type_argument: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus/swift/expressions/key-path-expression.output b/unified/extractor/tests/corpus/swift/expressions/key-path-expression.output index c71105e4ee2e..95a2a440847f 100644 --- a/unified/extractor/tests/corpus/swift/expressions/key-path-expression.output +++ b/unified/extractor/tests/corpus/swift/expressions/key-path-expression.output @@ -36,11 +36,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "keyPath" - value: unsupported_node "\\String.count" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "keyPath" source="keyPath" + value: unsupported_node "\\String.count" source="\\String.count" diff --git a/unified/extractor/tests/corpus/swift/expressions/unsafe-expression.output b/unified/extractor/tests/corpus/swift/expressions/unsafe-expression.output index a91bf6e2684c..06d2e76d6f55 100644 --- a/unified/extractor/tests/corpus/swift/expressions/unsafe-expression.output +++ b/unified/extractor/tests/corpus/swift/expressions/unsafe-expression.output @@ -41,11 +41,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - function_declaration - name_node: identifier "doWork" - body: block "func doWork() {}" - unsupported_node "unsafe doWork()" + function_declaration source="⟨body⟩⟨name_node⟩" + name_node: identifier "doWork" source="doWork" + body: block "func doWork() {}" source="func doWork() {}" + unsupported_node "unsafe doWork()" source="unsafe doWork()" diff --git a/unified/extractor/tests/corpus/swift/functions/call-with-inout-argument.output b/unified/extractor/tests/corpus/swift/functions/call-with-inout-argument.output index 13e99e707a86..6899013425de 100644 --- a/unified/extractor/tests/corpus/swift/functions/call-with-inout-argument.output +++ b/unified/extractor/tests/corpus/swift/functions/call-with-inout-argument.output @@ -69,22 +69,22 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩\n⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "var" - pattern: identifier "a" - value: int_literal "1" - variable_declaration - modifier: modifier "var" - pattern: identifier "b" - value: int_literal "2" - call_expr - callee: identifier "swap" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "var" source="var" + pattern: identifier "a" source="a" + value: int_literal "1" source="1" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "var" source="var" + pattern: identifier "b" source="b" + value: int_literal "2" source="2" + call_expr source="⟨callee⟩(⟨argument⟩ ⟨argument⟩)" + callee: identifier "swap" source="swap" argument: - argument - value: unsupported_node "&a" - argument - value: unsupported_node "&b" + argument source="⟨value⟩," + value: unsupported_node "&a" source="&a" + argument source="⟨value⟩" + value: unsupported_node "&b" source="&b" diff --git a/unified/extractor/tests/corpus/swift/functions/constructor-call-with-type-arguments.output b/unified/extractor/tests/corpus/swift/functions/constructor-call-with-type-arguments.output index baf959c0cc86..3ef240f3dfe5 100644 --- a/unified/extractor/tests/corpus/swift/functions/constructor-call-with-type-arguments.output +++ b/unified/extractor/tests/corpus/swift/functions/constructor-call-with-type-arguments.output @@ -76,25 +76,25 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩\n⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Foo" - class_like_declaration - modifier: modifier "class" - name_node: identifier "C" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {}" + modifier: modifier "class" source="class" + name_node: identifier "Foo" source="Foo" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩<⟨type_parameter⟩> {}" + modifier: modifier "class" source="class" + name_node: identifier "C" source="C" type_parameter: - type_parameter - name_node: identifier "T" - variable_declaration - modifier: modifier "let" - pattern: identifier "x" + type_parameter source="⟨name_node⟩" + name_node: identifier "T" source="T" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" value: - call_expr + call_expr source="⟨callee⟩()" callee: - generic_type_expr - base: identifier "C" - type_argument: identifier "Foo" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "C" source="C" + type_argument: identifier "Foo" source="Foo" diff --git a/unified/extractor/tests/corpus/swift/functions/function-call-with-labelled-arguments.output b/unified/extractor/tests/corpus/swift/functions/function-call-with-labelled-arguments.output index 81c2af30295d..48de52d425d8 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-call-with-labelled-arguments.output +++ b/unified/extractor/tests/corpus/swift/functions/function-call-with-labelled-arguments.output @@ -28,13 +28,13 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - call_expr - callee: identifier "greet" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "greet" source="greet" argument: - argument - name_node: identifier "person" - value: string_literal "\"Bob\"" + argument source="⟨name_node⟩: ⟨value⟩" + name_node: identifier "person" source="person" + value: string_literal "\"Bob\"" source="\"Bob\"" diff --git a/unified/extractor/tests/corpus/swift/functions/function-call.output b/unified/extractor/tests/corpus/swift/functions/function-call.output index 35cac76d7bd1..6f25208b0189 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-call.output +++ b/unified/extractor/tests/corpus/swift/functions/function-call.output @@ -27,14 +27,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - call_expr - callee: identifier "foo" + call_expr source="⟨callee⟩(⟨argument⟩ ⟨argument⟩)" + callee: identifier "foo" source="foo" argument: - argument - value: int_literal "1" - argument - value: int_literal "2" + argument source="⟨value⟩," + value: int_literal "1" source="1" + argument source="⟨value⟩" + value: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/functions/function-with-default-parameter-value.output b/unified/extractor/tests/corpus/swift/functions/function-with-default-parameter-value.output index 3d4c6483cb50..65da7fc5c00f 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-with-default-parameter-value.output +++ b/unified/extractor/tests/corpus/swift/functions/function-with-default-parameter-value.output @@ -61,22 +61,22 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "greet" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩" + name_node: identifier "greet" source="greet" parameter: - parameter - type: identifier "String" - pattern: identifier "name" - default: string_literal "\"world\"" + parameter source="⟨pattern⟩: ⟨type⟩ = ⟨default⟩" + type: identifier "String" source="String" + pattern: identifier "name" source="name" + default: string_literal "\"world\"" source="\"world\"" body: - block + block source="func greet(name: String = \"world\") {\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "name" + argument source="⟨value⟩" + value: identifier "name" source="name" diff --git a/unified/extractor/tests/corpus/swift/functions/function-with-inout-parameter.output b/unified/extractor/tests/corpus/swift/functions/function-with-inout-parameter.output index 83e3c7a53c2d..54133b022968 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-with-inout-parameter.output +++ b/unified/extractor/tests/corpus/swift/functions/function-with-inout-parameter.output @@ -57,21 +57,21 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "increment" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩" + name_node: identifier "increment" source="increment" parameter: - parameter - external_name_node: identifier "_" - type: unsupported_node "inout Int" - pattern: identifier "x" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: unsupported_node "inout Int" source="inout Int" + pattern: identifier "x" source="x" body: - block + block source="func increment(_ x: inout Int) {\n ⟨stmt⟩\n}" stmt: - binary_expr - left: identifier "x" - operator: infix_operator "+=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "+=" source="+=" + right: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/functions/function-with-named-parameters.output b/unified/extractor/tests/corpus/swift/functions/function-with-named-parameters.output index 6ad2a386ae8e..96d34925e8e7 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-with-named-parameters.output +++ b/unified/extractor/tests/corpus/swift/functions/function-with-named-parameters.output @@ -52,22 +52,22 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "greet" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩" + name_node: identifier "greet" source="greet" parameter: - parameter - external_name_node: identifier "person" - type: identifier "String" - pattern: identifier "name" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "person" source="person" + type: identifier "String" source="String" + pattern: identifier "name" source="name" body: - block + block source="func greet(person name: String) {\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "name" + argument source="⟨value⟩" + value: identifier "name" source="name" diff --git a/unified/extractor/tests/corpus/swift/functions/function-with-no-parameters.output b/unified/extractor/tests/corpus/swift/functions/function-with-no-parameters.output index 39c0b67786e2..901624c3b423 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-with-no-parameters.output +++ b/unified/extractor/tests/corpus/swift/functions/function-with-no-parameters.output @@ -47,17 +47,17 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "greet" + function_declaration source="⟨body⟩⟨name_node⟩" + name_node: identifier "greet" source="greet" body: - block + block source="func greet() {\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"hello\"" + argument source="⟨value⟩" + value: string_literal "\"hello\"" source="\"hello\"" diff --git a/unified/extractor/tests/corpus/swift/functions/function-with-parameters-and-return-type.output b/unified/extractor/tests/corpus/swift/functions/function-with-parameters-and-return-type.output index 88311a0596e7..1c200d26c675 100644 --- a/unified/extractor/tests/corpus/swift/functions/function-with-parameters-and-return-type.output +++ b/unified/extractor/tests/corpus/swift/functions/function-with-parameters-and-return-type.output @@ -69,28 +69,28 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "add" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩⟨parameter⟩⟨return_type⟩" + name_node: identifier "add" source="add" parameter: - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "a" - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "b" - return_type: identifier "Int" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "a" source="a" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "b" source="b" + return_type: identifier "Int" source="Int" body: - block + block source="func add(_ a: Int, _ b: Int) -> Int {\n ⟨stmt⟩\n}" stmt: - return_expr + return_expr source="return ⟨value⟩" value: - binary_expr - left: identifier "a" - operator: infix_operator "+" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "+" source="+" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/functions/generic-function.output b/unified/extractor/tests/corpus/swift/functions/generic-function.output index 646ee6196166..280996f96f32 100644 --- a/unified/extractor/tests/corpus/swift/functions/generic-function.output +++ b/unified/extractor/tests/corpus/swift/functions/generic-function.output @@ -59,23 +59,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "identity" + function_declaration source="⟨body⟩⟨name_node⟩⟨type_parameter⟩⟨parameter⟩⟨return_type⟩" + name_node: identifier "identity" source="identity" type_parameter: - type_parameter - name_node: identifier "T" + type_parameter source="⟨name_node⟩" + name_node: identifier "T" source="T" parameter: - parameter - external_name_node: identifier "_" - type: identifier "T" - pattern: identifier "x" - return_type: identifier "T" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: identifier "T" source="T" + pattern: identifier "x" source="x" + return_type: identifier "T" source="T" body: - block + block source="func identity(_ x: T) -> T {\n ⟨stmt⟩\n}" stmt: - return_expr - value: identifier "x" + return_expr source="return ⟨value⟩" + value: identifier "x" source="x" diff --git a/unified/extractor/tests/corpus/swift/functions/generic-type-alias.output b/unified/extractor/tests/corpus/swift/functions/generic-type-alias.output index 459aec5b784c..5f06367b306b 100644 --- a/unified/extractor/tests/corpus/swift/functions/generic-type-alias.output +++ b/unified/extractor/tests/corpus/swift/functions/generic-type-alias.output @@ -51,21 +51,21 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - type_alias_declaration - name_node: identifier "Box" + type_alias_declaration source="typealias ⟨name_node⟩<⟨type_parameter⟩ ⟨type_parameter⟩> = ⟨type⟩" + name_node: identifier "Box" source="Box" type_parameter: - type_parameter - name_node: identifier "T" - bound: identifier "Equatable" - type_parameter - name_node: identifier "U" + type_parameter source="⟨name_node⟩: ⟨bound⟩," + name_node: identifier "T" source="T" + bound: identifier "Equatable" source="Equatable" + type_parameter source="⟨name_node⟩" + name_node: identifier "U" source="U" type: - generic_type_expr - base: identifier "Dictionary" + generic_type_expr source="⟨base⟩<⟨type_argument⟩, ⟨type_argument⟩>" + base: identifier "Dictionary" source="Dictionary" type_argument: - identifier "T" - identifier "U" + identifier "T" source="T" + identifier "U" source="U" diff --git a/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-call.output b/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-call.output index 5cb220bbb681..3335f2ba054b 100644 --- a/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-call.output +++ b/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-call.output @@ -38,19 +38,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "y" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "y" source="y" value: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "some" source="some" argument: - argument - value: int_literal "1" + argument source="⟨value⟩" + value: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-value.output b/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-value.output index 1c2eab54b2ef..233ba6d5c1a7 100644 --- a/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-value.output +++ b/unified/extractor/tests/corpus/swift/functions/leading-dot-expression-value.output @@ -28,14 +28,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" value: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "foo" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "foo" source="foo" diff --git a/unified/extractor/tests/corpus/swift/functions/method-call.output b/unified/extractor/tests/corpus/swift/functions/method-call.output index 52a36238c2d5..62c9506ef630 100644 --- a/unified/extractor/tests/corpus/swift/functions/method-call.output +++ b/unified/extractor/tests/corpus/swift/functions/method-call.output @@ -28,15 +28,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: identifier "list" - member_name_node: identifier "append" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "list" source="list" + member_name_node: identifier "append" source="append" argument: - argument - value: int_literal "1" + argument source="⟨value⟩" + value: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/functions/nested-function-type.output b/unified/extractor/tests/corpus/swift/functions/nested-function-type.output index b14135c1065c..d78d47dbbbb4 100644 --- a/unified/extractor/tests/corpus/swift/functions/nested-function-type.output +++ b/unified/extractor/tests/corpus/swift/functions/nested-function-type.output @@ -100,41 +100,41 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n\n⟨stmt⟩" stmt: - type_alias_declaration - name_node: identifier "NestedFunction" + type_alias_declaration source="typealias ⟨name_node⟩ = ⟨type⟩" + name_node: identifier "NestedFunction" source="NestedFunction" type: - function_expr + function_expr source="(⟨parameter⟩) -> ⟨return_type⟩" parameter: - parameter + parameter source="⟨type⟩" type: - function_expr + function_expr source="(⟨parameter⟩) -> ⟨return_type⟩" parameter: - parameter - type: identifier "Int" - return_type: identifier "Bool" - return_type: identifier "Bool" - type_alias_declaration - name_node: identifier "MixedParametersAndTuples" + parameter source="⟨type⟩" + type: identifier "Int" source="Int" + return_type: identifier "Bool" source="Bool" + return_type: identifier "Bool" source="Bool" + type_alias_declaration source="typealias ⟨name_node⟩ = ⟨type⟩" + name_node: identifier "MixedParametersAndTuples" source="MixedParametersAndTuples" type: - function_expr + function_expr source="(⟨parameter⟩ ⟨parameter⟩) -> ⟨return_type⟩" parameter: - parameter + parameter source="⟨type⟩," type: - function_expr + function_expr source="(⟨parameter⟩) -> ⟨return_type⟩" parameter: - parameter - type: identifier "Int" - return_type: identifier "Bool" - parameter - type: identifier "String" + parameter source="⟨type⟩" + type: identifier "Int" source="Int" + return_type: identifier "Bool" source="Bool" + parameter source="⟨type⟩" + type: identifier "String" source="String" return_type: - tuple_expr + tuple_expr source="(⟨element⟩ ⟨element⟩)" element: - argument - value: identifier "Bool" - argument - value: identifier "Int" + argument source="⟨value⟩," + value: identifier "Bool" source="Bool" + argument source="⟨value⟩" + value: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus/swift/functions/variadic-function.output b/unified/extractor/tests/corpus/swift/functions/variadic-function.output index 79384b19b20f..0f73aabfd8cd 100644 --- a/unified/extractor/tests/corpus/swift/functions/variadic-function.output +++ b/unified/extractor/tests/corpus/swift/functions/variadic-function.output @@ -73,30 +73,30 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "sum" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩⟨return_type⟩" + name_node: identifier "sum" source="sum" parameter: - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "values" - return_type: identifier "Int" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩..." + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "values" source="values" + return_type: identifier "Int" source="Int" body: - block + block source="func sum(_ values: Int...) -> Int {\n ⟨stmt⟩\n}" stmt: - return_expr + return_expr source="return ⟨value⟩" value: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩ ⟨argument⟩)" callee: - member_access_expr - base: identifier "values" - member_name_node: identifier "reduce" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "values" source="values" + member_name_node: identifier "reduce" source="reduce" argument: - argument - value: int_literal "0" - argument - value: identifier "+" + argument source="⟨value⟩," + value: int_literal "0" source="0" + argument source="⟨value⟩" + value: identifier "+" source="+" diff --git a/unified/extractor/tests/corpus/swift/literals/boolean-literals.output b/unified/extractor/tests/corpus/swift/literals/boolean-literals.output index 34b394712a35..53e784af9d5a 100644 --- a/unified/extractor/tests/corpus/swift/literals/boolean-literals.output +++ b/unified/extractor/tests/corpus/swift/literals/boolean-literals.output @@ -17,9 +17,9 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - boolean_literal "true" - boolean_literal "false" + boolean_literal "true" source="true" + boolean_literal "false" source="false" diff --git a/unified/extractor/tests/corpus/swift/literals/floating-point-literal.output b/unified/extractor/tests/corpus/swift/literals/floating-point-literal.output index 19fa40aac776..879eb5b3f020 100644 --- a/unified/extractor/tests/corpus/swift/literals/floating-point-literal.output +++ b/unified/extractor/tests/corpus/swift/literals/floating-point-literal.output @@ -12,7 +12,7 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block - stmt: float_literal "3.14" + block source="⟨stmt⟩" + stmt: float_literal "3.14" source="3.14" diff --git a/unified/extractor/tests/corpus/swift/literals/integer-literal.output b/unified/extractor/tests/corpus/swift/literals/integer-literal.output index 9df79925753c..9e86858d7bdf 100644 --- a/unified/extractor/tests/corpus/swift/literals/integer-literal.output +++ b/unified/extractor/tests/corpus/swift/literals/integer-literal.output @@ -12,7 +12,7 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block - stmt: int_literal "42" + block source="⟨stmt⟩" + stmt: int_literal "42" source="42" diff --git a/unified/extractor/tests/corpus/swift/literals/line-magic-literal.output b/unified/extractor/tests/corpus/swift/literals/line-magic-literal.output index 291ab41d8fe4..bfb9b2e09eac 100644 --- a/unified/extractor/tests/corpus/swift/literals/line-magic-literal.output +++ b/unified/extractor/tests/corpus/swift/literals/line-magic-literal.output @@ -28,11 +28,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "currentLine" - value: unsupported_node "#line" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "currentLine" source="currentLine" + value: unsupported_node "#line" source="#line" diff --git a/unified/extractor/tests/corpus/swift/literals/negative-integer-literal.output b/unified/extractor/tests/corpus/swift/literals/negative-integer-literal.output index 907944054782..99c94b78bf86 100644 --- a/unified/extractor/tests/corpus/swift/literals/negative-integer-literal.output +++ b/unified/extractor/tests/corpus/swift/literals/negative-integer-literal.output @@ -15,10 +15,10 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - unary_expr - operand: int_literal "7" - operator: prefix_operator "-" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: int_literal "7" source="7" + operator: prefix_operator "-" source="-" diff --git a/unified/extractor/tests/corpus/swift/literals/nil-literal.output b/unified/extractor/tests/corpus/swift/literals/nil-literal.output index c7da232131fd..a81d5a2fd1e1 100644 --- a/unified/extractor/tests/corpus/swift/literals/nil-literal.output +++ b/unified/extractor/tests/corpus/swift/literals/nil-literal.output @@ -12,7 +12,7 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block - stmt: builtin_expr "nil" + block source="⟨stmt⟩" + stmt: builtin_expr "nil" source="nil" diff --git a/unified/extractor/tests/corpus/swift/literals/string-literal.output b/unified/extractor/tests/corpus/swift/literals/string-literal.output index 8d3ea8e796c0..f24e74608866 100644 --- a/unified/extractor/tests/corpus/swift/literals/string-literal.output +++ b/unified/extractor/tests/corpus/swift/literals/string-literal.output @@ -16,7 +16,7 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block - stmt: string_literal "\"hello\"" + block source="⟨stmt⟩" + stmt: string_literal "\"hello\"" source="\"hello\"" diff --git a/unified/extractor/tests/corpus/swift/literals/string-with-interpolation.output b/unified/extractor/tests/corpus/swift/literals/string-with-interpolation.output index 4d8a2706c66e..6e02c0f92968 100644 --- a/unified/extractor/tests/corpus/swift/literals/string-with-interpolation.output +++ b/unified/extractor/tests/corpus/swift/literals/string-with-interpolation.output @@ -221,100 +221,100 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n\n// Multiple interpolations\n⟨stmt⟩\n\n// Interpolation with expression\n⟨stmt⟩\n\n// Plain string before and after interpolation\n⟨stmt⟩\n\n// Calls to custom DefaultStringInterpolation.appendInterpolation impls\n⟨stmt⟩\n⟨stmt⟩\n⟨stmt⟩\n⟨stmt⟩" stmt: - string_interpolation_expr + string_interpolation_expr source="\"⟨element⟩⟨element⟩\"" element: - string_literal "hello " - call_expr - callee: builtin_expr "interpolation" + string_literal "hello " source="hello " + call_expr source="⟨callee⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(name)" argument: - argument - value: identifier "name" - string_literal - string_interpolation_expr + argument source="⟨value⟩" + value: identifier "name" source="name" + string_literal source="" + string_interpolation_expr source="\"⟨element⟩⟨element⟩⟨element⟩⟨element⟩\"" element: - string_literal "hello " - call_expr - callee: builtin_expr "interpolation" + string_literal "hello " source="hello " + call_expr source="⟨callee⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(first)" argument: - argument - value: identifier "first" - string_literal " " - call_expr - callee: builtin_expr "interpolation" + argument source="⟨value⟩" + value: identifier "first" source="first" + string_literal " " source=" " + call_expr source="⟨callee⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(last)" argument: - argument - value: identifier "last" - string_literal - string_interpolation_expr + argument source="⟨value⟩" + value: identifier "last" source="last" + string_literal source="" + string_interpolation_expr source="\"⟨element⟩⟨element⟩\"" element: - string_literal "result: " - call_expr - callee: builtin_expr "interpolation" + string_literal "result: " source="result: " + call_expr source="⟨callee⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(x + y)" argument: - argument + argument source="⟨value⟩" value: - binary_expr - left: identifier "x" - operator: infix_operator "+" - right: identifier "y" - string_literal - string_interpolation_expr + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "+" source="+" + right: identifier "y" source="y" + string_literal source="" + string_interpolation_expr source="\"⟨element⟩⟨element⟩⟨element⟩\"" element: - string_literal "prefix " - call_expr - callee: builtin_expr "interpolation" + string_literal "prefix " source="prefix " + call_expr source="⟨callee⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(value)" argument: - argument - value: identifier "value" - string_literal " suffix" - string_interpolation_expr + argument source="⟨value⟩" + value: identifier "value" source="value" + string_literal " suffix" source=" suffix" + string_interpolation_expr source="\"⟨element⟩⟨element⟩\"" element: - string_literal "foo " - call_expr - callee: builtin_expr "interpolation" + string_literal "foo " source="foo " + call_expr source="⟨callee⟩⟨argument⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(x, y)" argument: - argument - value: identifier "x" - argument - value: identifier "y" - string_literal - string_interpolation_expr + argument source="⟨value⟩," + value: identifier "x" source="x" + argument source="⟨value⟩" + value: identifier "y" source="y" + string_literal source="" + string_interpolation_expr source="\"⟨element⟩⟨element⟩\"" element: - string_literal "foo " - call_expr - callee: builtin_expr "interpolation" + string_literal "foo " source="foo " + call_expr source="⟨callee⟩⟨argument⟩⟨argument⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(x, y, z)" argument: - argument - value: identifier "x" - argument - value: identifier "y" - argument - value: identifier "z" - string_literal - string_interpolation_expr + argument source="⟨value⟩," + value: identifier "x" source="x" + argument source="⟨value⟩," + value: identifier "y" source="y" + argument source="⟨value⟩" + value: identifier "z" source="z" + string_literal source="" + string_interpolation_expr source="\"⟨element⟩⟨element⟩\"" element: - string_literal "foo " - call_expr - callee: builtin_expr "interpolation" + string_literal "foo " source="foo " + call_expr source="⟨callee⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(arg: x)" argument: - argument - name_node: identifier "arg" - value: identifier "x" - string_literal - string_interpolation_expr + argument source="⟨name_node⟩: ⟨value⟩" + name_node: identifier "arg" source="arg" + value: identifier "x" source="x" + string_literal source="" + string_interpolation_expr source="\"⟨element⟩⟨element⟩\"" element: - string_literal "foo " - call_expr - callee: builtin_expr "interpolation" + string_literal "foo " source="foo " + call_expr source="⟨callee⟩⟨argument⟩⟨argument⟩" + callee: builtin_expr "interpolation" source="\\(arg: x, arg2: y)" argument: - argument - name_node: identifier "arg" - value: identifier "x" - argument - name_node: identifier "arg2" - value: identifier "y" - string_literal + argument source="⟨name_node⟩: ⟨value⟩," + name_node: identifier "arg" source="arg" + value: identifier "x" source="x" + argument source="⟨name_node⟩: ⟨value⟩" + name_node: identifier "arg2" source="arg2" + value: identifier "y" source="y" + string_literal source="" diff --git a/unified/extractor/tests/corpus/swift/loops/break-and-continue.output b/unified/extractor/tests/corpus/swift/loops/break-and-continue.output index 4143f2a5b99b..c24ef267ec62 100644 --- a/unified/extractor/tests/corpus/swift/loops/break-and-continue.output +++ b/unified/extractor/tests/corpus/swift/loops/break-and-continue.output @@ -98,36 +98,36 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - for_each_stmt - pattern: identifier "x" - iterable: identifier "xs" + for_each_stmt source="for ⟨pattern⟩ in ⟨iterable⟩ ⟨body⟩" + pattern: identifier "x" source="x" + iterable: identifier "xs" source="xs" body: - block + block source="{\n ⟨stmt⟩\n ⟨stmt⟩\n ⟨stmt⟩\n}" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator "<" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "<" source="<" + right: int_literal "0" source="0" then: - block - stmt: continue_expr "continue" - if_expr + block source="{ ⟨stmt⟩ }" + stmt: continue_expr "continue" source="continue" + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "100" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "100" source="100" then: - block - stmt: break_expr "break" - call_expr - callee: identifier "print" + block source="{ ⟨stmt⟩ }" + stmt: break_expr "break" source="break" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "x" + argument source="⟨value⟩" + value: identifier "x" source="x" diff --git a/unified/extractor/tests/corpus/swift/loops/for-in-over-array-literal.output b/unified/extractor/tests/corpus/swift/loops/for-in-over-array-literal.output index 3eb9c22f53a7..4d927aad290c 100644 --- a/unified/extractor/tests/corpus/swift/loops/for-in-over-array-literal.output +++ b/unified/extractor/tests/corpus/swift/loops/for-in-over-array-literal.output @@ -56,23 +56,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - for_each_stmt - pattern: identifier "x" + for_each_stmt source="for ⟨pattern⟩ in ⟨iterable⟩ ⟨body⟩" + pattern: identifier "x" source="x" iterable: - array_literal + array_literal source="[⟨element⟩, ⟨element⟩, ⟨element⟩]" element: - int_literal "1" - int_literal "2" - int_literal "3" + int_literal "1" source="1" + int_literal "2" source="2" + int_literal "3" source="3" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "x" + argument source="⟨value⟩" + value: identifier "x" source="x" diff --git a/unified/extractor/tests/corpus/swift/loops/for-in-over-range.output b/unified/extractor/tests/corpus/swift/loops/for-in-over-range.output index 2dd2f67df8b2..856aaf792846 100644 --- a/unified/extractor/tests/corpus/swift/loops/for-in-over-range.output +++ b/unified/extractor/tests/corpus/swift/loops/for-in-over-range.output @@ -48,22 +48,22 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - for_each_stmt - pattern: identifier "i" + for_each_stmt source="for ⟨pattern⟩ in ⟨iterable⟩ ⟨body⟩" + pattern: identifier "i" source="i" iterable: - binary_expr - left: int_literal "0" - operator: infix_operator "..<" - right: int_literal "10" + binary_expr source="⟨left⟩⟨operator⟩⟨right⟩" + left: int_literal "0" source="0" + operator: infix_operator "..<" source="..<" + right: int_literal "10" source="10" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "i" + argument source="⟨value⟩" + value: identifier "i" source="i" diff --git a/unified/extractor/tests/corpus/swift/loops/for-in-with-where-clause.output b/unified/extractor/tests/corpus/swift/loops/for-in-with-where-clause.output index febf7450e2d1..412fc6b3672c 100644 --- a/unified/extractor/tests/corpus/swift/loops/for-in-with-where-clause.output +++ b/unified/extractor/tests/corpus/swift/loops/for-in-with-where-clause.output @@ -54,23 +54,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - for_each_stmt - pattern: identifier "x" - iterable: identifier "xs" + for_each_stmt source="for ⟨pattern⟩ in ⟨iterable⟩ where ⟨guard⟩ ⟨body⟩" + pattern: identifier "x" source="x" + iterable: identifier "xs" source="xs" guard: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "x" + argument source="⟨value⟩" + value: identifier "x" source="x" diff --git a/unified/extractor/tests/corpus/swift/loops/repeat-while-loop.output b/unified/extractor/tests/corpus/swift/loops/repeat-while-loop.output index 6287bbaa9bfc..53e4be6b6e5a 100644 --- a/unified/extractor/tests/corpus/swift/loops/repeat-while-loop.output +++ b/unified/extractor/tests/corpus/swift/loops/repeat-while-loop.output @@ -43,20 +43,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - do_while_stmt + do_while_stmt source="repeat ⟨body⟩ while ⟨condition⟩" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - binary_expr - left: identifier "x" - operator: infix_operator "-=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "-=" source="-=" + right: int_literal "1" source="1" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" diff --git a/unified/extractor/tests/corpus/swift/loops/while-loop.output b/unified/extractor/tests/corpus/swift/loops/while-loop.output index f4f64cfca6bc..e9e6d67c3bb5 100644 --- a/unified/extractor/tests/corpus/swift/loops/while-loop.output +++ b/unified/extractor/tests/corpus/swift/loops/while-loop.output @@ -44,20 +44,20 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - while_stmt + while_stmt source="while ⟨condition⟩ ⟨body⟩" condition: - binary_expr - left: identifier "x" - operator: infix_operator ">" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator ">" source=">" + right: int_literal "0" source="0" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - binary_expr - left: identifier "x" - operator: infix_operator "-=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "-=" source="-=" + right: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/operators/addition.output b/unified/extractor/tests/corpus/swift/operators/addition.output index d7607c50c10c..20e75d76b371 100644 --- a/unified/extractor/tests/corpus/swift/operators/addition.output +++ b/unified/extractor/tests/corpus/swift/operators/addition.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "+" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "+" source="+" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/comparison.output b/unified/extractor/tests/corpus/swift/operators/comparison.output index 98d11f401bc8..01e9bc0d8de1 100644 --- a/unified/extractor/tests/corpus/swift/operators/comparison.output +++ b/unified/extractor/tests/corpus/swift/operators/comparison.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "<" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "<" source="<" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/custom-postfix-operator.output b/unified/extractor/tests/corpus/swift/operators/custom-postfix-operator.output index df8ad5e47745..cc73dce357e5 100644 --- a/unified/extractor/tests/corpus/swift/operators/custom-postfix-operator.output +++ b/unified/extractor/tests/corpus/swift/operators/custom-postfix-operator.output @@ -35,12 +35,12 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n⟨stmt⟩" stmt: - unsupported_node "postfix operator ^^" - variable_declaration - modifier: modifier "let" - pattern: identifier "squared" - value: unsupported_node "3^^" + unsupported_node "postfix operator ^^" source="postfix operator ^^" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "squared" source="squared" + value: unsupported_node "3^^" source="3^^" diff --git a/unified/extractor/tests/corpus/swift/operators/division.output b/unified/extractor/tests/corpus/swift/operators/division.output index 306a3639b3e1..5400b45146f1 100644 --- a/unified/extractor/tests/corpus/swift/operators/division.output +++ b/unified/extractor/tests/corpus/swift/operators/division.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "/" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "/" source="/" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/equality.output b/unified/extractor/tests/corpus/swift/operators/equality.output index 7280d13ff1aa..a6f92fa7471e 100644 --- a/unified/extractor/tests/corpus/swift/operators/equality.output +++ b/unified/extractor/tests/corpus/swift/operators/equality.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "==" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "==" source="==" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/logical-and.output b/unified/extractor/tests/corpus/swift/operators/logical-and.output index 102b83ec6ed4..1b652d920be4 100644 --- a/unified/extractor/tests/corpus/swift/operators/logical-and.output +++ b/unified/extractor/tests/corpus/swift/operators/logical-and.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "&&" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "&&" source="&&" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/logical-not.output b/unified/extractor/tests/corpus/swift/operators/logical-not.output index 03476b41def3..278667af8241 100644 --- a/unified/extractor/tests/corpus/swift/operators/logical-not.output +++ b/unified/extractor/tests/corpus/swift/operators/logical-not.output @@ -15,10 +15,10 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - unary_expr - operand: identifier "a" - operator: prefix_operator "!" + unary_expr source="⟨operator⟩⟨operand⟩" + operand: identifier "a" source="a" + operator: prefix_operator "!" source="!" diff --git a/unified/extractor/tests/corpus/swift/operators/logical-or.output b/unified/extractor/tests/corpus/swift/operators/logical-or.output index 8a447d8bb9fd..a6762a959794 100644 --- a/unified/extractor/tests/corpus/swift/operators/logical-or.output +++ b/unified/extractor/tests/corpus/swift/operators/logical-or.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "||" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "||" source="||" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/multiplication.output b/unified/extractor/tests/corpus/swift/operators/multiplication.output index 0313287d9431..b8fd88cf5299 100644 --- a/unified/extractor/tests/corpus/swift/operators/multiplication.output +++ b/unified/extractor/tests/corpus/swift/operators/multiplication.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "*" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "*" source="*" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/operator-precedence-addition-and-multiplication.output b/unified/extractor/tests/corpus/swift/operators/operator-precedence-addition-and-multiplication.output index abbc1c6d5782..955797c45114 100644 --- a/unified/extractor/tests/corpus/swift/operators/operator-precedence-addition-and-multiplication.output +++ b/unified/extractor/tests/corpus/swift/operators/operator-precedence-addition-and-multiplication.output @@ -28,15 +28,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "+" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "+" source="+" right: - binary_expr - left: identifier "b" - operator: infix_operator "*" - right: identifier "c" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "b" source="b" + operator: infix_operator "*" source="*" + right: identifier "c" source="c" diff --git a/unified/extractor/tests/corpus/swift/operators/parenthesised-expression.output b/unified/extractor/tests/corpus/swift/operators/parenthesised-expression.output index 33bb1599ff1a..d5d1b99069e6 100644 --- a/unified/extractor/tests/corpus/swift/operators/parenthesised-expression.output +++ b/unified/extractor/tests/corpus/swift/operators/parenthesised-expression.output @@ -34,15 +34,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr + binary_expr source="(⟨left⟩) ⟨operator⟩ ⟨right⟩" left: - binary_expr - left: identifier "a" - operator: infix_operator "+" - right: identifier "b" - operator: infix_operator "*" - right: identifier "c" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "+" source="+" + right: identifier "b" source="b" + operator: infix_operator "*" source="*" + right: identifier "c" source="c" diff --git a/unified/extractor/tests/corpus/swift/operators/partial-range-from.output b/unified/extractor/tests/corpus/swift/operators/partial-range-from.output index 6b0a834494ec..90faee91bd75 100644 --- a/unified/extractor/tests/corpus/swift/operators/partial-range-from.output +++ b/unified/extractor/tests/corpus/swift/operators/partial-range-from.output @@ -28,11 +28,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "range" - value: unsupported_node "3..." + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "range" source="range" + value: unsupported_node "3..." source="3..." diff --git a/unified/extractor/tests/corpus/swift/operators/range-operator.output b/unified/extractor/tests/corpus/swift/operators/range-operator.output index 55ed3ab971a7..ab5aff23c30f 100644 --- a/unified/extractor/tests/corpus/swift/operators/range-operator.output +++ b/unified/extractor/tests/corpus/swift/operators/range-operator.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: int_literal "1" - operator: infix_operator "..." - right: int_literal "10" + binary_expr source="⟨left⟩⟨operator⟩⟨right⟩" + left: int_literal "1" source="1" + operator: infix_operator "..." source="..." + right: int_literal "10" source="10" diff --git a/unified/extractor/tests/corpus/swift/operators/subtraction.output b/unified/extractor/tests/corpus/swift/operators/subtraction.output index 63b4662fb575..210d25065f8c 100644 --- a/unified/extractor/tests/corpus/swift/operators/subtraction.output +++ b/unified/extractor/tests/corpus/swift/operators/subtraction.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "a" - operator: infix_operator "-" - right: identifier "b" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "a" source="a" + operator: infix_operator "-" source="-" + right: identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-casts.output b/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-casts.output index d78fb757a8d9..0cdfd8b9d43b 100644 --- a/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-casts.output +++ b/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-casts.output @@ -89,39 +89,39 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "casts" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩⟨parameter⟩" + name_node: identifier "casts" source="casts" parameter: - parameter - external_name_node: identifier "_" - type: identifier "Any" - pattern: identifier "a" - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "b" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "_" source="_" + type: identifier "Any" source="Any" + pattern: identifier "a" source="a" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "b" source="b" body: - block + block source="func casts(_ a: Any, _ b: Int) {\n ⟨stmt⟩\n ⟨stmt⟩\n}" stmt: - unresolved_operator_sequence + unresolved_operator_sequence source="⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩" element: - identifier "_" - infix_operator "=" - identifier "a" - infix_operator "as" - unsupported_node "Int" - infix_operator ".&" - identifier "b" - unresolved_operator_sequence + identifier "_" source="_" + infix_operator "=" source="=" + identifier "a" source="a" + infix_operator "as" source="as" + unsupported_node "Int" source="Int" + infix_operator ".&" source=".&" + identifier "b" source="b" + unresolved_operator_sequence source="⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩" element: - identifier "_" - infix_operator "=" - identifier "a" - infix_operator "is" - unsupported_node "Int" - infix_operator ".&" - identifier "b" + identifier "_" source="_" + infix_operator "=" source="=" + identifier "a" source="a" + infix_operator "is" source="is" + unsupported_node "Int" source="Int" + infix_operator ".&" source=".&" + identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-ternary.output b/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-ternary.output index 80e0f7285631..f0b2c64b9d91 100644 --- a/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-ternary.output +++ b/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-ternary.output @@ -95,41 +95,41 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "choose" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩⟨parameter⟩⟨parameter⟩⟨parameter⟩⟨return_type⟩" + name_node: identifier "choose" source="choose" parameter: - parameter - external_name_node: identifier "_" - type: identifier "Bool" - pattern: identifier "c" - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "a" - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "b" - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "d" - return_type: identifier "Int" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "_" source="_" + type: identifier "Bool" source="Bool" + pattern: identifier "c" source="c" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "a" source="a" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "b" source="b" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "d" source="d" + return_type: identifier "Int" source="Int" body: - block + block source="func choose(_ c: Bool, _ a: Int, _ b: Int, _ d: Int) -> Int {\n ⟨stmt⟩\n}" stmt: - return_expr + return_expr source="return ⟨value⟩" value: - unresolved_operator_sequence + unresolved_operator_sequence source="⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩" element: - identifier "c" - infix_operator "?" - identifier "a" - infix_operator ":" - identifier "b" - infix_operator ".&" - identifier "d" + identifier "c" source="c" + infix_operator "?" source="?" + identifier "a" source="a" + infix_operator ":" source=":" + identifier "b" source="b" + infix_operator ".&" source=".&" + identifier "d" source="d" diff --git a/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence.output b/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence.output index ae2da42f2d43..2ed6779f4c89 100644 --- a/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence.output +++ b/unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence.output @@ -62,28 +62,28 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "combine" + function_declaration source="⟨body⟩⟨name_node⟩⟨parameter⟩⟨parameter⟩" + name_node: identifier "combine" source="combine" parameter: - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "a" - parameter - external_name_node: identifier "_" - type: identifier "Int" - pattern: identifier "b" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "a" source="a" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "_" source="_" + type: identifier "Int" source="Int" + pattern: identifier "b" source="b" body: - block + block source="func combine(_ a: Int, _ b: Int) {\n ⟨stmt⟩\n}" stmt: - unresolved_operator_sequence + unresolved_operator_sequence source="⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩ ⟨element⟩" element: - identifier "_" - infix_operator "=" - identifier "a" - infix_operator ".&" - identifier "b" + identifier "_" source="_" + infix_operator "=" source="=" + identifier "a" source="a" + infix_operator ".&" source=".&" + identifier "b" source="b" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/catch-where-clauses.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/catch-where-clauses.output index 3a603e8f504c..c1937aca8255 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/catch-where-clauses.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/catch-where-clauses.output @@ -136,60 +136,60 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - try_expr + try_expr source="do ⟨body⟩ ⟨catch_clause⟩ ⟨catch_clause⟩" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - unary_expr + unary_expr source="⟨operator⟩⟨operand⟩" operand: - call_expr - callee: identifier "foo" - operator: prefix_operator "try" + call_expr source="⟨callee⟩()" + callee: identifier "foo" source="foo" + operator: prefix_operator "try" source="try foo()" catch_clause: - catch_clause + catch_clause source="⟨pattern⟩⟨body⟩" pattern: - or_pattern + or_pattern source="catch ⟨pattern⟩ ⟨pattern⟩ {\n print(\"retry\")\n}" pattern: - conditional_pattern + conditional_pattern source="⟨pattern⟩ where ⟨condition⟩," condition: - call_expr - callee: identifier "isNetworkError" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "isNetworkError" source="isNetworkError" argument: - argument - value: identifier "e" + argument source="⟨value⟩" + value: identifier "e" source="e" pattern: - expr_pattern - modifier: modifier "let" - expr: identifier "e" - conditional_pattern + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "e" source="e" + conditional_pattern source="⟨pattern⟩ where ⟨condition⟩" condition: - call_expr - callee: identifier "isTimeout" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "isTimeout" source="isTimeout" argument: - argument - value: identifier "f" + argument source="⟨value⟩" + value: identifier "f" source="f" pattern: - expr_pattern - modifier: modifier "let" - expr: identifier "f" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "f" source="f" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"retry\"" - catch_clause + argument source="⟨value⟩" + value: string_literal "\"retry\"" source="\"retry\"" + catch_clause source="catch ⟨body⟩" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: string_literal "\"fallback\"" + argument source="⟨value⟩" + value: string_literal "\"fallback\"" source="\"fallback\"" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/do-catch.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/do-catch.output index 8db6319fd778..0c5009e02fc3 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/do-catch.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/do-catch.output @@ -57,26 +57,26 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - try_expr + try_expr source="do ⟨body⟩ ⟨catch_clause⟩" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - unary_expr + unary_expr source="⟨operator⟩⟨operand⟩" operand: - call_expr - callee: identifier "foo" - operator: prefix_operator "try" + call_expr source="⟨callee⟩()" + callee: identifier "foo" source="foo" + operator: prefix_operator "try" source="try foo()" catch_clause: - catch_clause + catch_clause source="catch ⟨body⟩" body: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "error" + argument source="⟨value⟩" + value: identifier "error" source="error" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/force-unwrap.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/force-unwrap.output index c977adaaa3f3..4d8b84743253 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/force-unwrap.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/force-unwrap.output @@ -28,14 +28,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "n" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "n" source="n" value: - unary_expr - operand: identifier "opt" - operator: postfix_operator "!" + unary_expr source="⟨operand⟩⟨operator⟩" + operand: identifier "opt" source="opt" + operator: postfix_operator "!" source="opt!" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/nil-coalescing.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/nil-coalescing.output index c8b6a85d6203..5a35a80306a5 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/nil-coalescing.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/nil-coalescing.output @@ -33,15 +33,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "n" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "n" source="n" value: - binary_expr - left: identifier "opt" - operator: infix_operator "??" - right: int_literal "0" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "opt" source="opt" + operator: infix_operator "??" source="??" + right: int_literal "0" source="0" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-chaining.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-chaining.output index 42b65ed696b0..2fb5be96bc8f 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-chaining.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-chaining.output @@ -43,17 +43,17 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "n" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "n" source="n" value: - member_access_expr + member_access_expr source="⟨base⟩?.⟨member_name_node⟩" base: - member_access_expr - base: identifier "obj" - member_name_node: identifier "foo" - member_name_node: identifier "bar" + member_access_expr source="⟨base⟩?.⟨member_name_node⟩" + base: identifier "obj" source="obj" + member_name_node: identifier "foo" source="foo" + member_name_node: identifier "bar" source="bar" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-enum-case-binding.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-enum-case-binding.output index 05223133226b..739fcb48ec29 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-enum-case-binding.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-enum-case-binding.output @@ -72,39 +72,39 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - if_expr + if_expr source="if ⟨condition⟩ ⟨then⟩" condition: - pattern_guard_expr + pattern_guard_expr source="case ⟨pattern⟩ = ⟨value⟩" pattern: - call_expr + call_expr source="⟨argument⟩⟨callee⟩" callee: - member_access_expr - base: identifier "Optional" - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: identifier "Optional" source=".some(let value)?" + member_name_node: identifier "some" source=".some(let value)?" argument: - argument + argument source="⟨value⟩?" value: - call_expr + call_expr source="⟨callee⟩(⟨argument⟩)" callee: - member_access_expr - base: inferred_type_expr "." - member_name_node: identifier "some" + member_access_expr source="⟨base⟩⟨member_name_node⟩" + base: inferred_type_expr "." source="." + member_name_node: identifier "some" source="some" argument: - argument + argument source="⟨value⟩" value: - expr_pattern - modifier: modifier "let" - expr: identifier "value" - value: identifier "input" + expr_pattern source="⟨modifier⟩ ⟨expr⟩" + modifier: modifier "let" source="let" + expr: identifier "value" source="value" + value: identifier "input" source="input" then: - block + block source="{\n ⟨stmt⟩\n}" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "value" + argument source="⟨value⟩" + value: identifier "value" source="value" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-type-annotation.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-type-annotation.output index dd73c9899745..6860e38d7a3a 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-type-annotation.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/optional-type-annotation.output @@ -34,15 +34,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" type: - generic_type_expr - base: identifier "Optional" - type_argument: identifier "Int" - value: builtin_expr "nil" + generic_type_expr source="⟨type_argument⟩⟨base⟩" + base: identifier "Optional" source="Int?" + type_argument: identifier "Int" source="Int" + value: builtin_expr "nil" source="nil" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/throwing-function.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/throwing-function.output index 7915e7ee92f8..5be898e21651 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/throwing-function.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/throwing-function.output @@ -51,15 +51,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - function_declaration - name_node: identifier "read" - return_type: identifier "String" + function_declaration source="⟨body⟩⟨name_node⟩⟨return_type⟩" + name_node: identifier "read" source="read" + return_type: identifier "String" source="String" body: - block + block source="func read() throws -> String {\n ⟨stmt⟩\n}" stmt: - return_expr - value: string_literal "\"\"" + return_expr source="return ⟨value⟩" + value: string_literal "\"\"" source="\"\"" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression-2.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression-2.output index faacc2583539..4faa3545ea5c 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression-2.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression-2.output @@ -35,16 +35,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "result" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "result" source="result" value: - unary_expr + unary_expr source="⟨operator⟩⟨operand⟩" operand: - call_expr - callee: identifier "foo" - operator: prefix_operator "try!" + call_expr source="⟨callee⟩()" + callee: identifier "foo" source="foo" + operator: prefix_operator "try!" source="try! foo()" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression.output b/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression.output index a5e07f561208..57464ed82141 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression.output +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors/try-expression.output @@ -35,16 +35,16 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "result" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "result" source="result" value: - unary_expr + unary_expr source="⟨operator⟩⟨operand⟩" operand: - call_expr - callee: identifier "foo" - operator: prefix_operator "try?" + call_expr source="⟨callee⟩()" + callee: identifier "foo" source="foo" + operator: prefix_operator "try?" source="try? foo()" diff --git a/unified/extractor/tests/corpus/swift/types/actor-declaration.output b/unified/extractor/tests/corpus/swift/types/actor-declaration.output index b4fcd605b9e9..89d549b0e749 100644 --- a/unified/extractor/tests/corpus/swift/types/actor-declaration.output +++ b/unified/extractor/tests/corpus/swift/types/actor-declaration.output @@ -39,7 +39,7 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block - stmt: unsupported_node "actor Counter {\n var value = 0\n}" + block source="⟨stmt⟩" + stmt: unsupported_node "actor Counter {\n var value = 0\n}" source="actor Counter {\n var value = 0\n}" diff --git a/unified/extractor/tests/corpus/swift/types/binding-modifier-does-not-leak-into-accessor-body.output b/unified/extractor/tests/corpus/swift/types/binding-modifier-does-not-leak-into-accessor-body.output index 0c839689dce0..6a02642ced38 100644 --- a/unified/extractor/tests/corpus/swift/types/binding-modifier-does-not-leak-into-accessor-body.output +++ b/unified/extractor/tests/corpus/swift/types/binding-modifier-does-not-leak-into-accessor-body.output @@ -92,31 +92,31 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n}" stmt: - accessor_declaration - modifier: modifier "var" - name_node: identifier "p" - accessor_kind: accessor_kind "get" - type: identifier "Int" + accessor_declaration source="⟨modifier⟩ ⟨name_node⟩: ⟨type⟩ {\n ⟨accessor_kind⟩ ⟨body⟩" + modifier: modifier "var" source="var" + name_node: identifier "p" source="p" + accessor_kind: accessor_kind "get" source="get" + type: identifier "Int" source="Int" body: - block + block source="{\n ⟨stmt⟩\n }" stmt: - switch_expr - value: identifier "y" + switch_expr source="switch ⟨value⟩ {\n ⟨case⟩\n ⟨case⟩\n }" + value: identifier "y" source="y" case: - switch_case - pattern: identifier "someConstant" + switch_case source="⟨body⟩⟨pattern⟩" + pattern: identifier "someConstant" source="someConstant" body: - block + block source="case someConstant:\n ⟨stmt⟩" stmt: - return_expr - value: int_literal "1" - switch_case + return_expr source="return ⟨value⟩" + value: int_literal "1" source="1" + switch_case source="⟨body⟩" body: - block + block source="default:\n ⟨stmt⟩" stmt: - return_expr - value: int_literal "2" + return_expr source="return ⟨value⟩" + value: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/types/class-function.output b/unified/extractor/tests/corpus/swift/types/class-function.output index ed00913dafde..a3084367cea1 100644 --- a/unified/extractor/tests/corpus/swift/types/class-function.output +++ b/unified/extractor/tests/corpus/swift/types/class-function.output @@ -43,15 +43,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Factory" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "Factory" source="Factory" member: - function_declaration - modifier: modifier "class" - name_node: identifier "make" - body: block "class func make() {}" + function_declaration source="⟨modifier⟩⟨body⟩⟨name_node⟩" + modifier: modifier "class" source="class" + name_node: identifier "make" source="make" + body: block "class func make() {}" source="class func make() {}" diff --git a/unified/extractor/tests/corpus/swift/types/class-inheritance.output b/unified/extractor/tests/corpus/swift/types/class-inheritance.output index 28af5a0f7086..28a35c0906ff 100644 --- a/unified/extractor/tests/corpus/swift/types/class-inheritance.output +++ b/unified/extractor/tests/corpus/swift/types/class-inheritance.output @@ -28,13 +28,13 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Dog" + class_like_declaration source="⟨modifier⟩⟨base_type⟩⟨name_node⟩" + modifier: modifier "class" source="class" + name_node: identifier "Dog" source="Dog" base_type: - base_type - type: identifier "Animal" + base_type source="class Dog: ⟨type⟩ {}" + type: identifier "Animal" source="Animal" diff --git a/unified/extractor/tests/corpus/swift/types/class-with-initializer.output b/unified/extractor/tests/corpus/swift/types/class-with-initializer.output index cd9e3c1eb9ad..f5e85a979d67 100644 --- a/unified/extractor/tests/corpus/swift/types/class-with-initializer.output +++ b/unified/extractor/tests/corpus/swift/types/class-with-initializer.output @@ -86,30 +86,30 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Point" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "Point" source="Point" member: - variable_declaration - modifier: modifier "var" - pattern: identifier "x" - type: identifier "Int" - constructor_declaration + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "var" source="var" + pattern: identifier "x" source="x" + type: identifier "Int" source="Int" + constructor_declaration source="⟨body⟩⟨parameter⟩" parameter: - parameter - type: identifier "Int" - pattern: identifier "x" + parameter source="⟨pattern⟩: ⟨type⟩" + type: identifier "Int" source="Int" + pattern: identifier "x" source="x" body: - block + block source="init(x: Int) {\n ⟨stmt⟩\n }" stmt: - binary_expr + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" left: - member_access_expr - base: identifier "self" - member_name_node: identifier "x" - operator: infix_operator "=" - right: identifier "x" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "self" source="self" + member_name_node: identifier "x" source="x" + operator: infix_operator "=" source="=" + right: identifier "x" source="x" diff --git a/unified/extractor/tests/corpus/swift/types/class-with-method.output b/unified/extractor/tests/corpus/swift/types/class-with-method.output index 2cc184038255..64981979359d 100644 --- a/unified/extractor/tests/corpus/swift/types/class-with-method.output +++ b/unified/extractor/tests/corpus/swift/types/class-with-method.output @@ -73,24 +73,24 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Counter" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "Counter" source="Counter" member: - variable_declaration - modifier: modifier "var" - pattern: identifier "n" - value: int_literal "0" - function_declaration - name_node: identifier "bump" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "var" source="var" + pattern: identifier "n" source="n" + value: int_literal "0" source="0" + function_declaration source="⟨body⟩⟨name_node⟩" + name_node: identifier "bump" source="bump" body: - block + block source="func bump() {\n ⟨stmt⟩\n }" stmt: - binary_expr - left: identifier "n" - operator: infix_operator "+=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "n" source="n" + operator: infix_operator "+=" source="+=" + right: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/types/class-with-multiple-base-types.output b/unified/extractor/tests/corpus/swift/types/class-with-multiple-base-types.output index f6c87accee27..f2a839add74c 100644 --- a/unified/extractor/tests/corpus/swift/types/class-with-multiple-base-types.output +++ b/unified/extractor/tests/corpus/swift/types/class-with-multiple-base-types.output @@ -33,15 +33,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Button" + class_like_declaration source="⟨modifier⟩⟨base_type⟩⟨base_type⟩⟨name_node⟩" + modifier: modifier "class" source="class" + name_node: identifier "Button" source="Button" base_type: - base_type - type: identifier "Control" - base_type - type: identifier "Drawable" + base_type source="class Button: ⟨type⟩, Drawable {}" + type: identifier "Control" source="Control" + base_type source="class Button: Control, ⟨type⟩ {}" + type: identifier "Drawable" source="Drawable" diff --git a/unified/extractor/tests/corpus/swift/types/class-with-stored-properties.output b/unified/extractor/tests/corpus/swift/types/class-with-stored-properties.output index a2eea59d3e87..37ea4f114076 100644 --- a/unified/extractor/tests/corpus/swift/types/class-with-stored-properties.output +++ b/unified/extractor/tests/corpus/swift/types/class-with-stored-properties.output @@ -57,19 +57,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Point" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "Point" source="Point" member: - variable_declaration - modifier: modifier "var" - pattern: identifier "x" - type: identifier "Int" - variable_declaration - modifier: modifier "var" - pattern: identifier "y" - type: identifier "Int" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "var" source="var" + pattern: identifier "x" source="x" + type: identifier "Int" source="Int" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "var" source="var" + pattern: identifier "y" source="y" + type: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus/swift/types/computed-property.output b/unified/extractor/tests/corpus/swift/types/computed-property.output index ab7c072ae40d..b4021e9dfdbb 100644 --- a/unified/extractor/tests/corpus/swift/types/computed-property.output +++ b/unified/extractor/tests/corpus/swift/types/computed-property.output @@ -97,33 +97,33 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Rect" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩\n ⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "Rect" source="Rect" member: - variable_declaration - modifier: modifier "var" - pattern: identifier "w" - type: identifier "Double" - variable_declaration - modifier: modifier "var" - pattern: identifier "h" - type: identifier "Double" - accessor_declaration - modifier: modifier "var" - name_node: identifier "area" - accessor_kind: accessor_kind "get" - type: identifier "Double" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "var" source="var" + pattern: identifier "w" source="w" + type: identifier "Double" source="Double" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "var" source="var" + pattern: identifier "h" source="h" + type: identifier "Double" source="Double" + accessor_declaration source="⟨modifier⟩⟨accessor_kind⟩⟨body⟩⟨name_node⟩⟨type⟩" + modifier: modifier "var" source="var" + name_node: identifier "area" source="area" + accessor_kind: accessor_kind "get" source="var area: Double {\n return w * h\n }" + type: identifier "Double" source="Double" body: - block + block source="var area: Double {\n ⟨stmt⟩\n }" stmt: - return_expr + return_expr source="return ⟨value⟩" value: - binary_expr - left: identifier "w" - operator: infix_operator "*" - right: identifier "h" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "w" source="w" + operator: infix_operator "*" source="*" + right: identifier "h" source="h" diff --git a/unified/extractor/tests/corpus/swift/types/conditional-compilation-in-class-body.output b/unified/extractor/tests/corpus/swift/types/conditional-compilation-in-class-body.output index b184e9b33ea1..79154b5c70d0 100644 --- a/unified/extractor/tests/corpus/swift/types/conditional-compilation-in-class-body.output +++ b/unified/extractor/tests/corpus/swift/types/conditional-compilation-in-class-body.output @@ -77,11 +77,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "C" - member: unsupported_node "#if DEBUG\n init(x: Int) {}\n deinit {}\n#endif" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "C" source="C" + member: unsupported_node "#if DEBUG\n init(x: Int) {}\n deinit {}\n#endif" source="#if DEBUG\n init(x: Int) {}\n deinit {}\n#endif" diff --git a/unified/extractor/tests/corpus/swift/types/constructor-with-parameters.output b/unified/extractor/tests/corpus/swift/types/constructor-with-parameters.output index d594e9c48df4..72d8952ea356 100644 --- a/unified/extractor/tests/corpus/swift/types/constructor-with-parameters.output +++ b/unified/extractor/tests/corpus/swift/types/constructor-with-parameters.output @@ -59,22 +59,22 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "Size" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n}" + modifier: modifier "struct" source="struct" + name_node: identifier "Size" source="Size" member: - constructor_declaration + constructor_declaration source="⟨body⟩⟨parameter⟩⟨parameter⟩" parameter: - parameter - external_name_node: identifier "width" - type: identifier "Int" - pattern: identifier "w" - parameter - external_name_node: identifier "height" - type: identifier "Int" - pattern: identifier "h" - body: block "init(width w: Int, height h: Int) {}" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩," + external_name_node: identifier "width" source="width" + type: identifier "Int" source="Int" + pattern: identifier "w" source="w" + parameter source="⟨external_name_node⟩ ⟨pattern⟩: ⟨type⟩" + external_name_node: identifier "height" source="height" + type: identifier "Int" source="Int" + pattern: identifier "h" source="h" + body: block "init(width w: Int, height h: Int) {}" source="init(width w: Int, height h: Int) {}" diff --git a/unified/extractor/tests/corpus/swift/types/empty-class.output b/unified/extractor/tests/corpus/swift/types/empty-class.output index 27bb4b5e67cd..9ea1e0d72f9c 100644 --- a/unified/extractor/tests/corpus/swift/types/empty-class.output +++ b/unified/extractor/tests/corpus/swift/types/empty-class.output @@ -20,10 +20,10 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Foo" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {}" + modifier: modifier "class" source="class" + name_node: identifier "Foo" source="Foo" diff --git a/unified/extractor/tests/corpus/swift/types/enum-with-associated-values.output b/unified/extractor/tests/corpus/swift/types/enum-with-associated-values.output index 6e4bf71fe920..ef7a079eabf9 100644 --- a/unified/extractor/tests/corpus/swift/types/enum-with-associated-values.output +++ b/unified/extractor/tests/corpus/swift/types/enum-with-associated-values.output @@ -65,31 +65,31 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "enum" - name_node: identifier "Shape" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n case ⟨member⟩\n case ⟨member⟩\n}" + modifier: modifier "enum" source="enum" + name_node: identifier "Shape" source="Shape" member: - class_like_declaration - modifier: modifier "enum_case" - name_node: identifier "circle" + class_like_declaration source="⟨name_node⟩⟨member⟩⟨modifier⟩" + modifier: modifier "enum_case" source="circle(radius: Double)" + name_node: identifier "circle" source="circle" member: - constructor_declaration + constructor_declaration source="⟨body⟩⟨parameter⟩" parameter: - parameter - type: identifier "Double" - pattern: identifier "radius" - body: block "circle(radius: Double)" - class_like_declaration - modifier: modifier "enum_case" - name_node: identifier "square" + parameter source="⟨pattern⟩: ⟨type⟩" + type: identifier "Double" source="Double" + pattern: identifier "radius" source="radius" + body: block "circle(radius: Double)" source="circle(radius: Double)" + class_like_declaration source="⟨name_node⟩⟨member⟩⟨modifier⟩" + modifier: modifier "enum_case" source="square(side: Double)" + name_node: identifier "square" source="square" member: - constructor_declaration + constructor_declaration source="⟨body⟩⟨parameter⟩" parameter: - parameter - type: identifier "Double" - pattern: identifier "side" - body: block "square(side: Double)" + parameter source="⟨pattern⟩: ⟨type⟩" + type: identifier "Double" source="Double" + pattern: identifier "side" source="side" + body: block "square(side: Double)" source="square(side: Double)" diff --git a/unified/extractor/tests/corpus/swift/types/enum-with-cases.output b/unified/extractor/tests/corpus/swift/types/enum-with-cases.output index 7c9184a774b3..a66dc1f2d7c0 100644 --- a/unified/extractor/tests/corpus/swift/types/enum-with-cases.output +++ b/unified/extractor/tests/corpus/swift/types/enum-with-cases.output @@ -61,23 +61,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "enum" - name_node: identifier "Direction" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n case ⟨member⟩\n case ⟨member⟩\n case ⟨member⟩\n case ⟨member⟩\n}" + modifier: modifier "enum" source="enum" + name_node: identifier "Direction" source="Direction" member: - variable_declaration - modifier: modifier "enum_case" - pattern: identifier "north" - variable_declaration - modifier: modifier "enum_case" - pattern: identifier "south" - variable_declaration - modifier: modifier "enum_case" - pattern: identifier "east" - variable_declaration - modifier: modifier "enum_case" - pattern: identifier "west" + variable_declaration source="⟨modifier⟩⟨pattern⟩" + modifier: modifier "enum_case" source="north" + pattern: identifier "north" source="north" + variable_declaration source="⟨modifier⟩⟨pattern⟩" + modifier: modifier "enum_case" source="south" + pattern: identifier "south" source="south" + variable_declaration source="⟨modifier⟩⟨pattern⟩" + modifier: modifier "enum_case" source="east" + pattern: identifier "east" source="east" + variable_declaration source="⟨modifier⟩⟨pattern⟩" + modifier: modifier "enum_case" source="west" + pattern: identifier "west" source="west" diff --git a/unified/extractor/tests/corpus/swift/types/enum-with-comma-separated-cases-chained-declaration.output b/unified/extractor/tests/corpus/swift/types/enum-with-comma-separated-cases-chained-declaration.output index 87b81b333d2f..97945a6cc910 100644 --- a/unified/extractor/tests/corpus/swift/types/enum-with-comma-separated-cases-chained-declaration.output +++ b/unified/extractor/tests/corpus/swift/types/enum-with-comma-separated-cases-chained-declaration.output @@ -40,29 +40,29 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "enum" - name_node: identifier "Suit" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n case ⟨member⟩ ⟨member⟩ ⟨member⟩ ⟨member⟩\n}" + modifier: modifier "enum" source="enum" + name_node: identifier "Suit" source="Suit" member: - variable_declaration - modifier: modifier "enum_case" - pattern: identifier "clubs" - variable_declaration + variable_declaration source="⟨pattern⟩⟨modifier⟩" + modifier: modifier "enum_case" source="clubs," + pattern: identifier "clubs" source="clubs" + variable_declaration source="⟨pattern⟩⟨modifier⟩⟨modifier⟩" modifier: - modifier "chained_declaration" - modifier "enum_case" - pattern: identifier "diamonds" - variable_declaration + modifier "chained_declaration" source="diamonds," + modifier "enum_case" source="diamonds," + pattern: identifier "diamonds" source="diamonds" + variable_declaration source="⟨pattern⟩⟨modifier⟩⟨modifier⟩" modifier: - modifier "chained_declaration" - modifier "enum_case" - pattern: identifier "hearts" - variable_declaration + modifier "chained_declaration" source="hearts," + modifier "enum_case" source="hearts," + pattern: identifier "hearts" source="hearts" + variable_declaration source="⟨modifier⟩⟨modifier⟩⟨pattern⟩" modifier: - modifier "chained_declaration" - modifier "enum_case" - pattern: identifier "spades" + modifier "chained_declaration" source="spades" + modifier "enum_case" source="spades" + pattern: identifier "spades" source="spades" diff --git a/unified/extractor/tests/corpus/swift/types/extension.output b/unified/extractor/tests/corpus/swift/types/extension.output index 76dedcdcd909..0ab670eb5cfd 100644 --- a/unified/extractor/tests/corpus/swift/types/extension.output +++ b/unified/extractor/tests/corpus/swift/types/extension.output @@ -64,23 +64,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "extension" - extension_target: identifier "Int" + class_like_declaration source="⟨modifier⟩ ⟨extension_target⟩ {\n ⟨member⟩\n}" + modifier: modifier "extension" source="extension" + extension_target: identifier "Int" source="Int" member: - function_declaration - name_node: identifier "squared" - return_type: identifier "Int" + function_declaration source="⟨body⟩⟨name_node⟩⟨return_type⟩" + name_node: identifier "squared" source="squared" + return_type: identifier "Int" source="Int" body: - block + block source="func squared() -> Int { ⟨stmt⟩ }" stmt: - return_expr + return_expr source="return ⟨value⟩" value: - binary_expr - left: identifier "self" - operator: infix_operator "*" - right: identifier "self" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "self" source="self" + operator: infix_operator "*" source="*" + right: identifier "self" source="self" diff --git a/unified/extractor/tests/corpus/swift/types/function-type-with-convention-attribute.output b/unified/extractor/tests/corpus/swift/types/function-type-with-convention-attribute.output index 1522ef79c8a4..e26e022261f4 100644 --- a/unified/extractor/tests/corpus/swift/types/function-type-with-convention-attribute.output +++ b/unified/extractor/tests/corpus/swift/types/function-type-with-convention-attribute.output @@ -58,14 +58,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "callback" - type: unsupported_node "@convention(c) () -> Void" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "callback" source="callback" + type: unsupported_node "@convention(c) () -> Void" source="@convention(c) () -> Void" value: - function_expr - body: block "{}" + function_expr source="⟨body⟩" + body: block "{}" source="{}" diff --git a/unified/extractor/tests/corpus/swift/types/function-type-with-sendable-attribute.output b/unified/extractor/tests/corpus/swift/types/function-type-with-sendable-attribute.output index 8478fad42c7e..3d4a80ebea18 100644 --- a/unified/extractor/tests/corpus/swift/types/function-type-with-sendable-attribute.output +++ b/unified/extractor/tests/corpus/swift/types/function-type-with-sendable-attribute.output @@ -51,14 +51,14 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "handler" - type: unsupported_node "@Sendable () -> Void" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "handler" source="handler" + type: unsupported_node "@Sendable () -> Void" source="@Sendable () -> Void" value: - function_expr - body: block "{}" + function_expr source="⟨body⟩" + body: block "{}" source="{}" diff --git a/unified/extractor/tests/corpus/swift/types/generic-class-parameters-and-constraints.output b/unified/extractor/tests/corpus/swift/types/generic-class-parameters-and-constraints.output index 92b1713cebad..8e057dfae084 100644 --- a/unified/extractor/tests/corpus/swift/types/generic-class-parameters-and-constraints.output +++ b/unified/extractor/tests/corpus/swift/types/generic-class-parameters-and-constraints.output @@ -62,23 +62,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Box" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩<⟨type_parameter⟩ ⟨type_parameter⟩> where ⟨type_constraint⟩ ⟨type_constraint⟩ {\n}" + modifier: modifier "class" source="class" + name_node: identifier "Box" source="Box" type_parameter: - type_parameter - name_node: identifier "T" - bound: identifier "Equatable" - type_parameter - name_node: identifier "U" + type_parameter source="⟨name_node⟩: ⟨bound⟩," + name_node: identifier "T" source="T" + bound: identifier "Equatable" source="Equatable" + type_parameter source="⟨name_node⟩" + name_node: identifier "U" source="U" type_constraint: - bound_type_constraint - type: identifier "U" - bound: identifier "Equatable" - equality_type_constraint - left: identifier "U" - right: identifier "T" + bound_type_constraint source="⟨type⟩: ⟨bound⟩," + type: identifier "U" source="U" + bound: identifier "Equatable" source="Equatable" + equality_type_constraint source="⟨left⟩ == ⟨right⟩" + left: identifier "U" source="U" + right: identifier "T" source="T" diff --git a/unified/extractor/tests/corpus/swift/types/generic-type-arguments.output b/unified/extractor/tests/corpus/swift/types/generic-type-arguments.output index 17cdddf083fb..402ec3f8b780 100644 --- a/unified/extractor/tests/corpus/swift/types/generic-type-arguments.output +++ b/unified/extractor/tests/corpus/swift/types/generic-type-arguments.output @@ -56,19 +56,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "cache" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "cache" source="cache" type: - generic_type_expr - base: identifier "Dictionary" + generic_type_expr source="⟨base⟩<⟨type_argument⟩, ⟨type_argument⟩>" + base: identifier "Dictionary" source="Dictionary" type_argument: - identifier "String" - generic_type_expr - base: identifier "Array" - type_argument: identifier "Int" - value: map_literal "[:]" + identifier "String" source="String" + generic_type_expr source="⟨base⟩<⟨type_argument⟩>" + base: identifier "Array" source="Array" + type_argument: identifier "Int" source="Int" + value: map_literal "[:]" source="[:]" diff --git a/unified/extractor/tests/corpus/swift/types/inline-array-type.output b/unified/extractor/tests/corpus/swift/types/inline-array-type.output index 0be81cb39306..39657ec20345 100644 --- a/unified/extractor/tests/corpus/swift/types/inline-array-type.output +++ b/unified/extractor/tests/corpus/swift/types/inline-array-type.output @@ -59,17 +59,17 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "triple" - type: unsupported_node "[3 of Int]" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "triple" source="triple" + type: unsupported_node "[3 of Int]" source="[3 of Int]" value: - array_literal + array_literal source="[⟨element⟩, ⟨element⟩, ⟨element⟩]" element: - int_literal "1" - int_literal "2" - int_literal "3" + int_literal "1" source="1" + int_literal "2" source="2" + int_literal "3" source="3" diff --git a/unified/extractor/tests/corpus/swift/types/noncopyable-type.output b/unified/extractor/tests/corpus/swift/types/noncopyable-type.output index 970d21683f6e..0a22d1ca0b07 100644 --- a/unified/extractor/tests/corpus/swift/types/noncopyable-type.output +++ b/unified/extractor/tests/corpus/swift/types/noncopyable-type.output @@ -50,18 +50,18 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "FileHandle" + class_like_declaration source="⟨modifier⟩⟨base_type⟩⟨name_node⟩⟨member⟩" + modifier: modifier "struct" source="struct" + name_node: identifier "FileHandle" source="FileHandle" base_type: - base_type - type: unsupported_node "~Copyable" + base_type source="struct FileHandle: ⟨type⟩ {\n let descriptor: Int\n}" + type: unsupported_node "~Copyable" source="~Copyable" member: - variable_declaration - modifier: modifier "let" - pattern: identifier "descriptor" - type: identifier "Int" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "let" source="let" + pattern: identifier "descriptor" source="descriptor" + type: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus/swift/types/property-with-getter-and-setter.output b/unified/extractor/tests/corpus/swift/types/property-with-getter-and-setter.output index a37b28985e6b..f84cf98e24c4 100644 --- a/unified/extractor/tests/corpus/swift/types/property-with-getter-and-setter.output +++ b/unified/extractor/tests/corpus/swift/types/property-with-getter-and-setter.output @@ -102,41 +102,41 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Box" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩⟨member⟩\n }\n}" + modifier: modifier "class" source="class" + name_node: identifier "Box" source="Box" member: - variable_declaration + variable_declaration source="⟨modifier⟩ ⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" modifier: - modifier "var" - modifier "private" - pattern: identifier "_v" - value: int_literal "0" - accessor_declaration - modifier: modifier "var" - name_node: identifier "v" - accessor_kind: accessor_kind "get" - type: identifier "Int" + modifier "var" source="var" + modifier "private" source="private" + pattern: identifier "_v" source="_v" + value: int_literal "0" source="0" + accessor_declaration source="⟨modifier⟩ ⟨name_node⟩: ⟨type⟩ {\n ⟨accessor_kind⟩ ⟨body⟩" + modifier: modifier "var" source="var" + name_node: identifier "v" source="v" + accessor_kind: accessor_kind "get" source="get" + type: identifier "Int" source="Int" body: - block + block source="{ ⟨stmt⟩ }" stmt: - return_expr - value: identifier "_v" - accessor_declaration + return_expr source="return ⟨value⟩" + value: identifier "_v" source="_v" + accessor_declaration source="⟨modifier⟩ ⟨name_node⟩: ⟨type⟩ {\n get { return _v }\n ⟨accessor_kind⟩⟨modifier⟩⟨body⟩" modifier: - modifier "var" - modifier "chained_declaration" - name_node: identifier "v" - accessor_kind: accessor_kind "set" - type: identifier "Int" + modifier "var" source="var" + modifier "chained_declaration" source="set { _v = newValue }" + name_node: identifier "v" source="v" + accessor_kind: accessor_kind "set" source="set" + type: identifier "Int" source="Int" body: - block + block source="{ ⟨stmt⟩ }" stmt: - binary_expr - left: identifier "_v" - operator: infix_operator "=" - right: identifier "newValue" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "_v" source="_v" + operator: infix_operator "=" source="=" + right: identifier "newValue" source="newValue" diff --git a/unified/extractor/tests/corpus/swift/types/protocol-declaration.output b/unified/extractor/tests/corpus/swift/types/protocol-declaration.output index dacfae76cb34..b2bc4b1e1867 100644 --- a/unified/extractor/tests/corpus/swift/types/protocol-declaration.output +++ b/unified/extractor/tests/corpus/swift/types/protocol-declaration.output @@ -53,18 +53,18 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "protocol" - name_node: identifier "Drawable" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩\n}" + modifier: modifier "protocol" source="protocol" + name_node: identifier "Drawable" source="Drawable" member: - function_declaration - name_node: identifier "draw" - body: block "func draw()" - function_declaration - modifier: modifier "static" - name_node: identifier "make" - body: block "static func make()" + function_declaration source="⟨body⟩⟨name_node⟩" + name_node: identifier "draw" source="draw" + body: block "func draw()" source="func draw()" + function_declaration source="⟨modifier⟩⟨body⟩⟨name_node⟩" + modifier: modifier "static" source="static" + name_node: identifier "make" source="make" + body: block "static func make()" source="static func make()" diff --git a/unified/extractor/tests/corpus/swift/types/protocol-with-read-only-and-read-write-property-requirements.output b/unified/extractor/tests/corpus/swift/types/protocol-with-read-only-and-read-write-property-requirements.output index 37e084520a18..0a3277df185c 100644 --- a/unified/extractor/tests/corpus/swift/types/protocol-with-read-only-and-read-write-property-requirements.output +++ b/unified/extractor/tests/corpus/swift/types/protocol-with-read-only-and-read-write-property-requirements.output @@ -102,28 +102,28 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "protocol" - name_node: identifier "P" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n var ⟨member⟩ }\n var ⟨member⟩⟨member⟩ }\n var ⟨member⟩ }\n}" + modifier: modifier "protocol" source="protocol" + name_node: identifier "P" source="P" member: - accessor_declaration - name_node: identifier "foo" - accessor_kind: accessor_kind "get" - type: identifier "Int" - accessor_declaration - name_node: identifier "bar" - accessor_kind: accessor_kind "get" - type: identifier "String" - accessor_declaration - modifier: modifier "chained_declaration" - name_node: identifier "bar" - accessor_kind: accessor_kind "set" - type: identifier "String" - accessor_declaration - name_node: identifier "count" - accessor_kind: accessor_kind "get" - type: identifier "Int" + accessor_declaration source="⟨name_node⟩: ⟨type⟩ { ⟨accessor_kind⟩" + name_node: identifier "foo" source="foo" + accessor_kind: accessor_kind "get" source="get" + type: identifier "Int" source="Int" + accessor_declaration source="⟨name_node⟩: ⟨type⟩ { ⟨accessor_kind⟩" + name_node: identifier "bar" source="bar" + accessor_kind: accessor_kind "get" source="get" + type: identifier "String" source="String" + accessor_declaration source="⟨name_node⟩: ⟨type⟩ { get ⟨accessor_kind⟩⟨modifier⟩" + modifier: modifier "chained_declaration" source="set" + name_node: identifier "bar" source="bar" + accessor_kind: accessor_kind "set" source="set" + type: identifier "String" source="String" + accessor_declaration source="⟨name_node⟩: ⟨type⟩ { ⟨accessor_kind⟩" + name_node: identifier "count" source="count" + accessor_kind: accessor_kind "get" source="get" + type: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus/swift/types/qualified-type.output b/unified/extractor/tests/corpus/swift/types/qualified-type.output index 4512e9e6c54d..df148ed33316 100644 --- a/unified/extractor/tests/corpus/swift/types/qualified-type.output +++ b/unified/extractor/tests/corpus/swift/types/qualified-type.output @@ -97,35 +97,35 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩\n\n⟨stmt⟩\n⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "Outer" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n}" + modifier: modifier "struct" source="struct" + name_node: identifier "Outer" source="Outer" member: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "Inner" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n }" + modifier: modifier "struct" source="struct" + name_node: identifier "Inner" source="Inner" member: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "Deep" - variable_declaration - modifier: modifier "let" - pattern: identifier "value" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {}" + modifier: modifier "struct" source="struct" + name_node: identifier "Deep" source="Deep" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "let" source="let" + pattern: identifier "value" source="value" type: - member_access_expr - base: identifier "Outer" - member_name_node: identifier "Inner" - variable_declaration - modifier: modifier "let" - pattern: identifier "nested" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "Outer" source="Outer" + member_name_node: identifier "Inner" source="Inner" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "let" source="let" + pattern: identifier "nested" source="nested" type: - member_access_expr + member_access_expr source="⟨base⟩.⟨member_name_node⟩" base: - member_access_expr - base: identifier "Outer" - member_name_node: identifier "Inner" - member_name_node: identifier "Deep" + member_access_expr source="⟨base⟩.⟨member_name_node⟩" + base: identifier "Outer" source="Outer" + member_name_node: identifier "Inner" source="Inner" + member_name_node: identifier "Deep" source="Deep" diff --git a/unified/extractor/tests/corpus/swift/types/static-function.output b/unified/extractor/tests/corpus/swift/types/static-function.output index f610765a02eb..b7f87ab13d76 100644 --- a/unified/extractor/tests/corpus/swift/types/static-function.output +++ b/unified/extractor/tests/corpus/swift/types/static-function.output @@ -43,15 +43,15 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "Factory" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "Factory" source="Factory" member: - function_declaration - modifier: modifier "static" - name_node: identifier "make" - body: block "static func make() {}" + function_declaration source="⟨modifier⟩⟨body⟩⟨name_node⟩" + modifier: modifier "static" source="static" + name_node: identifier "make" source="make" + body: block "static func make() {}" source="static func make() {}" diff --git a/unified/extractor/tests/corpus/swift/types/struct.output b/unified/extractor/tests/corpus/swift/types/struct.output index 133a2935acd7..06bfef904314 100644 --- a/unified/extractor/tests/corpus/swift/types/struct.output +++ b/unified/extractor/tests/corpus/swift/types/struct.output @@ -57,19 +57,19 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "struct" - name_node: identifier "Point" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n ⟨member⟩\n}" + modifier: modifier "struct" source="struct" + name_node: identifier "Point" source="Point" member: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" - type: identifier "Int" - variable_declaration - modifier: modifier "let" - pattern: identifier "y" - type: identifier "Int" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" + type: identifier "Int" source="Int" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "let" source="let" + pattern: identifier "y" source="y" + type: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus/swift/variables/assignment.output b/unified/extractor/tests/corpus/swift/variables/assignment.output index 384b09066e37..cdfb041a8025 100644 --- a/unified/extractor/tests/corpus/swift/variables/assignment.output +++ b/unified/extractor/tests/corpus/swift/variables/assignment.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "x" - operator: infix_operator "=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "=" source="=" + right: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/variables/binding-modifier-does-not-leak-into-initializer.output b/unified/extractor/tests/corpus/swift/variables/binding-modifier-does-not-leak-into-initializer.output index 6776009f62bb..90e58be069ad 100644 --- a/unified/extractor/tests/corpus/swift/variables/binding-modifier-does-not-leak-into-initializer.output +++ b/unified/extractor/tests/corpus/swift/variables/binding-modifier-does-not-leak-into-initializer.output @@ -61,23 +61,23 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" value: - switch_expr - value: identifier "y" + switch_expr source="switch ⟨value⟩ {\n⟨case⟩\n⟨case⟩\n}" + value: identifier "y" source="y" case: - switch_case - pattern: identifier "someConstant" + switch_case source="⟨body⟩⟨pattern⟩" + pattern: identifier "someConstant" source="someConstant" body: - block - stmt: int_literal "1" - switch_case + block source="case someConstant: ⟨stmt⟩" + stmt: int_literal "1" source="1" + switch_case source="⟨body⟩" body: - block - stmt: int_literal "2" + block source="default: ⟨stmt⟩" + stmt: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/variables/compound-assignment.output b/unified/extractor/tests/corpus/swift/variables/compound-assignment.output index e5e1fc04f93d..300996f69952 100644 --- a/unified/extractor/tests/corpus/swift/variables/compound-assignment.output +++ b/unified/extractor/tests/corpus/swift/variables/compound-assignment.output @@ -20,11 +20,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - binary_expr - left: identifier "x" - operator: infix_operator "+=" - right: int_literal "1" + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" + left: identifier "x" source="x" + operator: infix_operator "+=" source="+=" + right: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/variables/let-binding.output b/unified/extractor/tests/corpus/swift/variables/let-binding.output index d4cefc129d47..ae64722a29c5 100644 --- a/unified/extractor/tests/corpus/swift/variables/let-binding.output +++ b/unified/extractor/tests/corpus/swift/variables/let-binding.output @@ -25,11 +25,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" - value: int_literal "1" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" + value: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/variables/let-with-type-annotation.output b/unified/extractor/tests/corpus/swift/variables/let-with-type-annotation.output index 8a28988e8b9d..2100371ba3ca 100644 --- a/unified/extractor/tests/corpus/swift/variables/let-with-type-annotation.output +++ b/unified/extractor/tests/corpus/swift/variables/let-with-type-annotation.output @@ -31,12 +31,12 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" - type: identifier "Int" - value: int_literal "1" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩" + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" + type: identifier "Int" source="Int" + value: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/variables/multiple-bindings-on-one-line.output b/unified/extractor/tests/corpus/swift/variables/multiple-bindings-on-one-line.output index 2ab4bc96691f..fd6057bfb1f8 100644 --- a/unified/extractor/tests/corpus/swift/variables/multiple-bindings-on-one-line.output +++ b/unified/extractor/tests/corpus/swift/variables/multiple-bindings-on-one-line.output @@ -36,17 +36,17 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" - pattern: identifier "x" - value: int_literal "1" - variable_declaration + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩," + modifier: modifier "let" source="let" + pattern: identifier "x" source="x" + value: int_literal "1" source="1" + variable_declaration source="⟨modifier⟩ x = 1, ⟨pattern⟩⟨modifier⟩⟨value⟩" modifier: - modifier "let" - modifier "chained_declaration" - pattern: identifier "y" - value: int_literal "2" + modifier "let" source="let" + modifier "chained_declaration" source="y = 2" + pattern: identifier "y" source="y" + value: int_literal "2" source="2" diff --git a/unified/extractor/tests/corpus/swift/variables/property-with-willset-and-didset-observers.output b/unified/extractor/tests/corpus/swift/variables/property-with-willset-and-didset-observers.output index c574ee74d788..13397f03e6fd 100644 --- a/unified/extractor/tests/corpus/swift/variables/property-with-willset-and-didset-observers.output +++ b/unified/extractor/tests/corpus/swift/variables/property-with-willset-and-didset-observers.output @@ -97,44 +97,44 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - class_like_declaration - modifier: modifier "class" - name_node: identifier "C" + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩⟨member⟩⟨member⟩\n}" + modifier: modifier "class" source="class" + name_node: identifier "C" source="C" member: - variable_declaration - modifier: modifier "var" - pattern: identifier "x" - type: identifier "Int" - value: int_literal "0" - accessor_declaration + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩ = ⟨value⟩ {\n willSet { print(newValue) }\n didSet { print(oldValue) }\n }" + modifier: modifier "var" source="var" + pattern: identifier "x" source="x" + type: identifier "Int" source="Int" + value: int_literal "0" source="0" + accessor_declaration source="⟨modifier⟩ ⟨name_node⟩: Int = 0 {\n ⟨accessor_kind⟩⟨modifier⟩⟨body⟩" modifier: - modifier "var" - modifier "chained_declaration" - name_node: identifier "x" - accessor_kind: accessor_kind "willSet" + modifier "var" source="var" + modifier "chained_declaration" source="willSet { print(newValue) }" + name_node: identifier "x" source="x" + accessor_kind: accessor_kind "willSet" source="willSet" body: - block + block source="{ ⟨stmt⟩ }" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "newValue" - accessor_declaration + argument source="⟨value⟩" + value: identifier "newValue" source="newValue" + accessor_declaration source="⟨modifier⟩ ⟨name_node⟩: Int = 0 {\n willSet { print(newValue) }\n ⟨accessor_kind⟩⟨modifier⟩⟨body⟩" modifier: - modifier "var" - modifier "chained_declaration" - name_node: identifier "x" - accessor_kind: accessor_kind "didSet" + modifier "var" source="var" + modifier "chained_declaration" source="didSet { print(oldValue) }" + name_node: identifier "x" source="x" + accessor_kind: accessor_kind "didSet" source="didSet" body: - block + block source="{ ⟨stmt⟩ }" stmt: - call_expr - callee: identifier "print" + call_expr source="⟨callee⟩(⟨argument⟩)" + callee: identifier "print" source="print" argument: - argument - value: identifier "oldValue" + argument source="⟨value⟩" + value: identifier "oldValue" source="oldValue" diff --git a/unified/extractor/tests/corpus/swift/variables/tuple-destructuring-binding.output b/unified/extractor/tests/corpus/swift/variables/tuple-destructuring-binding.output index 1036f85b4e94..794c3e5054ec 100644 --- a/unified/extractor/tests/corpus/swift/variables/tuple-destructuring-binding.output +++ b/unified/extractor/tests/corpus/swift/variables/tuple-destructuring-binding.output @@ -36,17 +36,17 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "let" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "let" source="let" pattern: - tuple_expr + tuple_expr source="(⟨element⟩ ⟨element⟩)" element: - argument - value: identifier "a" - argument - value: identifier "b" - value: identifier "pair" + argument source="⟨value⟩," + value: identifier "a" source="a" + argument source="⟨value⟩" + value: identifier "b" source="b" + value: identifier "pair" source="pair" diff --git a/unified/extractor/tests/corpus/swift/variables/var-binding.output b/unified/extractor/tests/corpus/swift/variables/var-binding.output index a2c717034c0d..ee5a922da8f6 100644 --- a/unified/extractor/tests/corpus/swift/variables/var-binding.output +++ b/unified/extractor/tests/corpus/swift/variables/var-binding.output @@ -25,11 +25,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "var" - pattern: identifier "x" - value: int_literal "1" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" + modifier: modifier "var" source="var" + pattern: identifier "x" source="x" + value: int_literal "1" source="1" diff --git a/unified/extractor/tests/corpus/swift/variables/var-without-initialiser.output b/unified/extractor/tests/corpus/swift/variables/var-without-initialiser.output index 7996077c0d36..4aac0af4ce32 100644 --- a/unified/extractor/tests/corpus/swift/variables/var-without-initialiser.output +++ b/unified/extractor/tests/corpus/swift/variables/var-without-initialiser.output @@ -25,11 +25,11 @@ sourceFile --- -top_level +top_level source="⟨body⟩" body: - block + block source="⟨stmt⟩" stmt: - variable_declaration - modifier: modifier "var" - pattern: identifier "x" - type: identifier "Int" + variable_declaration source="⟨modifier⟩ ⟨pattern⟩: ⟨type⟩" + modifier: modifier "var" source="var" + pattern: identifier "x" source="x" + type: identifier "Int" source="Int" diff --git a/unified/extractor/tests/corpus_tests.rs b/unified/extractor/tests/corpus_tests.rs index 47675fc2287f..852e72452c5b 100644 --- a/unified/extractor/tests/corpus_tests.rs +++ b/unified/extractor/tests/corpus_tests.rs @@ -2,7 +2,7 @@ use std::fs; use std::path::Path; use codeql_extractor::extractor::desugaring; -use yeast::{dump::dump_ast, dump::dump_ast_with_type_errors}; +use yeast::dump::{DumpOptions, dump_ast, dump_ast_with_type_errors_and_options}; #[path = "../src/languages/mod.rs"] mod languages; @@ -223,11 +223,15 @@ fn test_corpus() { )); } Ok(actual) => { - let actual_dump = dump_ast_with_type_errors( + let actual_dump = dump_ast_with_type_errors_and_options( &actual, actual.get_root(), &case_input, &output_schema, + &DumpOptions { + show_abridged_source: true, + ..DumpOptions::default() + }, ); if update_mode { case.expected = actual_dump.trim().to_string();