| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' show PrimitiveConstantValue; | 8 import '../constants/values.dart' show PrimitiveConstantValue; |
| 9 import '../dart_backend/dart_backend.dart' show DartBackend; | 9 import '../dart_backend/dart_backend.dart' show DartBackend; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 _current = null; | 533 _current = null; |
| 534 } | 534 } |
| 535 | 535 |
| 536 /// Create a [ir.FunctionDefinition] for [element] using [_root] as the body. | 536 /// Create a [ir.FunctionDefinition] for [element] using [_root] as the body. |
| 537 /// | 537 /// |
| 538 /// Parameters must be created before the construction of the body using | 538 /// Parameters must be created before the construction of the body using |
| 539 /// [createParameter]. | 539 /// [createParameter]. |
| 540 ir.FunctionDefinition buildFunctionDefinition( | 540 ir.FunctionDefinition buildFunctionDefinition( |
| 541 FunctionElement element, | 541 FunctionElement element, |
| 542 List<ConstantExpression> defaults) { | 542 List<ConstantExpression> defaults) { |
| 543 if (!element.isAbstract) { | 543 if (element.isAbstract || element.isExternal) { |
| 544 _ensureReturn(); | |
| 545 return new ir.FunctionDefinition( | |
| 546 element, state.returnContinuation, _parameters, _root, | |
| 547 state.localConstants, defaults); | |
| 548 } else { | |
| 549 assert(invariant(element, _root == null, | 544 assert(invariant(element, _root == null, |
| 550 message: "Non-empty body for abstract method $element: $_root")); | 545 message: "Non-empty body for abstract method $element: $_root")); |
| 551 assert(invariant(element, state.localConstants.isEmpty, | 546 assert(invariant(element, state.localConstants.isEmpty, |
| 552 message: "Local constants for abstract method $element: " | 547 message: "Local constants for abstract method $element: " |
| 553 "${state.localConstants}")); | 548 "${state.localConstants}")); |
| 554 return new ir.FunctionDefinition.abstract( | 549 return new ir.FunctionDefinition.abstract( |
| 555 element, _parameters, defaults); | 550 element, _parameters, defaults); |
| 551 } else { |
| 552 _ensureReturn(); |
| 553 return new ir.FunctionDefinition( |
| 554 element, state.returnContinuation, _parameters, _root, |
| 555 state.localConstants, defaults); |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 /// Create a super invocation where the method name and the argument structure | 559 /// Create a super invocation where the method name and the argument structure |
| 560 /// are defined by [selector] and the argument values are defined by | 560 /// are defined by [selector] and the argument values are defined by |
| 561 /// [arguments]. | 561 /// [arguments]. |
| 562 ir.Primitive buildSuperInvocation(Selector selector, | 562 ir.Primitive buildSuperInvocation(Selector selector, |
| 563 List<ir.Primitive> arguments) { | 563 List<ir.Primitive> arguments) { |
| 564 return _buildInvokeSuper(selector, arguments); | 564 return _buildInvokeSuper(selector, arguments); |
| 565 } | 565 } |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 index = 0; | 1454 index = 0; |
| 1455 for (int i = 0; i < environment.length; ++i) { | 1455 for (int i = 0; i < environment.length; ++i) { |
| 1456 if (common[i] == null) { | 1456 if (common[i] == null) { |
| 1457 environment.index2value[i] = parameters[index++]; | 1457 environment.index2value[i] = parameters[index++]; |
| 1458 } | 1458 } |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 return join; | 1461 return join; |
| 1462 } | 1462 } |
| 1463 } | 1463 } |
| OLD | NEW |