| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import "../../../lib/compiler/implementation/dart2jslib.dart"; | 5 import "../../../lib/compiler/implementation/dart2jslib.dart"; |
| 6 import "../../../lib/compiler/implementation/elements/elements.dart"; | 6 import "../../../lib/compiler/implementation/elements/elements.dart"; |
| 7 import "../../../lib/compiler/implementation/tree/tree.dart"; | 7 import "../../../lib/compiler/implementation/tree/tree.dart"; |
| 8 import "../../../lib/compiler/implementation/util/util.dart"; | 8 import "../../../lib/compiler/implementation/util/util.dart"; |
| 9 import "mock_compiler.dart"; | 9 import "mock_compiler.dart"; |
| 10 import "parser_helper.dart"; | 10 import "parser_helper.dart"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 Expect.isNotNull(node.body); | 27 Expect.isNotNull(node.body); |
| 28 // If the element has a body it is either a Block or a Return statement, | 28 // If the element has a body it is either a Block or a Return statement, |
| 29 // both with different begin and end tokens. | 29 // both with different begin and end tokens. |
| 30 Expect.isTrue(node.body is Block || node.body is Return); | 30 Expect.isTrue(node.body is Block || node.body is Return); |
| 31 Expect.notEquals(node.body.getBeginToken(), node.body.getEndToken()); | 31 Expect.notEquals(node.body.getBeginToken(), node.body.getEndToken()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void expectHasNoBody(compiler, Element element) { | 34 void expectHasNoBody(compiler, Element element) { |
| 35 var node = element.parseNode(compiler); | 35 var node = element.parseNode(compiler); |
| 36 Expect.isNotNull(node, "Element isn't parseable, when a body was expected"); | 36 Expect.isNotNull(node, "Element isn't parseable, when a body was expected"); |
| 37 Expect.isNotNull(node.body); | 37 Expect.isFalse(node.hasBody()); |
| 38 // If the element has no body it is a Block with identical begin and end | |
| 39 // tokens (the semicolon). | |
| 40 Expect.isTrue(node.body is Block); | |
| 41 Expect.identical(node.body.getBeginToken(), node.body.getEndToken()); | |
| 42 } | 38 } |
| 43 | 39 |
| 44 Element ensure(compiler, | 40 Element ensure(compiler, |
| 45 String name, | 41 String name, |
| 46 Element lookup(name), | 42 Element lookup(name), |
| 47 {bool isPatched: false, | 43 {bool isPatched: false, |
| 48 bool isPatch: false, | 44 bool isPatch: false, |
| 49 bool isMethod: true, | 45 bool isMethod: true, |
| 50 bool isGetter: false, | 46 bool isGetter: false, |
| 51 bool isFound: true}) { | 47 bool isFound: true}) { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 357 |
| 362 main() { | 358 main() { |
| 363 testPatchFunction(); | 359 testPatchFunction(); |
| 364 testPatchMember(); | 360 testPatchMember(); |
| 365 testPatchGetter(); | 361 testPatchGetter(); |
| 366 testRegularMember(); | 362 testRegularMember(); |
| 367 testGhostMember(); | 363 testGhostMember(); |
| 368 testInjectFunction(); | 364 testInjectFunction(); |
| 369 testPatchSignatureCheck(); | 365 testPatchSignatureCheck(); |
| 370 } | 366 } |
| OLD | NEW |