|
| 1 | +class Base { |
| 2 | + var value = 0 |
| 3 | + |
| 4 | + func update() {} |
| 5 | +} |
| 6 | + |
| 7 | +class Derived: Base { |
| 8 | + override func update() { |
| 9 | + _ = super.value |
| 10 | + super.update() |
| 11 | + } |
| 12 | +} |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +sourceFile |
| 17 | + endOfFileToken: endOfFile |
| 18 | + statements: |
| 19 | + codeBlockItem |
| 20 | + item: |
| 21 | + classDecl |
| 22 | + attributes: |
| 23 | + name: identifier "Base" |
| 24 | + memberBlock: |
| 25 | + memberBlock |
| 26 | + leftBrace: { |
| 27 | + rightBrace: } |
| 28 | + members: |
| 29 | + memberBlockItem |
| 30 | + decl: |
| 31 | + variableDecl |
| 32 | + attributes: |
| 33 | + modifiers: |
| 34 | + bindingSpecifier: var |
| 35 | + bindings: |
| 36 | + patternBinding |
| 37 | + initializer: |
| 38 | + initializerClause |
| 39 | + equal: = |
| 40 | + value: |
| 41 | + integerLiteralExpr |
| 42 | + literal: integerLiteral "0" |
| 43 | + pattern: |
| 44 | + identifierPattern |
| 45 | + identifier: identifier "value" |
| 46 | + memberBlockItem |
| 47 | + decl: |
| 48 | + functionDecl |
| 49 | + attributes: |
| 50 | + body: |
| 51 | + codeBlock |
| 52 | + leftBrace: { |
| 53 | + rightBrace: } |
| 54 | + statements: |
| 55 | + name: identifier "update" |
| 56 | + modifiers: |
| 57 | + signature: |
| 58 | + functionSignature |
| 59 | + parameterClause: |
| 60 | + functionParameterClause |
| 61 | + leftParen: ( |
| 62 | + rightParen: ) |
| 63 | + parameters: |
| 64 | + funcKeyword: func |
| 65 | + modifiers: |
| 66 | + classKeyword: class |
| 67 | + codeBlockItem |
| 68 | + item: |
| 69 | + classDecl |
| 70 | + attributes: |
| 71 | + name: identifier "Derived" |
| 72 | + inheritanceClause: |
| 73 | + inheritanceClause |
| 74 | + colon: : |
| 75 | + inheritedTypes: |
| 76 | + inheritedType |
| 77 | + type: |
| 78 | + identifierType |
| 79 | + name: identifier "Base" |
| 80 | + memberBlock: |
| 81 | + memberBlock |
| 82 | + leftBrace: { |
| 83 | + rightBrace: } |
| 84 | + members: |
| 85 | + memberBlockItem |
| 86 | + decl: |
| 87 | + functionDecl |
| 88 | + attributes: |
| 89 | + body: |
| 90 | + codeBlock |
| 91 | + leftBrace: { |
| 92 | + rightBrace: } |
| 93 | + statements: |
| 94 | + codeBlockItem |
| 95 | + item: |
| 96 | + infixOperatorExpr |
| 97 | + operator: |
| 98 | + assignmentExpr |
| 99 | + equal: = |
| 100 | + leftOperand: |
| 101 | + discardAssignmentExpr |
| 102 | + wildcard: _ |
| 103 | + rightOperand: |
| 104 | + memberAccessExpr |
| 105 | + period: . |
| 106 | + declName: |
| 107 | + declReferenceExpr |
| 108 | + baseName: identifier "value" |
| 109 | + base: |
| 110 | + superExpr |
| 111 | + superKeyword: super |
| 112 | + codeBlockItem |
| 113 | + item: |
| 114 | + functionCallExpr |
| 115 | + leftParen: ( |
| 116 | + rightParen: ) |
| 117 | + arguments: |
| 118 | + additionalTrailingClosures: |
| 119 | + calledExpression: |
| 120 | + memberAccessExpr |
| 121 | + period: . |
| 122 | + declName: |
| 123 | + declReferenceExpr |
| 124 | + baseName: identifier "update" |
| 125 | + base: |
| 126 | + superExpr |
| 127 | + superKeyword: super |
| 128 | + name: identifier "update" |
| 129 | + modifiers: |
| 130 | + declModifier |
| 131 | + name: override |
| 132 | + signature: |
| 133 | + functionSignature |
| 134 | + parameterClause: |
| 135 | + functionParameterClause |
| 136 | + leftParen: ( |
| 137 | + rightParen: ) |
| 138 | + parameters: |
| 139 | + funcKeyword: func |
| 140 | + modifiers: |
| 141 | + classKeyword: class |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +top_level source="⟨body⟩" |
| 146 | + body: |
| 147 | + block source="⟨stmt⟩\n\n⟨stmt⟩" |
| 148 | + stmt: |
| 149 | + class_like_declaration source="⟨modifier⟩ ⟨name_node⟩ {\n ⟨member⟩\n\n ⟨member⟩\n}" |
| 150 | + modifier: modifier "class" source="class" |
| 151 | + name_node: identifier "Base" source="Base" |
| 152 | + member: |
| 153 | + variable_declaration source="⟨modifier⟩ ⟨pattern⟩ = ⟨value⟩" |
| 154 | + modifier: modifier "var" source="var" |
| 155 | + pattern: identifier "value" source="value" |
| 156 | + value: int_literal "0" source="0" |
| 157 | + function_declaration source="⟨body⟩⟨name_node⟩" |
| 158 | + name_node: identifier "update" source="update" |
| 159 | + body: block "func update() {}" source="func update() {}" |
| 160 | + class_like_declaration source="⟨modifier⟩⟨base_type⟩⟨name_node⟩⟨member⟩" |
| 161 | + modifier: modifier "class" source="class" |
| 162 | + name_node: identifier "Derived" source="Derived" |
| 163 | + base_type: |
| 164 | + base_type source="class Derived: ⟨type⟩ {\n override func update() {\n _ = super.value\n super.update()\n }\n}" |
| 165 | + type: identifier "Base" source="Base" |
| 166 | + member: |
| 167 | + function_declaration source="⟨modifier⟩⟨body⟩⟨name_node⟩" |
| 168 | + modifier: modifier "override" source="override" |
| 169 | + name_node: identifier "update" source="update" |
| 170 | + body: |
| 171 | + block source="override func update() {\n ⟨stmt⟩\n ⟨stmt⟩\n }" |
| 172 | + stmt: |
| 173 | + binary_expr source="⟨left⟩ ⟨operator⟩ ⟨right⟩" |
| 174 | + left: identifier "_" source="_" |
| 175 | + operator: infix_operator "=" source="=" |
| 176 | + right: |
| 177 | + member_access_expr source="⟨base⟩.⟨member_name_node⟩" |
| 178 | + base: super_expr "super" source="super" |
| 179 | + member_name_node: identifier "value" source="value" |
| 180 | + call_expr source="⟨callee⟩()" |
| 181 | + callee: |
| 182 | + member_access_expr source="⟨base⟩.⟨member_name_node⟩" |
| 183 | + base: super_expr "super" source="super" |
| 184 | + member_name_node: identifier "update" source="update" |
0 commit comments