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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; | 6 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; |
7 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; | 7 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t"; |
8 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; | 8 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart"; |
9 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; | 9 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart"; |
10 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; | 10 import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart"; |
(...skipping 21 matching lines...) Expand all Loading... |
32 super.reportError(node, errorCode, arguments); | 32 super.reportError(node, errorCode, arguments); |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 testErrorHandling() { | 36 testErrorHandling() { |
37 // Test that compiler.currentElement is set correctly when | 37 // Test that compiler.currentElement is set correctly when |
38 // reporting errors/warnings. | 38 // reporting errors/warnings. |
39 CallbackMockCompiler compiler = new CallbackMockCompiler(); | 39 CallbackMockCompiler compiler = new CallbackMockCompiler(); |
40 ResolverVisitor visitor = compiler.resolverVisitor(); | 40 ResolverVisitor visitor = compiler.resolverVisitor(); |
41 compiler.parseScript('NoSuchPrefix.NoSuchType foo() {}'); | 41 compiler.parseScript('NoSuchPrefix.NoSuchType foo() {}'); |
42 FunctionElement foo = compiler.mainApp.find(buildSourceString('foo')); | 42 FunctionElement foo = compiler.mainApp.find('foo'); |
43 compiler.setOnWarning( | 43 compiler.setOnWarning( |
44 (c, n, m) => Expect.equals(foo, compiler.currentElement)); | 44 (c, n, m) => Expect.equals(foo, compiler.currentElement)); |
45 foo.computeType(compiler); | 45 foo.computeType(compiler); |
46 Expect.equals(1, compiler.warnings.length); | 46 Expect.equals(1, compiler.warnings.length); |
47 } | 47 } |
48 | 48 |
49 main() { | 49 main() { |
50 testErrorHandling(); | 50 testErrorHandling(); |
51 } | 51 } |
OLD | NEW |