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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 Statement body; | 1250 Statement body; |
1251 | 1251 |
1252 FunctionNode(this.body, | 1252 FunctionNode(this.body, |
1253 {List<TypeParameter> typeParameters, | 1253 {List<TypeParameter> typeParameters, |
1254 List<VariableDeclaration> positionalParameters, | 1254 List<VariableDeclaration> positionalParameters, |
1255 List<VariableDeclaration> namedParameters, | 1255 List<VariableDeclaration> namedParameters, |
1256 int requiredParameterCount, | 1256 int requiredParameterCount, |
1257 this.returnType: const DynamicType(), | 1257 this.returnType: const DynamicType(), |
1258 this.inferredReturnValue, | 1258 this.inferredReturnValue, |
1259 this.asyncMarker: AsyncMarker.Sync, | 1259 this.asyncMarker: AsyncMarker.Sync, |
1260 this.dartAsyncMarker: AsyncMarker.Sync}) | 1260 this.dartAsyncMarker}) |
1261 : this.positionalParameters = | 1261 : this.positionalParameters = |
1262 positionalParameters ?? <VariableDeclaration>[], | 1262 positionalParameters ?? <VariableDeclaration>[], |
1263 this.requiredParameterCount = | 1263 this.requiredParameterCount = |
1264 requiredParameterCount ?? positionalParameters?.length ?? 0, | 1264 requiredParameterCount ?? positionalParameters?.length ?? 0, |
1265 this.namedParameters = namedParameters ?? <VariableDeclaration>[], | 1265 this.namedParameters = namedParameters ?? <VariableDeclaration>[], |
1266 this.typeParameters = typeParameters ?? <TypeParameter>[] { | 1266 this.typeParameters = typeParameters ?? <TypeParameter>[] { |
1267 assert(returnType != null); | 1267 assert(returnType != null); |
1268 setParents(this.typeParameters, this); | 1268 setParents(this.typeParameters, this); |
1269 setParents(this.positionalParameters, this); | 1269 setParents(this.positionalParameters, this); |
1270 setParents(this.namedParameters, this); | 1270 setParents(this.namedParameters, this); |
1271 body?.parent = this; | 1271 body?.parent = this; |
| 1272 dartAsyncMarker ??= asyncMarker; |
1272 } | 1273 } |
1273 | 1274 |
1274 static DartType _getTypeOfVariable(VariableDeclaration node) => node.type; | 1275 static DartType _getTypeOfVariable(VariableDeclaration node) => node.type; |
1275 | 1276 |
1276 static NamedType _getNamedTypeOfVariable(VariableDeclaration node) { | 1277 static NamedType _getNamedTypeOfVariable(VariableDeclaration node) { |
1277 return new NamedType(node.name, node.type); | 1278 return new NamedType(node.name, node.type); |
1278 } | 1279 } |
1279 | 1280 |
1280 FunctionType get functionType { | 1281 FunctionType get functionType { |
1281 TreeNode parent = this.parent; | 1282 TreeNode parent = this.parent; |
(...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4024 /// library has not been assigned a canonical name yet. | 4025 /// library has not been assigned a canonical name yet. |
4025 /// | 4026 /// |
4026 /// Returns `null` if the library is `null`. | 4027 /// Returns `null` if the library is `null`. |
4027 CanonicalName getCanonicalNameOfLibrary(Library library) { | 4028 CanonicalName getCanonicalNameOfLibrary(Library library) { |
4028 if (library == null) return null; | 4029 if (library == null) return null; |
4029 if (library.canonicalName == null) { | 4030 if (library.canonicalName == null) { |
4030 throw '$library has no canonical name'; | 4031 throw '$library has no canonical name'; |
4031 } | 4032 } |
4032 return library.canonicalName; | 4033 return library.canonicalName; |
4033 } | 4034 } |
OLD | NEW |