OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// This file declares a "shadow hierarchy" of concrete classes which extend | 5 /// This file declares a "shadow hierarchy" of concrete classes which extend |
6 /// the kernel class hierarchy, adding methods and fields needed by the | 6 /// the kernel class hierarchy, adding methods and fields needed by the |
7 /// BodyBuilder. | 7 /// BodyBuilder. |
8 /// | 8 /// |
9 /// Instances of these classes may be created using the factory methods in | 9 /// Instances of these classes may be created using the factory methods in |
10 /// `ast_factory.dart`. | 10 /// `ast_factory.dart`. |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 } | 1511 } |
1512 | 1512 |
1513 static MethodNode getMethodNode(Procedure procedure) { | 1513 static MethodNode getMethodNode(Procedure procedure) { |
1514 if (procedure is KernelProcedure) return procedure._methodNode; | 1514 if (procedure is KernelProcedure) return procedure._methodNode; |
1515 return null; | 1515 return null; |
1516 } | 1516 } |
1517 | 1517 |
1518 static bool hasImplicitReturnType(KernelProcedure procedure) { | 1518 static bool hasImplicitReturnType(KernelProcedure procedure) { |
1519 return procedure._hasImplicitReturnType; | 1519 return procedure._hasImplicitReturnType; |
1520 } | 1520 } |
| 1521 |
| 1522 static void inferSetterReturnType( |
| 1523 KernelProcedure procedure, TypeInferenceEngineImpl engine, String uri) { |
| 1524 assert(procedure.isSetter); |
| 1525 if (procedure._hasImplicitReturnType) { |
| 1526 var inferredType = const VoidType(); |
| 1527 engine.instrumentation?.record(Uri.parse(uri), procedure.fileOffset, |
| 1528 'topType', new InstrumentationValueForType(inferredType)); |
| 1529 procedure.function?.returnType = inferredType; |
| 1530 } |
| 1531 } |
1521 } | 1532 } |
1522 | 1533 |
1523 /// Concrete shadow object representing an assignment to a property. | 1534 /// Concrete shadow object representing an assignment to a property. |
1524 class KernelPropertyAssign extends KernelComplexAssignmentWithReceiver { | 1535 class KernelPropertyAssign extends KernelComplexAssignmentWithReceiver { |
1525 /// If this assignment uses null-aware access (`?.`), the conditional | 1536 /// If this assignment uses null-aware access (`?.`), the conditional |
1526 /// expression that guards the access; otherwise `null`. | 1537 /// expression that guards the access; otherwise `null`. |
1527 Expression nullAwareGuard; | 1538 Expression nullAwareGuard; |
1528 | 1539 |
1529 KernelPropertyAssign(Expression receiver, Expression rhs, | 1540 KernelPropertyAssign(Expression receiver, Expression rhs, |
1530 {bool isSuper: false}) | 1541 {bool isSuper: false}) |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2304 } | 2315 } |
2305 | 2316 |
2306 transformChildren(v) { | 2317 transformChildren(v) { |
2307 return internalError("Internal error: Unsupported operation."); | 2318 return internalError("Internal error: Unsupported operation."); |
2308 } | 2319 } |
2309 | 2320 |
2310 visitChildren(v) { | 2321 visitChildren(v) { |
2311 return internalError("Internal error: Unsupported operation."); | 2322 return internalError("Internal error: Unsupported operation."); |
2312 } | 2323 } |
2313 } | 2324 } |
OLD | NEW |