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 #include "vm/kernel.h" | 5 #include "vm/kernel.h" |
6 | 6 |
7 #if !defined(DART_PRECOMPILED_RUNTIME) | 7 #if !defined(DART_PRECOMPILED_RUNTIME) |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 namespace kernel { | 10 namespace kernel { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 | 237 |
238 void LocalInitializer::VisitChildren(Visitor* visitor) { | 238 void LocalInitializer::VisitChildren(Visitor* visitor) { |
239 visitor->VisitVariableDeclaration(variable()); | 239 visitor->VisitVariableDeclaration(variable()); |
240 } | 240 } |
241 | 241 |
242 | 242 |
243 FunctionNode::~FunctionNode() {} | 243 FunctionNode::~FunctionNode() {} |
244 | 244 |
245 | 245 |
| 246 void FunctionNode::ReplaceBody(Statement* body) { |
| 247 delete body_; |
| 248 // Use static_cast to invoke the conversion function and so avoid triggering |
| 249 // ASSERT(pointer_ == NULL) in operator= when overwriting a non-NULL body. |
| 250 static_cast<Statement*&>(body_) = body; |
| 251 } |
| 252 |
| 253 |
246 void FunctionNode::AcceptTreeVisitor(TreeVisitor* visitor) { | 254 void FunctionNode::AcceptTreeVisitor(TreeVisitor* visitor) { |
247 visitor->VisitFunctionNode(this); | 255 visitor->VisitFunctionNode(this); |
248 } | 256 } |
249 | 257 |
250 | 258 |
251 void FunctionNode::VisitChildren(Visitor* visitor) { | 259 void FunctionNode::VisitChildren(Visitor* visitor) { |
252 VisitList(&type_parameters(), visitor); | 260 VisitList(&type_parameters(), visitor); |
253 VisitList(&positional_parameters(), visitor); | 261 VisitList(&positional_parameters(), visitor); |
254 VisitList(&named_parameters(), visitor); | 262 VisitList(&named_parameters(), visitor); |
255 if (return_type() != NULL) return_type()->AcceptDartTypeVisitor(visitor); | 263 if (return_type() != NULL) return_type()->AcceptDartTypeVisitor(visitor); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 | 1283 |
1276 void Program::VisitChildren(Visitor* visitor) { | 1284 void Program::VisitChildren(Visitor* visitor) { |
1277 VisitList(&libraries(), visitor); | 1285 VisitList(&libraries(), visitor); |
1278 } | 1286 } |
1279 | 1287 |
1280 | 1288 |
1281 } // namespace kernel | 1289 } // namespace kernel |
1282 | 1290 |
1283 } // namespace dart | 1291 } // namespace dart |
1284 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1292 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |