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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 compiler.withCurrentElement(resolvedAst.element, () { | 332 compiler.withCurrentElement(resolvedAst.element, () { |
333 //print(resolvedAst.node.toDebugString()); | 333 //print(resolvedAst.node.toDebugString()); |
334 resolvedAst.node.accept(visitor); | 334 resolvedAst.node.accept(visitor); |
335 }); | 335 }); |
336 } catch (e, s) { | 336 } catch (e, s) { |
337 Expect.fail("$e:\n$s\nIn test:\n" | 337 Expect.fail("$e:\n$s\nIn test:\n" |
338 "${library.compilationUnit.script.text}"); | 338 "${library.compilationUnit.script.text}"); |
339 } | 339 } |
340 Expect.listEquals(expectedVisits, visitor.visits, | 340 Expect.listEquals(expectedVisits, visitor.visits, |
341 "In test:\n" | 341 "In test:\n" |
342 "${library.compilationUnit.script.text}\n\n" | 342 "${library.compilationUnit.script.text}"); |
343 "Expected: $expectedVisits\n" | |
344 "Found: ${visitor.visits}"); | |
345 unvisitedKinds.removeAll(visitor.visits.map((visit) => visit.method)); | 343 unvisitedKinds.removeAll(visitor.visits.map((visit) => visit.method)); |
346 } | 344 } |
347 if (element.isAbstractField) { | 345 if (element.isAbstractField) { |
348 AbstractFieldElement abstractFieldElement = element; | 346 AbstractFieldElement abstractFieldElement = element; |
349 if (abstractFieldElement.getter != null) { | 347 if (abstractFieldElement.getter != null) { |
350 testAstElement(abstractFieldElement.getter); | 348 testAstElement(abstractFieldElement.getter); |
351 } else if (abstractFieldElement.setter != null) { | 349 } else if (abstractFieldElement.setter != null) { |
352 testAstElement(abstractFieldElement.setter); | 350 testAstElement(abstractFieldElement.setter); |
353 } | 351 } |
354 } else { | 352 } else { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_PREFIX, | 695 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_PREFIX, |
698 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_POSTFIX, | 696 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_POSTFIX, |
699 | 697 |
700 ERROR_INVALID_ASSERT, | 698 ERROR_INVALID_ASSERT, |
701 ERROR_UNDEFINED_UNARY_EXPRESSION, | 699 ERROR_UNDEFINED_UNARY_EXPRESSION, |
702 ERROR_UNDEFINED_BINARY_EXPRESSION, | 700 ERROR_UNDEFINED_BINARY_EXPRESSION, |
703 | 701 |
704 VISIT_CONSTANT_GET, | 702 VISIT_CONSTANT_GET, |
705 VISIT_CONSTANT_INVOKE, | 703 VISIT_CONSTANT_INVOKE, |
706 } | 704 } |
OLD | NEW |