Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of analyzer; | 4 |
|
scheglov
2013/05/09 01:26:46
Missing "library" directive?
| |
| 5 import 'dart:async'; | |
| 6 import 'dart:io'; | |
| 7 | |
| 8 import 'generated/java_io.dart'; | |
| 9 import 'generated/engine.dart'; | |
| 10 import 'generated/error.dart'; | |
| 11 import 'generated/source_io.dart'; | |
| 12 import 'generated/sdk.dart'; | |
| 13 import 'generated/sdk_io.dart'; | |
| 14 import 'generated/ast.dart'; | |
| 15 import 'generated/element.dart'; | |
| 16 import '../options.dart'; | |
| 5 | 17 |
| 6 /// Analyzes single library [File]. | 18 /// Analyzes single library [File]. |
| 7 class _AnalyzerImpl { | 19 class AnalyzerImpl { |
| 8 final CommandLineOptions options; | 20 final CommandLineOptions options; |
| 9 DartSdk sdk; | 21 DartSdk sdk; |
| 10 | 22 |
| 11 ContentCache contentCache = new ContentCache(); | 23 ContentCache contentCache = new ContentCache(); |
| 12 SourceFactory sourceFactory; | 24 SourceFactory sourceFactory; |
| 13 AnalysisContext context; | 25 AnalysisContext context; |
| 14 | 26 |
| 15 /// All [Source]s references by the analyzed library. | 27 /// All [Source]s references by the analyzed library. |
| 16 final Set<Source> sources = new Set<Source>(); | 28 final Set<Source> sources = new Set<Source>(); |
| 17 | 29 |
| 18 /// All [AnalysisErrorInfo]s in the analyzed library. | 30 /// All [AnalysisErrorInfo]s in the analyzed library. |
| 19 final List<AnalysisErrorInfo> errorInfos = new List<AnalysisErrorInfo>(); | 31 final List<AnalysisErrorInfo> errorInfos = new List<AnalysisErrorInfo>(); |
| 20 | 32 |
| 21 _AnalyzerImpl(CommandLineOptions this.options) { | 33 AnalyzerImpl(CommandLineOptions this.options) { |
| 22 sdk = new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); | 34 sdk = new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); |
| 23 } | 35 } |
| 24 | 36 |
| 25 /** | 37 /** |
| 26 * Treats the [sourcePath] as the top level library and analyzes it. | 38 * Treats the [sourcePath] as the top level library and analyzes it. |
| 27 */ | 39 */ |
| 28 void analyze(String sourcePath) { | 40 void analyze(String sourcePath) { |
| 29 sources.clear(); | 41 sources.clear(); |
| 30 errorInfos.clear(); | 42 errorInfos.clear(); |
| 31 if (sourcePath == null) { | 43 if (sourcePath == null) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 | 137 |
| 126 static JavaFile getPackageDirectoryFor(JavaFile sourceFile) { | 138 static JavaFile getPackageDirectoryFor(JavaFile sourceFile) { |
| 127 JavaFile sourceFolder = sourceFile.getParentFile(); | 139 JavaFile sourceFolder = sourceFile.getParentFile(); |
| 128 JavaFile packagesFolder = new JavaFile.relative(sourceFolder, "packages"); | 140 JavaFile packagesFolder = new JavaFile.relative(sourceFolder, "packages"); |
| 129 if (packagesFolder.exists()) { | 141 if (packagesFolder.exists()) { |
| 130 return packagesFolder; | 142 return packagesFolder; |
| 131 } | 143 } |
| 132 return null; | 144 return null; |
| 133 } | 145 } |
| 134 } | 146 } |
| OLD | NEW |