OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.semantics_visitor_test; | 5 library dart2js.semantics_visitor_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 Expect.isFalse(element.isErroneous, | 323 Expect.isFalse(element.isErroneous, |
324 "Element '$method' is not expected to be have parse errors in:\n" | 324 "Element '$method' is not expected to be have parse errors in:\n" |
325 "${library.compilationUnit.script.text}"); | 325 "${library.compilationUnit.script.text}"); |
326 | 326 |
327 void testAstElement(AstElement astElement) { | 327 void testAstElement(AstElement astElement) { |
328 Expect.isNotNull(astElement, "Element '$method' not found in:\n" | 328 Expect.isNotNull(astElement, "Element '$method' not found in:\n" |
329 "${library.compilationUnit.script.text}"); | 329 "${library.compilationUnit.script.text}"); |
330 ResolvedAst resolvedAst = astElement.resolvedAst; | 330 ResolvedAst resolvedAst = astElement.resolvedAst; |
331 SemanticTestVisitor visitor = createVisitor(resolvedAst.elements); | 331 SemanticTestVisitor visitor = createVisitor(resolvedAst.elements); |
332 try { | 332 try { |
333 compiler.withCurrentElement(resolvedAst.element, () { | 333 compiler.reporter.withCurrentElement(resolvedAst.element, () { |
334 //print(resolvedAst.node.toDebugString()); | 334 //print(resolvedAst.node.toDebugString()); |
335 resolvedAst.node.accept(visitor); | 335 resolvedAst.node.accept(visitor); |
336 }); | 336 }); |
337 } catch (e, s) { | 337 } catch (e, s) { |
338 Expect.fail("$e:\n$s\nIn test:\n" | 338 Expect.fail("$e:\n$s\nIn test:\n" |
339 "${library.compilationUnit.script.text}"); | 339 "${library.compilationUnit.script.text}"); |
340 } | 340 } |
341 Expect.listEquals(expectedVisits, visitor.visits, | 341 Expect.listEquals(expectedVisits, visitor.visits, |
342 "In test:\n" | 342 "In test:\n" |
343 "${library.compilationUnit.script.text}\n\n" | 343 "${library.compilationUnit.script.text}\n\n" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 ERROR_INVALID_INDEX_SET, | 751 ERROR_INVALID_INDEX_SET, |
752 ERROR_INVALID_COMPOUND_INDEX_SET, | 752 ERROR_INVALID_COMPOUND_INDEX_SET, |
753 ERROR_INVALID_INDEX_PREFIX, | 753 ERROR_INVALID_INDEX_PREFIX, |
754 ERROR_INVALID_INDEX_POSTFIX, | 754 ERROR_INVALID_INDEX_POSTFIX, |
755 | 755 |
756 VISIT_CONSTANT_GET, | 756 VISIT_CONSTANT_GET, |
757 VISIT_CONSTANT_INVOKE, | 757 VISIT_CONSTANT_INVOKE, |
758 | 758 |
759 PREVISIT_DEFERRED_ACCESS, | 759 PREVISIT_DEFERRED_ACCESS, |
760 } | 760 } |
OLD | NEW |