unified: Regenerate the raw-AST corpus section for swift-syntax

Now that the Swift front-end is swift-syntax, regenerate the second (raw
parse tree) section of the corpus `.output` files to hold the
swift-syntax AST the adapter builds, instead of the old tree-sitter
parse tree.

These 98 cases map to a byte-for-byte identical mapped AST (the third
section), so only their raw section changes — the mapping rules were
ported to produce the same output. The one case whose mapped AST differs
(`types/property-with-getter-and-setter`) is handled separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Taus
2026-07-23 12:50:10 +00:00
parent 5c5fd5e1cc
commit 20a2537299
98 changed files with 3740 additions and 2257 deletions

View File

@@ -2,41 +2,61 @@ let f = { [weak self] in self?.doThing() }
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "f"
value:
lambda_literal
captures:
capture_list
item:
capture_list_item
name: simple_identifier "self"
ownership:
ownership_modifier
statement:
call_expression
function:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "doThing"
target:
optional_chain_marker
expr:
self_expression
suffix:
call_suffix
arguments:
value_arguments
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
closureExpr
leftBrace: {
rightBrace: }
signature:
closureSignature
attributes:
capture:
closureCaptureClause
leftSquare: [
rightSquare: ]
items:
closureCapture
name: self
specifier:
closureCaptureSpecifier
specifier: weak
inKeyword: in
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "doThing"
base:
optionalChainingExpr
expression:
declReferenceExpr
baseName: self
questionMark: ?
pattern:
identifierPattern
identifier: identifier "f"
---

View File

@@ -2,45 +2,63 @@ let f = { (x: Int) -> Int in x * 2 }
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "f"
value:
lambda_literal
statement:
multiplicative_expression
lhs: simple_identifier "x"
op: *
rhs: integer_literal "2"
type:
lambda_function_type
params:
lambda_function_type_parameters
parameter:
lambda_parameter
name: simple_identifier "x"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
closureExpr
leftBrace: {
rightBrace: }
signature:
closureSignature
attributes:
inKeyword: in
parameterClause:
closureParameterClause
leftParen: (
rightParen: )
parameters:
closureParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "Int"
firstName: identifier "x"
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "Int"
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "2"
pattern:
identifierPattern
identifier: identifier "f"
---

View File

@@ -2,24 +2,40 @@ let f = { $0 + $1 }
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "f"
value:
lambda_literal
statement:
additive_expression
lhs: simple_identifier "$0"
op: +
rhs: simple_identifier "$1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
closureExpr
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: dollarIdentifier "$0"
rightOperand:
declReferenceExpr
baseName: dollarIdentifier "$1"
pattern:
identifierPattern
identifier: identifier "f"
---

View File

@@ -5,62 +5,91 @@ let f = { (x: Int) -> Int in
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "f"
value:
lambda_literal
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "y"
value:
additive_expression
lhs: simple_identifier "x"
op: +
rhs: integer_literal "1"
control_transfer_statement
kind: return
result:
multiplicative_expression
lhs: simple_identifier "y"
op: *
rhs: integer_literal "2"
type:
lambda_function_type
params:
lambda_function_type_parameters
parameter:
lambda_parameter
name: simple_identifier "x"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
closureExpr
leftBrace: {
rightBrace: }
signature:
closureSignature
attributes:
inKeyword: in
parameterClause:
closureParameterClause
leftParen: (
rightParen: )
parameters:
closureParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "Int"
firstName: identifier "x"
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "Int"
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
identifierPattern
identifier: identifier "y"
codeBlockItem
item:
returnStmt
expression:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: identifier "y"
rightOperand:
integerLiteralExpr
literal: integerLiteral "2"
returnKeyword: return
pattern:
identifierPattern
identifier: identifier "f"
---

View File

@@ -2,24 +2,40 @@ xs.map { $0 * 2 }
---
source_file
statement:
call_expression
function:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "map"
target: simple_identifier "xs"
suffix:
call_suffix
lambda:
lambda_literal
statement:
multiplicative_expression
lhs: simple_identifier "$0"
op: *
rhs: integer_literal "2"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionCallExpr
arguments:
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "map"
base:
declReferenceExpr
baseName: identifier "xs"
trailingClosure:
closureExpr
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: dollarIdentifier "$0"
rightOperand:
integerLiteralExpr
literal: integerLiteral "2"
---

View File

@@ -2,23 +2,42 @@ let xs = [1, 2, 3]
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "xs"
value:
array_literal
element:
integer_literal "1"
integer_literal "2"
integer_literal "3"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
arrayExpr
elements:
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "1"
trailingComma: ,
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "2"
trailingComma: ,
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "3"
leftSquare: [
rightSquare: ]
pattern:
identifierPattern
identifier: identifier "xs"
---

View File

@@ -2,30 +2,53 @@ let d = ["a": 1, "b": 2]
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "d"
value:
dictionary_literal
element:
dictionary_literal_item
key:
line_string_literal
text: line_str_text "a"
value: integer_literal "1"
dictionary_literal_item
key:
line_string_literal
text: line_str_text "b"
value: integer_literal "2"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
dictionaryExpr
leftSquare: [
rightSquare: ]
content:
dictionaryElement
colon: :
trailingComma: ,
value:
integerLiteralExpr
literal: integerLiteral "1"
key:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "a"
dictionaryElement
colon: :
value:
integerLiteralExpr
literal: integerLiteral "2"
key:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "b"
pattern:
identifierPattern
identifier: identifier "d"
---

View File

@@ -4,31 +4,40 @@ let v = d["key"]
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "v"
value:
call_expression
function: simple_identifier "d"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "key"
comment "// TODO: same parser issue as the array subscript case above —"
comment "// `d[\"key\"]` is parsed as `call_expression(d, (\"key\"))`."
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
subscriptCallExpr
leftSquare: [
rightSquare: ]
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "key"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "d"
pattern:
identifierPattern
identifier: identifier "v"
---

View File

@@ -2,32 +2,38 @@ let xs: [Int] = []
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "xs"
type:
type_annotation
type:
type
name:
array_type
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
arrayExpr
elements:
leftSquare: [
rightSquare: ]
pattern:
identifierPattern
identifier: identifier "xs"
typeAnnotation:
typeAnnotation
colon: :
type:
arrayType
leftSquare: [
rightSquare: ]
element:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
value:
array_literal
identifierType
name: identifier "Int"
---

View File

@@ -2,41 +2,57 @@ let s: Set<Int> = [1, 2, 3]
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "s"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
arrayExpr
elements:
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "1"
trailingComma: ,
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "2"
trailingComma: ,
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "3"
leftSquare: [
rightSquare: ]
pattern:
identifierPattern
identifier: identifier "s"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Set"
genericArgumentClause:
genericArgumentClause
arguments:
type_arguments
genericArgument
argument:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
name: type_identifier "Set"
value:
array_literal
element:
integer_literal "1"
integer_literal "2"
integer_literal "3"
identifierType
name: identifier "Int"
leftAngle: <
rightAngle: >
---

View File

@@ -5,30 +5,36 @@ let first = xs[0]
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "first"
value:
call_expression
function: simple_identifier "xs"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: integer_literal "0"
comment "// TODO: tree-sitter-swift parses `xs[0]` as a call_expression (same shape"
comment "// as `xs(0)`), so the mapping currently produces a call_expr. Update the"
comment "// parser / add a separate subscript_expr node and remap when fixed."
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
subscriptCallExpr
leftSquare: [
rightSquare: ]
arguments:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "0"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "xs"
pattern:
identifierPattern
identifier: identifier "first"
---

View File

@@ -2,28 +2,46 @@ let t = (1, "two", 3.0)
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "t"
value:
tuple_expression
element:
tuple_expression_item
value: integer_literal "1"
tuple_expression_item
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
line_string_literal
text: line_str_text "two"
tuple_expression_item
value: real_literal "3.0"
tupleExpr
leftParen: (
rightParen: )
elements:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "1"
trailingComma: ,
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "two"
trailingComma: ,
labeledExpr
expression:
floatLiteralExpr
literal: floatLiteral "3.0"
pattern:
identifierPattern
identifier: identifier "t"
---

View File

@@ -2,23 +2,32 @@ let n = t.0
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "n"
value:
navigation_expression
suffix:
navigation_suffix
suffix: integer_literal "0"
target: simple_identifier "t"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: integerLiteral "0"
base:
declReferenceExpr
baseName: identifier "t"
pattern:
identifierPattern
identifier: identifier "n"
---

View File

@@ -8,44 +8,79 @@ default:
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
value: integer_literal "1"
switch_statement
entry:
switch_entry
pattern:
switch_pattern
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
pattern
kind: simple_identifier "someConstant"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "matched"
switch_entry
default: default_keyword "default"
statement:
control_transfer_statement
kind: break
expr: simple_identifier "y"
identifierPattern
identifier: identifier "x"
codeBlockItem
item:
expressionStmt
expression:
switchExpr
leftBrace: {
rightBrace: }
cases:
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
declReferenceExpr
baseName: identifier "someConstant"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "matched"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
switchCase
label:
switchDefaultLabel
colon: :
defaultKeyword: default
statements:
codeBlockItem
item:
breakStmt
breakKeyword: break
subject:
declReferenceExpr
baseName: identifier "y"
switchKeyword: switch
---

View File

@@ -2,25 +2,37 @@ guard let value = optional else { return }
---
source_file
statement:
guard_statement
body:
block
statement:
control_transfer_statement
kind: return
condition:
if_condition
kind:
if_let_binding
pattern:
pattern
binding:
value_binding_pattern
mutability: let
bound_identifier: simple_identifier "value"
value: simple_identifier "optional"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
guardStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
returnStmt
returnKeyword: return
conditions:
conditionElement
condition:
optionalBindingCondition
initializer:
initializerClause
equal: =
value:
declReferenceExpr
baseName: identifier "optional"
pattern:
identifierPattern
identifier: identifier "value"
bindingSpecifier: let
elseKeyword: else
guardKeyword: guard
---

View File

@@ -4,40 +4,59 @@ if case let x = x + 10 {
---
source_file
statement:
if_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "x"
condition:
if_condition
kind:
if_let_binding
pattern:
pattern
kind:
binding_pattern
binding:
value_binding_pattern
mutability: let
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "x"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
conditions:
conditionElement
condition:
matchingPatternCondition
initializer:
initializerClause
equal: =
value:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "10"
pattern:
pattern
bound_identifier: simple_identifier "x"
value:
additive_expression
lhs: simple_identifier "x"
op: +
rhs: integer_literal "10"
valueBindingPattern
pattern:
identifierPattern
identifier: identifier "x"
bindingSpecifier: let
caseKeyword: case
ifKeyword: if
---

View File

@@ -8,61 +8,103 @@ if x > 0 {
---
source_file
statement:
if_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: integer_literal "1"
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
else_branch:
if_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: integer_literal "2"
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: <
rhs: integer_literal "0"
else_branch:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: integer_literal "3"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "1"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
elseKeyword: else
elseBody:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "2"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "<"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
elseKeyword: else
elseBody:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "3"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
ifKeyword: if
ifKeyword: if
---

View File

@@ -6,43 +6,70 @@ if x > 0 {
---
source_file
statement:
if_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "x"
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
else_branch:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
prefix_expression
operation: -
target: simple_identifier "x"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "x"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
elseKeyword: else
elseBody:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
prefixOperatorExpr
expression:
declReferenceExpr
baseName: identifier "x"
operator: prefixOperator "-"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
ifKeyword: if
---

View File

@@ -4,32 +4,48 @@ if let value = optional {
---
source_file
statement:
if_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "value"
condition:
if_condition
kind:
if_let_binding
pattern:
pattern
binding:
value_binding_pattern
mutability: let
bound_identifier: simple_identifier "value"
value: simple_identifier "optional"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "value"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
conditions:
conditionElement
condition:
optionalBindingCondition
initializer:
initializerClause
equal: =
value:
declReferenceExpr
baseName: identifier "optional"
pattern:
identifierPattern
identifier: identifier "value"
bindingSpecifier: let
ifKeyword: if
---

View File

@@ -4,28 +4,47 @@ if x > 0 {
---
source_file
statement:
if_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "x"
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "x"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
ifKeyword: if
---

View File

@@ -9,65 +9,114 @@ default:
---
source_file
statement:
switch_statement
entry:
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind: integer_literal "1"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "one"
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind: integer_literal "2"
switch_pattern
pattern:
pattern
kind: integer_literal "3"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "two or three"
switch_entry
default: default_keyword "default"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "other"
expr: simple_identifier "x"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
switchExpr
leftBrace: {
rightBrace: }
cases:
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
integerLiteralExpr
literal: integerLiteral "1"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "one"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
trailingComma: ,
pattern:
expressionPattern
expression:
integerLiteralExpr
literal: integerLiteral "2"
switchCaseItem
pattern:
expressionPattern
expression:
integerLiteralExpr
literal: integerLiteral "3"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "two or three"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
switchCase
label:
switchDefaultLabel
colon: :
defaultKeyword: default
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "other"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
subject:
declReferenceExpr
baseName: identifier "x"
switchKeyword: switch
---

View File

@@ -7,77 +7,111 @@ case .square(let s):
---
source_file
statement:
switch_statement
entry:
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind:
case_pattern
arguments:
tuple_pattern
item:
tuple_pattern_item
pattern:
pattern
kind:
binding_pattern
binding:
value_binding_pattern
mutability: let
pattern:
pattern
bound_identifier: simple_identifier "r"
dot: .
name: simple_identifier "circle"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "r"
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind:
case_pattern
arguments:
tuple_pattern
item:
tuple_pattern_item
pattern:
pattern
kind:
binding_pattern
binding:
value_binding_pattern
mutability: let
pattern:
pattern
bound_identifier: simple_identifier "s"
dot: .
name: simple_identifier "square"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "s"
expr: simple_identifier "shape"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
switchExpr
leftBrace: {
rightBrace: }
cases:
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
patternExpr
pattern:
valueBindingPattern
pattern:
identifierPattern
identifier: identifier "r"
bindingSpecifier: let
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "circle"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "r"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
patternExpr
pattern:
valueBindingPattern
pattern:
identifierPattern
identifier: identifier "s"
bindingSpecifier: let
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "square"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "s"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
subject:
declReferenceExpr
baseName: identifier "shape"
switchKeyword: switch
---

View File

@@ -7,79 +7,119 @@ case .thread(threadRowId: _, let rowId):
---
source_file
statement:
switch_statement
entry:
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind:
case_pattern
arguments:
tuple_pattern
item:
tuple_pattern_item
name: simple_identifier "isAcknowledged"
pattern:
pattern
kind:
boolean_literal
dot: .
name: simple_identifier "implicit"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "yes"
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind:
case_pattern
arguments:
tuple_pattern
item:
tuple_pattern_item
name: simple_identifier "threadRowId"
pattern:
pattern
kind: wildcard_pattern "_"
tuple_pattern_item
pattern:
pattern
kind:
binding_pattern
binding:
value_binding_pattern
mutability: let
pattern:
pattern
bound_identifier: simple_identifier "rowId"
dot: .
name: simple_identifier "thread"
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "rowId"
expr: simple_identifier "x"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
expressionStmt
expression:
switchExpr
leftBrace: {
rightBrace: }
cases:
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
colon: :
label: identifier "isAcknowledged"
expression:
booleanLiteralExpr
literal: false
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "implicit"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "yes"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
colon: :
label: identifier "threadRowId"
expression:
discardAssignmentExpr
wildcard: _
trailingComma: ,
labeledExpr
expression:
patternExpr
pattern:
valueBindingPattern
pattern:
identifierPattern
identifier: identifier "rowId"
bindingSpecifier: let
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "thread"
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "rowId"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
subject:
declReferenceExpr
baseName: identifier "x"
switchKeyword: switch
---

View File

@@ -2,29 +2,47 @@ let y = x > 0 ? 1 : -1
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "y"
value:
ternary_expression
condition:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
if_false:
prefix_expression
operation: -
target: integer_literal "1"
if_true: integer_literal "1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
ternaryExpr
colon: :
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
questionMark: ?
elseExpression:
prefixOperatorExpr
expression:
integerLiteralExpr
literal: integerLiteral "1"
operator: prefixOperator "-"
thenExpression:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
identifierPattern
identifier: identifier "y"
---

View File

@@ -2,12 +2,21 @@
---
source_file
statement:
additive_expression
lhs: integer_literal "1"
op: +
rhs: integer_literal "2"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
integerLiteralExpr
literal: integerLiteral "1"
rightOperand:
integerLiteralExpr
literal: integerLiteral "2"
---

View File

@@ -2,12 +2,21 @@ foo + bar
---
source_file
statement:
additive_expression
lhs: simple_identifier "foo"
op: +
rhs: simple_identifier "bar"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "foo"
rightOperand:
declReferenceExpr
baseName: identifier "bar"
---

View File

@@ -2,15 +2,24 @@ import Foundation.Networking.URLSession
---
source_file
statement:
import_declaration
name:
identifier
part:
simple_identifier "Foundation"
simple_identifier "Networking"
simple_identifier "URLSession"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
importDecl
attributes:
modifiers:
importKeyword: import
path:
importPathComponent
name: identifier "Foundation"
trailingPeriod: .
importPathComponent
name: identifier "Networking"
trailingPeriod: .
importPathComponent
name: identifier "URLSession"
---

View File

@@ -2,14 +2,21 @@ import Foundation.Networking
---
source_file
statement:
import_declaration
name:
identifier
part:
simple_identifier "Foundation"
simple_identifier "Networking"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
importDecl
attributes:
modifiers:
importKeyword: import
path:
importPathComponent
name: identifier "Foundation"
trailingPeriod: .
importPathComponent
name: identifier "Networking"
---

View File

@@ -2,15 +2,22 @@ import struct Foundation.Date
---
source_file
statement:
import_declaration
name:
identifier
part:
simple_identifier "Foundation"
simple_identifier "Date"
scoped_import_kind: struct
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
importDecl
attributes:
modifiers:
importKeyword: import
importKindSpecifier: struct
path:
importPathComponent
name: identifier "Foundation"
trailingPeriod: .
importPathComponent
name: identifier "Date"
---

View File

@@ -2,12 +2,18 @@ import Foundation
---
source_file
statement:
import_declaration
name:
identifier
part: simple_identifier "Foundation"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
importDecl
attributes:
modifiers:
importKeyword: import
path:
importPathComponent
name: identifier "Foundation"
---

View File

@@ -2,22 +2,29 @@ greet(person: "Bob")
---
source_file
statement:
call_expression
function: simple_identifier "greet"
suffix:
call_suffix
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
value_arguments
argument:
value_argument
name:
value_argument_label
name: simple_identifier "person"
value:
line_string_literal
text: line_str_text "Bob"
labeledExpr
colon: :
label: identifier "person"
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "Bob"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "greet"
---

View File

@@ -2,19 +2,28 @@ foo(1, 2)
---
source_file
statement:
call_expression
function: simple_identifier "foo"
suffix:
call_suffix
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
value_arguments
argument:
value_argument
value: integer_literal "1"
value_argument
value: integer_literal "2"
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "1"
trailingComma: ,
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "2"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "foo"
---

View File

@@ -4,37 +4,60 @@ func greet(name: String = "world") {
---
source_file
statement:
function_declaration
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "name"
name: simple_identifier "greet"
parameter:
function_parameter
default_value:
line_string_literal
text: line_str_text "world"
parameter:
parameter
name: simple_identifier "name"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "String"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "name"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
name: identifier "greet"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
functionParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "String"
firstName: identifier "name"
defaultValue:
initializerClause
equal: =
value:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "world"
funcKeyword: func
---

View File

@@ -4,35 +4,51 @@ func greet(person name: String) {
---
source_file
statement:
function_declaration
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "name"
name: simple_identifier "greet"
parameter:
function_parameter
parameter:
parameter
external_name: simple_identifier "person"
name: simple_identifier "name"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "String"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "name"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
name: identifier "greet"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
functionParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "String"
firstName: identifier "person"
secondName: identifier "name"
funcKeyword: func
---

View File

@@ -4,24 +4,46 @@ func greet() {
---
source_file
statement:
function_declaration
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value:
line_string_literal
text: line_str_text "hello"
name: simple_identifier "greet"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "hello"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
name: identifier "greet"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
funcKeyword: func
---

View File

@@ -4,52 +4,68 @@ func add(_ a: Int, _ b: Int) -> Int {
---
source_file
statement:
function_declaration
body:
block
statement:
control_transfer_statement
kind: return
result:
additive_expression
lhs: simple_identifier "a"
op: +
rhs: simple_identifier "b"
name: simple_identifier "add"
parameter:
function_parameter
parameter:
parameter
external_name: simple_identifier "_"
name: simple_identifier "a"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
function_parameter
parameter:
parameter
external_name: simple_identifier "_"
name: simple_identifier "b"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
returnStmt
expression:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
returnKeyword: return
name: identifier "add"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
functionParameter
colon: :
attributes:
modifiers:
trailingComma: ,
type:
identifierType
name: identifier "Int"
firstName: _
secondName: identifier "a"
functionParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "Int"
firstName: _
secondName: identifier "b"
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "Int"
funcKeyword: func
---

View File

@@ -4,41 +4,58 @@ func identity<T>(_ x: T) -> T {
---
source_file
statement:
function_declaration
body:
block
statement:
control_transfer_statement
kind: return
result: simple_identifier "x"
name: simple_identifier "identity"
parameter:
function_parameter
parameter:
parameter
external_name: simple_identifier "_"
name: simple_identifier "x"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "T"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "T"
type_parameters:
type_parameters
parameter:
type_parameter
name: type_identifier "T"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
returnStmt
expression:
declReferenceExpr
baseName: identifier "x"
returnKeyword: return
name: identifier "identity"
genericParameterClause:
genericParameterClause
parameters:
genericParameter
attributes:
name: identifier "T"
leftAngle: <
rightAngle: >
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
functionParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "T"
firstName: _
secondName: identifier "x"
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "T"
funcKeyword: func
---

View File

@@ -2,30 +2,39 @@ let y = .some(1)
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "y"
value:
call_expression
function:
prefix_expression
operation: .
target: simple_identifier "some"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: integer_literal "1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "1"
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "some"
pattern:
identifierPattern
identifier: identifier "y"
---

View File

@@ -2,21 +2,29 @@ let x = .foo
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
value:
prefix_expression
operation: .
target: simple_identifier "foo"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "foo"
pattern:
identifierPattern
identifier: identifier "x"
---

View File

@@ -2,22 +2,29 @@ list.append(1)
---
source_file
statement:
call_expression
function:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "append"
target: simple_identifier "list"
suffix:
call_suffix
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
value_arguments
argument:
value_argument
value: integer_literal "1"
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "1"
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "append"
base:
declReferenceExpr
baseName: identifier "list"
---

View File

@@ -4,54 +4,72 @@ func sum(_ values: Int...) -> Int {
---
source_file
statement:
function_declaration
body:
block
statement:
control_transfer_statement
kind: return
result:
call_expression
function:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "reduce"
target: simple_identifier "values"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: integer_literal "0"
value_argument
value:
referenceable_operator
operator: +
name: simple_identifier "sum"
parameter:
function_parameter
parameter:
parameter
external_name: simple_identifier "_"
name: simple_identifier "values"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
returnStmt
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
integerLiteralExpr
literal: integerLiteral "0"
trailingComma: ,
labeledExpr
expression:
declReferenceExpr
baseName: binaryOperator "+"
additionalTrailingClosures:
calledExpression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "reduce"
base:
declReferenceExpr
baseName: identifier "values"
returnKeyword: return
name: identifier "sum"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
functionParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "Int"
ellipsis: ...
firstName: _
secondName: identifier "values"
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "Int"
funcKeyword: func
---

View File

@@ -3,10 +3,17 @@ false
---
source_file
statement:
boolean_literal
boolean_literal
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
booleanLiteralExpr
literal: true
codeBlockItem
item:
booleanLiteralExpr
literal: false
---

View File

@@ -2,8 +2,13 @@
---
source_file
statement: real_literal "3.14"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
floatLiteralExpr
literal: floatLiteral "3.14"
---

View File

@@ -2,8 +2,13 @@
---
source_file
statement: integer_literal "42"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
integerLiteralExpr
literal: integerLiteral "42"
---

View File

@@ -2,11 +2,16 @@
---
source_file
statement:
prefix_expression
operation: -
target: integer_literal "7"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
prefixOperatorExpr
expression:
integerLiteralExpr
literal: integerLiteral "7"
operator: prefixOperator "-"
---

View File

@@ -2,8 +2,13 @@ nil
---
source_file
statement: nil
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
nilLiteralExpr
nilKeyword: nil
---

View File

@@ -2,10 +2,17 @@
---
source_file
statement:
line_string_literal
text: line_str_text "hello"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "hello"
---

View File

@@ -2,13 +2,28 @@
---
source_file
statement:
line_string_literal
interpolation:
interpolated_expression
value: simple_identifier "name"
text: line_str_text "hello "
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "hello "
expressionSegment
leftParen: (
rightParen: )
backslash: \
expressions:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "name"
stringSegment
content: stringSegment
---

View File

@@ -6,51 +6,95 @@ for x in xs {
---
source_file
statement:
for_statement
body:
block
statement:
if_statement
body:
block
statement:
control_transfer_statement
kind: continue
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: <
rhs: integer_literal "0"
if_statement
body:
block
statement:
control_transfer_statement
kind: break
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "100"
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "x"
collection: simple_identifier "xs"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
pattern
bound_identifier: simple_identifier "x"
forStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
continueStmt
continueKeyword: continue
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "<"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
ifKeyword: if
codeBlockItem
item:
expressionStmt
expression:
ifExpr
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
breakStmt
breakKeyword: break
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "100"
ifKeyword: if
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "x"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
pattern:
identifierPattern
identifier: identifier "x"
inKeyword: in
forKeyword: for
sequence:
declReferenceExpr
baseName: identifier "xs"
---

View File

@@ -4,30 +4,55 @@ for x in [1, 2, 3] {
---
source_file
statement:
for_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "x"
collection:
array_literal
element:
integer_literal "1"
integer_literal "2"
integer_literal "3"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
pattern
bound_identifier: simple_identifier "x"
forStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "x"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
pattern:
identifierPattern
identifier: identifier "x"
inKeyword: in
forKeyword: for
sequence:
arrayExpr
elements:
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "1"
trailingComma: ,
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "2"
trailingComma: ,
arrayElement
expression:
integerLiteralExpr
literal: integerLiteral "3"
leftSquare: [
rightSquare: ]
---

View File

@@ -4,29 +4,47 @@ for i in 0..<10 {
---
source_file
statement:
for_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "i"
collection:
range_expression
end: integer_literal "10"
op: ..<
start: integer_literal "0"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
pattern
bound_identifier: simple_identifier "i"
forStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "i"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
pattern:
identifierPattern
identifier: identifier "i"
inKeyword: in
forKeyword: for
sequence:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "..<"
leftOperand:
integerLiteralExpr
literal: integerLiteral "0"
rightOperand:
integerLiteralExpr
literal: integerLiteral "10"
---

View File

@@ -4,33 +4,53 @@ for x in xs where x > 0 {
---
source_file
statement:
for_statement
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "x"
collection: simple_identifier "xs"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
pattern
bound_identifier: simple_identifier "x"
where:
where_clause
expr:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
keyword: where_keyword "where"
forStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "x"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
pattern:
identifierPattern
identifier: identifier "x"
whereClause:
whereClause
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
whereKeyword: where
inKeyword: in
forKeyword: for
sequence:
declReferenceExpr
baseName: identifier "xs"
---

View File

@@ -4,25 +4,42 @@ repeat {
---
source_file
statement:
repeat_while_statement
body:
block
statement:
assignment
operator: -=
result: integer_literal "1"
target:
directly_assignable_expression
expr: simple_identifier "x"
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
repeatStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "-="
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "1"
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
repeatKeyword: repeat
whileKeyword: while
---

View File

@@ -4,25 +4,43 @@ while x > 0 {
---
source_file
statement:
while_statement
body:
block
statement:
assignment
operator: -=
result: integer_literal "1"
target:
directly_assignable_expression
expr: simple_identifier "x"
condition:
if_condition
kind:
comparison_expression
lhs: simple_identifier "x"
op: >
rhs: integer_literal "0"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
whileStmt
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "-="
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "1"
conditions:
conditionElement
condition:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator ">"
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
whileKeyword: while
---

View File

@@ -2,12 +2,21 @@ a + b
---
source_file
statement:
additive_expression
lhs: simple_identifier "a"
op: +
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,12 +2,21 @@ a < b
---
source_file
statement:
comparison_expression
lhs: simple_identifier "a"
op: <
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "<"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,12 +2,21 @@ a / b
---
source_file
statement:
multiplicative_expression
lhs: simple_identifier "a"
op: /
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "/"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,12 +2,21 @@ a == b
---
source_file
statement:
equality_expression
lhs: simple_identifier "a"
op: ==
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "=="
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,12 +2,21 @@ a && b
---
source_file
statement:
conjunction_expression
lhs: simple_identifier "a"
op: &&
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "&&"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,11 +2,16 @@
---
source_file
statement:
prefix_expression
operation: bang "!"
target: simple_identifier "a"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
prefixOperatorExpr
expression:
declReferenceExpr
baseName: identifier "a"
operator: prefixOperator "!"
---

View File

@@ -2,12 +2,21 @@ a || b
---
source_file
statement:
disjunction_expression
lhs: simple_identifier "a"
op: ||
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "||"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,12 +2,21 @@ a * b
---
source_file
statement:
multiplicative_expression
lhs: simple_identifier "a"
op: *
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -2,16 +2,29 @@ a + b * c
---
source_file
statement:
additive_expression
lhs: simple_identifier "a"
op: +
rhs:
multiplicative_expression
lhs: simple_identifier "b"
op: *
rhs: simple_identifier "c"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: identifier "b"
rightOperand:
declReferenceExpr
baseName: identifier "c"
---

View File

@@ -2,20 +2,35 @@
---
source_file
statement:
multiplicative_expression
lhs:
tuple_expression
element:
tuple_expression_item
value:
additive_expression
lhs: simple_identifier "a"
op: +
rhs: simple_identifier "b"
op: *
rhs: simple_identifier "c"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
tupleExpr
leftParen: (
rightParen: )
elements:
labeledExpr
expression:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
rightOperand:
declReferenceExpr
baseName: identifier "c"
---

View File

@@ -2,12 +2,21 @@
---
source_file
statement:
range_expression
end: integer_literal "10"
op: ...
start: integer_literal "1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "..."
leftOperand:
integerLiteralExpr
literal: integerLiteral "1"
rightOperand:
integerLiteralExpr
literal: integerLiteral "10"
---

View File

@@ -2,12 +2,21 @@ a - b
---
source_file
statement:
additive_expression
lhs: simple_identifier "a"
op: -
rhs: simple_identifier "b"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "-"
leftOperand:
declReferenceExpr
baseName: identifier "a"
rightOperand:
declReferenceExpr
baseName: identifier "b"
---

View File

@@ -6,37 +6,54 @@ do {
---
source_file
statement:
do_statement
body:
block
statement:
try_expression
expr:
call_expression
function: simple_identifier "foo"
suffix:
call_suffix
arguments:
value_arguments
operator:
try_operator
catch:
catch_block
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
doStmt
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "error"
keyword: catch_keyword "catch"
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
tryExpr
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "foo"
tryKeyword: try
catchClauses:
catchClause
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "error"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
catchItems:
catchKeyword: catch
doKeyword: do
---

View File

@@ -2,21 +2,29 @@ let n = opt!
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "n"
value:
postfix_expression
operation: bang "!"
target: simple_identifier "opt"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
forceUnwrapExpr
expression:
declReferenceExpr
baseName: identifier "opt"
exclamationMark: !
pattern:
identifierPattern
identifier: identifier "n"
---

View File

@@ -2,21 +2,34 @@ let n = opt ?? 0
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "n"
value:
nil_coalescing_expression
if_nil: integer_literal "0"
value: simple_identifier "opt"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "??"
leftOperand:
declReferenceExpr
baseName: identifier "opt"
rightOperand:
integerLiteralExpr
literal: integerLiteral "0"
pattern:
identifierPattern
identifier: identifier "n"
---

View File

@@ -2,32 +2,44 @@ let n = obj?.foo?.bar
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "n"
value:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "bar"
target:
optional_chain_marker
expr:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "foo"
target:
optional_chain_marker
expr: simple_identifier "obj"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "bar"
base:
optionalChainingExpr
expression:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "foo"
base:
optionalChainingExpr
expression:
declReferenceExpr
baseName: identifier "obj"
questionMark: ?
questionMark: ?
pattern:
identifierPattern
identifier: identifier "n"
---

View File

@@ -2,29 +2,35 @@ let x: Int? = nil
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
type:
type_annotation
type:
type
name:
optional_type
wrapped:
user_type
part:
simple_user_type
name: type_identifier "Int"
value: nil
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
nilLiteralExpr
nilKeyword: nil
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
optionalType
wrappedType:
identifierType
name: identifier "Int"
questionMark: ?
---

View File

@@ -4,25 +4,50 @@ func read() throws -> String {
---
source_file
statement:
function_declaration
body:
block
statement:
control_transfer_statement
kind: return
result:
line_string_literal
name: simple_identifier "read"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "String"
throws: throws "throws"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
returnStmt
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment
returnKeyword: return
name: identifier "read"
modifiers:
signature:
functionSignature
effectSpecifiers:
functionEffectSpecifiers
throwsClause:
throwsClause
throwsSpecifier: throws
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "String"
funcKeyword: func
---

View File

@@ -2,28 +2,36 @@ let result = try! foo()
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "result"
value:
try_expression
expr:
call_expression
function: simple_identifier "foo"
suffix:
call_suffix
arguments:
value_arguments
operator:
try_operator
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
tryExpr
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "foo"
questionOrExclamationMark: !
tryKeyword: try
pattern:
identifierPattern
identifier: identifier "result"
---

View File

@@ -2,28 +2,36 @@ let result = try? foo()
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "result"
value:
try_expression
expr:
call_expression
function: simple_identifier "foo"
suffix:
call_suffix
arguments:
value_arguments
operator:
try_operator
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
tryExpr
expression:
functionCallExpr
leftParen: (
rightParen: )
arguments:
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "foo"
questionOrExclamationMark: ?
tryKeyword: try
pattern:
identifierPattern
identifier: identifier "result"
---

View File

@@ -11,54 +11,84 @@ var p: Int {
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
computed_value:
computed_property
accessor:
computed_getter
body:
block
statement:
switch_statement
entry:
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind: simple_identifier "someConstant"
statement:
control_transfer_statement
kind: return
result: integer_literal "1"
switch_entry
default: default_keyword "default"
statement:
control_transfer_statement
kind: return
result: integer_literal "2"
expr: simple_identifier "y"
specifier:
getter_specifier
name:
pattern
bound_identifier: simple_identifier "p"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "p"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
accessorBlock:
accessorBlock
accessors:
accessorDecl
accessorSpecifier: get
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
expressionStmt
expression:
switchExpr
leftBrace: {
rightBrace: }
cases:
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
declReferenceExpr
baseName: identifier "someConstant"
statements:
codeBlockItem
item:
returnStmt
expression:
integerLiteralExpr
literal: integerLiteral "1"
returnKeyword: return
switchCase
label:
switchDefaultLabel
colon: :
defaultKeyword: default
statements:
codeBlockItem
item:
returnStmt
expression:
integerLiteralExpr
literal: integerLiteral "2"
returnKeyword: return
subject:
declReferenceExpr
baseName: identifier "y"
switchKeyword: switch
leftBrace: {
rightBrace: }
---

View File

@@ -2,20 +2,29 @@ class Dog: Animal {}
---
source_file
statement:
class_declaration
body:
class_body
declaration_kind: class
inherits:
inheritance_specifier
inherits_from:
user_type
part:
simple_user_type
name: type_identifier "Animal"
name: type_identifier "Dog"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "Dog"
inheritanceClause:
inheritanceClause
colon: :
inheritedTypes:
inheritedType
type:
identifierType
name: identifier "Animal"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
modifiers:
classKeyword: class
---

View File

@@ -7,60 +7,82 @@ class Point {
---
source_file
statement:
class_declaration
body:
class_body
member:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
init_declaration
body:
block
statement:
assignment
operator: =
result: simple_identifier "x"
target:
directly_assignable_expression
expr:
navigation_expression
suffix:
navigation_suffix
suffix: simple_identifier "x"
target:
self_expression
parameter:
function_parameter
parameter:
parameter
name: simple_identifier "x"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
declaration_kind: class
name: type_identifier "Point"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "Point"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
memberBlockItem
decl:
initializerDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
assignmentExpr
equal: =
leftOperand:
memberAccessExpr
period: .
declName:
declReferenceExpr
baseName: identifier "x"
base:
declReferenceExpr
baseName: self
rightOperand:
declReferenceExpr
baseName: identifier "x"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
functionParameter
colon: :
attributes:
modifiers:
type:
identifierType
name: identifier "Int"
firstName: identifier "x"
initKeyword: init
modifiers:
classKeyword: class
---

View File

@@ -7,35 +7,69 @@ class Counter {
---
source_file
statement:
class_declaration
body:
class_body
member:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "n"
value: integer_literal "0"
function_declaration
body:
block
statement:
assignment
operator: +=
result: integer_literal "1"
target:
directly_assignable_expression
expr: simple_identifier "n"
name: simple_identifier "bump"
declaration_kind: class
name: type_identifier "Counter"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "Counter"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "0"
pattern:
identifierPattern
identifier: identifier "n"
memberBlockItem
decl:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+="
leftOperand:
declReferenceExpr
baseName: identifier "n"
rightOperand:
integerLiteralExpr
literal: integerLiteral "1"
name: identifier "bump"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
funcKeyword: func
modifiers:
classKeyword: class
---

View File

@@ -5,50 +5,55 @@ class Point {
---
source_file
statement:
class_declaration
body:
class_body
member:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "y"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
declaration_kind: class
name: type_identifier "Point"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "Point"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "y"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
modifiers:
classKeyword: class
---

View File

@@ -8,78 +8,92 @@ class Rect {
---
source_file
statement:
class_declaration
body:
class_body
member:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "w"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Double"
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "h"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Double"
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
computed_value:
computed_property
statement:
control_transfer_statement
kind: return
result:
multiplicative_expression
lhs: simple_identifier "w"
op: *
rhs: simple_identifier "h"
name:
pattern
bound_identifier: simple_identifier "area"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Double"
declaration_kind: class
name: type_identifier "Rect"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "Rect"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "w"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Double"
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "h"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Double"
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "area"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Double"
accessorBlock:
accessorBlock
accessors:
codeBlockItem
item:
returnStmt
expression:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: identifier "w"
rightOperand:
declReferenceExpr
baseName: identifier "h"
returnKeyword: return
leftBrace: {
rightBrace: }
modifiers:
classKeyword: class
---

View File

@@ -2,13 +2,21 @@ class Foo {}
---
source_file
statement:
class_declaration
body:
class_body
declaration_kind: class
name: type_identifier "Foo"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "Foo"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
modifiers:
classKeyword: class
---

View File

@@ -5,46 +5,63 @@ enum Shape {
---
source_file
statement:
class_declaration
body:
enum_class_body
member:
enum_entry
case:
enum_case_entry
data_contents:
enum_type_parameters
parameter:
enum_type_parameter
name: simple_identifier "radius"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Double"
name: simple_identifier "circle"
enum_entry
case:
enum_case_entry
data_contents:
enum_type_parameters
parameter:
enum_type_parameter
name: simple_identifier "side"
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Double"
name: simple_identifier "square"
declaration_kind: enum
name: type_identifier "Shape"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
enumDecl
attributes:
name: identifier "Shape"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "circle"
parameterClause:
enumCaseParameterClause
leftParen: (
rightParen: )
parameters:
enumCaseParameter
colon: :
modifiers:
type:
identifierType
name: identifier "Double"
firstName: identifier "radius"
caseKeyword: case
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "square"
parameterClause:
enumCaseParameterClause
leftParen: (
rightParen: )
parameters:
enumCaseParameter
colon: :
modifiers:
type:
identifierType
name: identifier "Double"
firstName: identifier "side"
caseKeyword: case
modifiers:
enumKeyword: enum
---

View File

@@ -7,30 +7,57 @@ enum Direction {
---
source_file
statement:
class_declaration
body:
enum_class_body
member:
enum_entry
case:
enum_case_entry
name: simple_identifier "north"
enum_entry
case:
enum_case_entry
name: simple_identifier "south"
enum_entry
case:
enum_case_entry
name: simple_identifier "east"
enum_entry
case:
enum_case_entry
name: simple_identifier "west"
declaration_kind: enum
name: type_identifier "Direction"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
enumDecl
attributes:
name: identifier "Direction"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "north"
caseKeyword: case
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "south"
caseKeyword: case
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "east"
caseKeyword: case
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "west"
caseKeyword: case
modifiers:
enumKeyword: enum
---

View File

@@ -4,24 +4,39 @@ enum Suit {
---
source_file
statement:
class_declaration
body:
enum_class_body
member:
enum_entry
case:
enum_case_entry
name: simple_identifier "clubs"
enum_case_entry
name: simple_identifier "diamonds"
enum_case_entry
name: simple_identifier "hearts"
enum_case_entry
name: simple_identifier "spades"
declaration_kind: enum
name: type_identifier "Suit"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
enumDecl
attributes:
name: identifier "Suit"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
enumCaseDecl
attributes:
modifiers:
elements:
enumCaseElement
name: identifier "clubs"
trailingComma: ,
enumCaseElement
name: identifier "diamonds"
trailingComma: ,
enumCaseElement
name: identifier "hearts"
trailingComma: ,
enumCaseElement
name: identifier "spades"
caseKeyword: case
modifiers:
enumKeyword: enum
---

View File

@@ -4,39 +4,63 @@ extension Int {
---
source_file
statement:
class_declaration
body:
class_body
member:
function_declaration
body:
block
statement:
control_transfer_statement
kind: return
result:
multiplicative_expression
lhs:
self_expression
op: *
rhs:
self_expression
name: simple_identifier "squared"
return_type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
declaration_kind: extension
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
extensionDecl
attributes:
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
functionDecl
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
returnStmt
expression:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "*"
leftOperand:
declReferenceExpr
baseName: self
rightOperand:
declReferenceExpr
baseName: self
returnKeyword: return
name: identifier "squared"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
returnClause:
returnClause
arrow: ->
type:
identifierType
name: identifier "Int"
funcKeyword: func
modifiers:
extendedType:
identifierType
name: identifier "Int"
extensionKeyword: extension
---

View File

@@ -4,15 +4,35 @@ protocol Drawable {
---
source_file
statement:
protocol_declaration
body:
protocol_body
member:
protocol_function_declaration
name: simple_identifier "draw"
name: type_identifier "Drawable"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
protocolDecl
attributes:
name: identifier "Drawable"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
functionDecl
attributes:
name: identifier "draw"
modifiers:
signature:
functionSignature
parameterClause:
functionParameterClause
leftParen: (
rightParen: )
parameters:
funcKeyword: func
modifiers:
protocolKeyword: protocol
---

View File

@@ -5,54 +5,74 @@ protocol P {
---
source_file
statement:
protocol_declaration
body:
protocol_body
member:
protocol_property_declaration
name:
pattern
binding:
value_binding_pattern
mutability: var
bound_identifier: simple_identifier "foo"
requirements:
protocol_property_requirements
accessor:
getter_specifier
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
protocol_property_declaration
name:
pattern
binding:
value_binding_pattern
mutability: var
bound_identifier: simple_identifier "bar"
requirements:
protocol_property_requirements
accessor:
getter_specifier
setter_specifier
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "String"
name: type_identifier "P"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
protocolDecl
attributes:
name: identifier "P"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "foo"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
accessorBlock:
accessorBlock
accessors:
accessorDecl
accessorSpecifier: get
attributes:
leftBrace: {
rightBrace: }
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "bar"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "String"
accessorBlock:
accessorBlock
accessors:
accessorDecl
accessorSpecifier: get
attributes:
accessorDecl
accessorSpecifier: set
attributes:
leftBrace: {
rightBrace: }
modifiers:
protocolKeyword: protocol
---

View File

@@ -5,50 +5,55 @@ struct Point {
---
source_file
statement:
class_declaration
body:
class_body
member:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "y"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
declaration_kind: struct
name: type_identifier "Point"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
structDecl
attributes:
name: identifier "Point"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "y"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
modifiers:
structKeyword: struct
---

View File

@@ -2,14 +2,21 @@ x = 1
---
source_file
statement:
assignment
operator: =
result: integer_literal "1"
target:
directly_assignable_expression
expr: simple_identifier "x"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
assignmentExpr
equal: =
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "1"
---

View File

@@ -5,31 +5,59 @@ default: 2
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
value:
switch_statement
entry:
switch_entry
pattern:
switch_pattern
pattern:
pattern
kind: simple_identifier "someConstant"
statement: integer_literal "1"
switch_entry
default: default_keyword "default"
statement: integer_literal "2"
expr: simple_identifier "y"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
switchExpr
leftBrace: {
rightBrace: }
cases:
switchCase
label:
switchCaseLabel
colon: :
caseKeyword: case
caseItems:
switchCaseItem
pattern:
expressionPattern
expression:
declReferenceExpr
baseName: identifier "someConstant"
statements:
codeBlockItem
item:
integerLiteralExpr
literal: integerLiteral "1"
switchCase
label:
switchDefaultLabel
colon: :
defaultKeyword: default
statements:
codeBlockItem
item:
integerLiteralExpr
literal: integerLiteral "2"
subject:
declReferenceExpr
baseName: identifier "y"
switchKeyword: switch
pattern:
identifierPattern
identifier: identifier "x"
---

View File

@@ -2,14 +2,21 @@ x += 1
---
source_file
statement:
assignment
operator: +=
result: integer_literal "1"
target:
directly_assignable_expression
expr: simple_identifier "x"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
infixOperatorExpr
operator:
binaryOperatorExpr
operator: binaryOperator "+="
leftOperand:
declReferenceExpr
baseName: identifier "x"
rightOperand:
integerLiteralExpr
literal: integerLiteral "1"
---

View File

@@ -2,18 +2,26 @@ let x = 1
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
value: integer_literal "1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
identifierPattern
identifier: identifier "x"
---

View File

@@ -2,27 +2,32 @@ let x: Int = 1
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
value: integer_literal "1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
---

View File

@@ -2,23 +2,37 @@ let x = 1, y = 2
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
value: integer_literal "1"
property_binding
name:
pattern
bound_identifier: simple_identifier "y"
value: integer_literal "2"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
trailingComma: ,
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
identifierPattern
identifier: identifier "x"
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "2"
pattern:
identifierPattern
identifier: identifier "y"
---

View File

@@ -7,63 +7,93 @@ class C {
---
source_file
statement:
class_declaration
body:
class_body
member:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
observers:
willset_didset_block
didset:
didset_clause
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "oldValue"
willset:
willset_clause
body:
block
statement:
call_expression
function: simple_identifier "print"
suffix:
call_suffix
arguments:
value_arguments
argument:
value_argument
value: simple_identifier "newValue"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
value: integer_literal "0"
declaration_kind: class
name: type_identifier "C"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
classDecl
attributes:
name: identifier "C"
memberBlock:
memberBlock
leftBrace: {
rightBrace: }
members:
memberBlockItem
decl:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "0"
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
accessorBlock:
accessorBlock
accessors:
accessorDecl
accessorSpecifier: willSet
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "newValue"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
accessorDecl
accessorSpecifier: didSet
attributes:
body:
codeBlock
leftBrace: {
rightBrace: }
statements:
codeBlockItem
item:
functionCallExpr
leftParen: (
rightParen: )
arguments:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "oldValue"
additionalTrailingClosures:
calledExpression:
declReferenceExpr
baseName: identifier "print"
leftBrace: {
rightBrace: }
modifiers:
classKeyword: class
---

View File

@@ -2,28 +2,37 @@ let (a, b) = pair
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: let
declarator:
property_binding
name:
pattern
kind:
tuple_pattern
item:
tuple_pattern_item
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: let
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
declReferenceExpr
baseName: identifier "pair"
pattern:
tuplePattern
leftParen: (
rightParen: )
elements:
tuplePatternElement
trailingComma: ,
pattern:
pattern
kind: simple_identifier "a"
tuple_pattern_item
identifierPattern
identifier: identifier "a"
tuplePatternElement
pattern:
pattern
kind: simple_identifier "b"
value: simple_identifier "pair"
identifierPattern
identifier: identifier "b"
---

View File

@@ -2,18 +2,26 @@ var x = 1
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
value: integer_literal "1"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
initializer:
initializerClause
equal: =
value:
integerLiteralExpr
literal: integerLiteral "1"
pattern:
identifierPattern
identifier: identifier "x"
---

View File

@@ -2,26 +2,26 @@ var x: Int
---
source_file
statement:
property_declaration
binding:
value_binding_pattern
mutability: var
declarator:
property_binding
name:
pattern
bound_identifier: simple_identifier "x"
type:
type_annotation
type:
type
name:
user_type
part:
simple_user_type
name: type_identifier "Int"
sourceFile
endOfFileToken: endOfFile
statements:
codeBlockItem
item:
variableDecl
attributes:
modifiers:
bindingSpecifier: var
bindings:
patternBinding
pattern:
identifierPattern
identifier: identifier "x"
typeAnnotation:
typeAnnotation
colon: :
type:
identifierType
name: identifier "Int"
---