| 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/leg.dart"); | 5 #import("../../../lib/compiler/implementation/leg.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 """); | 66 """); |
| 67 var container = ensure(compiler, "Class", compiler.coreLibrary.find); | 67 var container = ensure(compiler, "Class", compiler.coreLibrary.find); |
| 68 container.parseNode(compiler); | 68 container.parseNode(compiler); |
| 69 ensure(compiler, "toString", container.lookupLocalMember, hasBody:true); | 69 ensure(compiler, "toString", container.lookupLocalMember, hasBody:true); |
| 70 } | 70 } |
| 71 | 71 |
| 72 testPatchGetter() { | 72 testPatchGetter() { |
| 73 var compiler = applyPatch( | 73 var compiler = applyPatch( |
| 74 """ | 74 """ |
| 75 class Class { | 75 class Class { |
| 76 external int get field(); | 76 external int get field; |
| 77 } | 77 } |
| 78 """, | 78 """, |
| 79 """ | 79 """ |
| 80 patch class Class { | 80 patch class Class { |
| 81 patch int get field() => 5; | 81 patch int get field => 5; |
| 82 } | 82 } |
| 83 """); | 83 """); |
| 84 var container = ensure(compiler, "Class", compiler.coreLibrary.find); | 84 var container = ensure(compiler, "Class", compiler.coreLibrary.find); |
| 85 container.parseNode(compiler); | 85 container.parseNode(compiler); |
| 86 ensure(compiler, | 86 ensure(compiler, |
| 87 "field", | 87 "field", |
| 88 container.lookupLocalMember, | 88 container.lookupLocalMember, |
| 89 isGetter: true, | 89 isGetter: true, |
| 90 hasBody: true); | 90 hasBody: true); |
| 91 } | 91 } |
| 92 | 92 |
| 93 testInjectFunction() { | 93 testInjectFunction() { |
| 94 var compiler = applyPatch( | 94 var compiler = applyPatch( |
| 95 "", | 95 "", |
| 96 "int _function() => 5;"); | 96 "int _function() => 5;"); |
| 97 ensure(compiler, | 97 ensure(compiler, |
| 98 "_function", | 98 "_function", |
| 99 compiler.coreLibrary.find, | 99 compiler.coreLibrary.find, |
| 100 hasBody: true, | 100 hasBody: true, |
| 101 isPatched: false); | 101 isPatched: false); |
| 102 } | 102 } |
| 103 | 103 |
| 104 main() { | 104 main() { |
| 105 testPatchFunction(); | 105 testPatchFunction(); |
| 106 testPatchMember(); | 106 testPatchMember(); |
| 107 testPatchGetter(); | 107 testPatchGetter(); |
| 108 testInjectFunction(); | 108 testInjectFunction(); |
| 109 } | 109 } |
| OLD | NEW |