| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 import 'package:analyzer/src/generated/resolver.dart'; | 26 import 'package:analyzer/src/generated/resolver.dart'; |
| 27 import 'package:analyzer/src/generated/sdk.dart'; | 27 import 'package:analyzer/src/generated/sdk.dart'; |
| 28 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 28 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
| 29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
| 30 import 'package:analyzer/src/generated/static_type_analyzer.dart'; | 30 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| 31 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 31 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 32 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 32 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 34 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 34 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 35 import 'package:analyzer/src/generated/utilities_dart.dart'; | 35 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 36 import 'package:analyzer/src/task/dart.dart'; | |
| 37 import 'package:unittest/unittest.dart'; | 36 import 'package:unittest/unittest.dart'; |
| 38 | 37 |
| 39 import '../reflective_tests.dart'; | 38 import '../reflective_tests.dart'; |
| 40 import '../utils.dart'; | 39 import '../utils.dart'; |
| 41 import 'test_support.dart'; | 40 import 'test_support.dart'; |
| 42 | 41 |
| 43 main() { | 42 main() { |
| 44 initializeTestEnvironment(); | 43 initializeTestEnvironment(); |
| 45 runReflectiveTests(AnalysisDeltaTest); | 44 runReflectiveTests(AnalysisDeltaTest); |
| 46 runReflectiveTests(ChangeSetTest); | 45 runReflectiveTests(ChangeSetTest); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (asyncSource != null) { | 420 if (asyncSource != null) { |
| 422 elementMap[asyncSource] = asyncLibrary; | 421 elementMap[asyncSource] = asyncLibrary; |
| 423 } | 422 } |
| 424 elementMap[htmlSource] = htmlLibrary; | 423 elementMap[htmlSource] = htmlLibrary; |
| 425 elementMap[mathSource] = mathLibrary; | 424 elementMap[mathSource] = mathLibrary; |
| 426 // | 425 // |
| 427 // Set the public and export namespaces. We don't use exports in the fake | 426 // Set the public and export namespaces. We don't use exports in the fake |
| 428 // core library so public and export namespaces are the same. | 427 // core library so public and export namespaces are the same. |
| 429 // | 428 // |
| 430 for (LibraryElementImpl library in elementMap.values) { | 429 for (LibraryElementImpl library in elementMap.values) { |
| 431 library.exportNamespace = | 430 Namespace namespace = |
| 432 library.publicNamespace = new PublicNamespaceBuilder().build(library); | 431 new NamespaceBuilder().createPublicNamespaceForLibrary(library); |
| 432 library.exportNamespace = namespace; |
| 433 library.publicNamespace = namespace; |
| 433 } | 434 } |
| 434 context.recordLibraryElements(elementMap); | 435 context.recordLibraryElements(elementMap); |
| 435 // Create the synthetic element for `loadLibrary`. | 436 // Create the synthetic element for `loadLibrary`. |
| 436 for (LibraryElementImpl library in elementMap.values) { | 437 for (LibraryElementImpl library in elementMap.values) { |
| 437 library.createLoadLibraryFunction(context.typeProvider); | 438 library.createLoadLibraryFunction(context.typeProvider); |
| 438 } | 439 } |
| 439 return context; | 440 return context; |
| 440 } | 441 } |
| 441 } | 442 } |
| 442 | 443 |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 expect(expression.staticElement, isNull); | 1485 expect(expression.staticElement, isNull); |
| 1485 expect(expression.propagatedElement, getMethod(numType, "+")); | 1486 expect(expression.propagatedElement, getMethod(numType, "+")); |
| 1486 _listener.assertNoErrors(); | 1487 _listener.assertNoErrors(); |
| 1487 } | 1488 } |
| 1488 | 1489 |
| 1489 void test_visitBreakStatement_withLabel() { | 1490 void test_visitBreakStatement_withLabel() { |
| 1490 // loop: while (true) { | 1491 // loop: while (true) { |
| 1491 // break loop; | 1492 // break loop; |
| 1492 // } | 1493 // } |
| 1493 String label = "loop"; | 1494 String label = "loop"; |
| 1494 LabelElementImpl labelElement = | 1495 LabelElementImpl labelElement = new LabelElementImpl.forNode( |
| 1495 new LabelElementImpl.forNode(AstFactory.identifier3(label), false, false
); | 1496 AstFactory.identifier3(label), false, false); |
| 1496 BreakStatement breakStatement = AstFactory.breakStatement2(label); | 1497 BreakStatement breakStatement = AstFactory.breakStatement2(label); |
| 1497 Expression condition = AstFactory.booleanLiteral(true); | 1498 Expression condition = AstFactory.booleanLiteral(true); |
| 1498 WhileStatement whileStatement = | 1499 WhileStatement whileStatement = |
| 1499 AstFactory.whileStatement(condition, breakStatement); | 1500 AstFactory.whileStatement(condition, breakStatement); |
| 1500 expect(_resolveBreak(breakStatement, labelElement, whileStatement), | 1501 expect(_resolveBreak(breakStatement, labelElement, whileStatement), |
| 1501 same(labelElement)); | 1502 same(labelElement)); |
| 1502 expect(breakStatement.target, same(whileStatement)); | 1503 expect(breakStatement.target, same(whileStatement)); |
| 1503 _listener.assertNoErrors(); | 1504 _listener.assertNoErrors(); |
| 1504 } | 1505 } |
| 1505 | 1506 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 _resolveNode(name); | 1575 _resolveNode(name); |
| 1575 expect(name.staticElement, same(constructor)); | 1576 expect(name.staticElement, same(constructor)); |
| 1576 _listener.assertNoErrors(); | 1577 _listener.assertNoErrors(); |
| 1577 } | 1578 } |
| 1578 | 1579 |
| 1579 void test_visitContinueStatement_withLabel() { | 1580 void test_visitContinueStatement_withLabel() { |
| 1580 // loop: while (true) { | 1581 // loop: while (true) { |
| 1581 // continue loop; | 1582 // continue loop; |
| 1582 // } | 1583 // } |
| 1583 String label = "loop"; | 1584 String label = "loop"; |
| 1584 LabelElementImpl labelElement = | 1585 LabelElementImpl labelElement = new LabelElementImpl.forNode( |
| 1585 new LabelElementImpl.forNode(AstFactory.identifier3(label), false, false
); | 1586 AstFactory.identifier3(label), false, false); |
| 1586 ContinueStatement continueStatement = AstFactory.continueStatement(label); | 1587 ContinueStatement continueStatement = AstFactory.continueStatement(label); |
| 1587 Expression condition = AstFactory.booleanLiteral(true); | 1588 Expression condition = AstFactory.booleanLiteral(true); |
| 1588 WhileStatement whileStatement = | 1589 WhileStatement whileStatement = |
| 1589 AstFactory.whileStatement(condition, continueStatement); | 1590 AstFactory.whileStatement(condition, continueStatement); |
| 1590 expect(_resolveContinue(continueStatement, labelElement, whileStatement), | 1591 expect(_resolveContinue(continueStatement, labelElement, whileStatement), |
| 1591 same(labelElement)); | 1592 same(labelElement)); |
| 1592 expect(continueStatement.target, same(whileStatement)); | 1593 expect(continueStatement.target, same(whileStatement)); |
| 1593 _listener.assertNoErrors(); | 1594 _listener.assertNoErrors(); |
| 1594 } | 1595 } |
| 1595 | 1596 |
| (...skipping 15446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17042 | 17043 |
| 17043 void _resolveTestUnit(String code) { | 17044 void _resolveTestUnit(String code) { |
| 17044 testCode = code; | 17045 testCode = code; |
| 17045 testSource = addSource(testCode); | 17046 testSource = addSource(testCode); |
| 17046 LibraryElement library = resolve2(testSource); | 17047 LibraryElement library = resolve2(testSource); |
| 17047 assertNoErrors(testSource); | 17048 assertNoErrors(testSource); |
| 17048 verify([testSource]); | 17049 verify([testSource]); |
| 17049 testUnit = resolveCompilationUnit(testSource, library); | 17050 testUnit = resolveCompilationUnit(testSource, library); |
| 17050 } | 17051 } |
| 17051 } | 17052 } |
| OLD | NEW |