| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// ----------------------------------------------------------------------- | 5 /// ----------------------------------------------------------------------- |
| 6 /// ERROR HANDLING | 6 /// ERROR HANDLING |
| 7 /// ----------------------------------------------------------------------- | 7 /// ----------------------------------------------------------------------- |
| 8 /// | 8 /// |
| 9 /// As a rule of thumb, errors that can be detected statically are handled by | 9 /// As a rule of thumb, errors that can be detected statically are handled by |
| 10 /// the frontend, typically by translating the erroneous code into a 'throw' or | 10 /// the frontend, typically by translating the erroneous code into a 'throw' or |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 /// A function declares parameters and has a body. | 1143 /// A function declares parameters and has a body. |
| 1144 /// | 1144 /// |
| 1145 /// This may occur in a procedure, constructor, function expression, or local | 1145 /// This may occur in a procedure, constructor, function expression, or local |
| 1146 /// function declaration. | 1146 /// function declaration. |
| 1147 class FunctionNode extends TreeNode { | 1147 class FunctionNode extends TreeNode { |
| 1148 /// End offset in the source file it comes from. Valid values are from 0 and | 1148 /// End offset in the source file it comes from. Valid values are from 0 and |
| 1149 /// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available | 1149 /// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available |
| 1150 /// (this is the default if none is specifically set). | 1150 /// (this is the default if none is specifically set). |
| 1151 int fileEndOffset = TreeNode.noOffset; | 1151 int fileEndOffset = TreeNode.noOffset; |
| 1152 | 1152 |
| 1153 /// Kernel async marker for the function. |
| 1154 /// |
| 1155 /// See also [dartAsyncMarker]. |
| 1153 AsyncMarker asyncMarker; | 1156 AsyncMarker asyncMarker; |
| 1154 bool debuggable = true; | 1157 |
| 1158 /// Dart async marker for the function. |
| 1159 /// |
| 1160 /// See also [asyncMarker]. |
| 1161 /// |
| 1162 /// A Kernel function can represent a Dart function with a different async |
| 1163 /// marker. |
| 1164 /// |
| 1165 /// For example, when async/await is translated away, |
| 1166 /// a Dart async function might be represented by a Kernel sync function. |
| 1167 AsyncMarker dartAsyncMarker; |
| 1155 List<TypeParameter> typeParameters; | 1168 List<TypeParameter> typeParameters; |
| 1156 int requiredParameterCount; | 1169 int requiredParameterCount; |
| 1157 List<VariableDeclaration> positionalParameters; | 1170 List<VariableDeclaration> positionalParameters; |
| 1158 List<VariableDeclaration> namedParameters; | 1171 List<VariableDeclaration> namedParameters; |
| 1159 InferredValue inferredReturnValue; // May be null. | 1172 InferredValue inferredReturnValue; // May be null. |
| 1160 DartType returnType; // Not null. | 1173 DartType returnType; // Not null. |
| 1161 Statement body; | 1174 Statement body; |
| 1162 | 1175 |
| 1163 FunctionNode(this.body, | 1176 FunctionNode(this.body, |
| 1164 {List<TypeParameter> typeParameters, | 1177 {List<TypeParameter> typeParameters, |
| 1165 List<VariableDeclaration> positionalParameters, | 1178 List<VariableDeclaration> positionalParameters, |
| 1166 List<VariableDeclaration> namedParameters, | 1179 List<VariableDeclaration> namedParameters, |
| 1167 int requiredParameterCount, | 1180 int requiredParameterCount, |
| 1168 this.returnType: const DynamicType(), | 1181 this.returnType: const DynamicType(), |
| 1169 this.inferredReturnValue, | 1182 this.inferredReturnValue, |
| 1170 this.asyncMarker: AsyncMarker.Sync}) | 1183 this.asyncMarker: AsyncMarker.Sync, |
| 1184 this.dartAsyncMarker: AsyncMarker.Sync}) |
| 1171 : this.positionalParameters = | 1185 : this.positionalParameters = |
| 1172 positionalParameters ?? <VariableDeclaration>[], | 1186 positionalParameters ?? <VariableDeclaration>[], |
| 1173 this.requiredParameterCount = | 1187 this.requiredParameterCount = |
| 1174 requiredParameterCount ?? positionalParameters?.length ?? 0, | 1188 requiredParameterCount ?? positionalParameters?.length ?? 0, |
| 1175 this.namedParameters = namedParameters ?? <VariableDeclaration>[], | 1189 this.namedParameters = namedParameters ?? <VariableDeclaration>[], |
| 1176 this.typeParameters = typeParameters ?? <TypeParameter>[] { | 1190 this.typeParameters = typeParameters ?? <TypeParameter>[] { |
| 1177 assert(returnType != null); | 1191 assert(returnType != null); |
| 1178 setParents(this.typeParameters, this); | 1192 setParents(this.typeParameters, this); |
| 1179 setParents(this.positionalParameters, this); | 1193 setParents(this.positionalParameters, this); |
| 1180 setParents(this.namedParameters, this); | 1194 setParents(this.namedParameters, this); |
| (...skipping 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3745 } | 3759 } |
| 3746 } | 3760 } |
| 3747 } | 3761 } |
| 3748 | 3762 |
| 3749 class Source { | 3763 class Source { |
| 3750 final List<int> lineStarts; | 3764 final List<int> lineStarts; |
| 3751 final String source; | 3765 final String source; |
| 3752 | 3766 |
| 3753 Source(this.lineStarts, this.source); | 3767 Source(this.lineStarts, this.source); |
| 3754 } | 3768 } |
| OLD | NEW |