| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.summary.summarize_ast_test; | 5 library analyzer.test.src.summary.summarize_ast_test; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/parser.dart'; | 10 import 'package:analyzer/src/generated/parser.dart'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 if (namespace == null && !allowMissingFiles) { | 86 if (namespace == null && !allowMissingFiles) { |
| 87 fail('Prelinker unexpectedly requested namespace for "$relativeUri"' | 87 fail('Prelinker unexpectedly requested namespace for "$relativeUri"' |
| 88 ' (resolves to "$absoluteUri").' | 88 ' (resolves to "$absoluteUri").' |
| 89 ' Namespaces available: ${uriToUnit.keys}'); | 89 ' Namespaces available: ${uriToUnit.keys}'); |
| 90 } | 90 } |
| 91 return namespace; | 91 return namespace; |
| 92 } | 92 } |
| 93 linked = new LinkedLibrary.fromBuffer( | 93 linked = new LinkedLibrary.fromBuffer( |
| 94 prelink(definingUnit, getPart, getImport).toBuffer()); | 94 prelink(definingUnit, getPart, getImport).toBuffer()); |
| 95 validateLinkedLibrary(linked); |
| 95 unlinkedUnits = <UnlinkedUnit>[definingUnit]; | 96 unlinkedUnits = <UnlinkedUnit>[definingUnit]; |
| 96 for (String relativeUri in definingUnit.publicNamespace.parts) { | 97 for (String relativeUri in definingUnit.publicNamespace.parts) { |
| 97 UnlinkedUnit unit = uriToUnit[resolveToAbsoluteUri(relativeUri)]; | 98 UnlinkedUnit unit = uriToUnit[resolveToAbsoluteUri(relativeUri)]; |
| 98 if (unit == null) { | 99 if (unit == null) { |
| 99 if (!allowMissingFiles) { | 100 if (!allowMissingFiles) { |
| 100 fail('Test referred to unknown unit $relativeUri'); | 101 fail('Test referred to unknown unit $relativeUri'); |
| 101 } | 102 } |
| 102 } else { | 103 } else { |
| 103 unlinkedUnits.add(unit); | 104 unlinkedUnits.add(unit); |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 CompilationUnit _parseText(String text) { | 109 CompilationUnit _parseText(String text) { |
| 109 CharSequenceReader reader = new CharSequenceReader(text); | 110 CharSequenceReader reader = new CharSequenceReader(text); |
| 110 Scanner scanner = | 111 Scanner scanner = |
| 111 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); | 112 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); |
| 112 Token token = scanner.tokenize(); | 113 Token token = scanner.tokenize(); |
| 113 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); | 114 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); |
| 114 parser.parseGenericMethods = true; | 115 parser.parseGenericMethods = true; |
| 115 return parser.parseCompilationUnit(token); | 116 return parser.parseCompilationUnit(token); |
| 116 } | 117 } |
| 117 } | 118 } |
| OLD | NEW |