Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: pkg/analyzer/lib/src/analyzer_impl.dart

Issue 184893003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4
5 library analyzer_impl; 5 library analyzer_impl;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as pathos; 9 import 'package:path/path.dart' as pathos;
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 * Treats the [sourcePath] as the top level library and analyzes it. 45 * Treats the [sourcePath] as the top level library and analyzes it.
46 */ 46 */
47 void analyze(String sourcePath) { 47 void analyze(String sourcePath) {
48 sources.clear(); 48 sources.clear();
49 errorInfos.clear(); 49 errorInfos.clear();
50 if (sourcePath == null) { 50 if (sourcePath == null) {
51 throw new ArgumentError("sourcePath cannot be null"); 51 throw new ArgumentError("sourcePath cannot be null");
52 } 52 }
53 var sourceFile = new JavaFile(sourcePath); 53 var sourceFile = new JavaFile(sourcePath);
54 var uriKind = getUriKind(sourceFile); 54 var uriKind = getUriKind(sourceFile);
55 var librarySource = new FileBasedSource.con2(contentCache, sourceFile, uriKi nd); 55 var librarySource = new FileBasedSource.con2(sourceFile, uriKind);
56 // prepare context 56 // prepare context
57 prepareAnalysisContext(sourceFile); 57 prepareAnalysisContext(sourceFile);
58 // don't try to analyzer parts 58 // don't try to analyzer parts
59 var unit = context.parseCompilationUnit(librarySource); 59 var unit = context.parseCompilationUnit(librarySource);
60 var hasLibraryDirective = false; 60 var hasLibraryDirective = false;
61 var hasPartOfDirective = false; 61 var hasPartOfDirective = false;
62 for (var directive in unit.directives) { 62 for (var directive in unit.directives) {
63 if (directive is LibraryDirective) hasLibraryDirective = true; 63 if (directive is LibraryDirective) hasLibraryDirective = true;
64 if (directive is PartOfDirective) hasPartOfDirective = true; 64 if (directive is PartOfDirective) hasPartOfDirective = true;
65 } 65 }
(...skipping 28 matching lines...) Expand all
94 JavaFile packageDirectory; 94 JavaFile packageDirectory;
95 if (options.packageRootPath != null) { 95 if (options.packageRootPath != null) {
96 packageDirectory = new JavaFile(options.packageRootPath); 96 packageDirectory = new JavaFile(options.packageRootPath);
97 } else { 97 } else {
98 packageDirectory = getPackageDirectoryFor(sourceFile); 98 packageDirectory = getPackageDirectoryFor(sourceFile);
99 } 99 }
100 if (packageDirectory != null) { 100 if (packageDirectory != null) {
101 resolvers.add(new PackageUriResolver([packageDirectory])); 101 resolvers.add(new PackageUriResolver([packageDirectory]));
102 } 102 }
103 } 103 }
104 sourceFactory = new SourceFactory.con1(contentCache, resolvers); 104 sourceFactory = new SourceFactory(resolvers);
105 context = AnalysisEngine.instance.createAnalysisContext(); 105 context = AnalysisEngine.instance.createAnalysisContext();
106 context.sourceFactory = sourceFactory; 106 context.sourceFactory = sourceFactory;
107 107
108 // set options for context 108 // set options for context
109 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); 109 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
110 contextOptions.cacheSize = 256; 110 contextOptions.cacheSize = 256;
111 contextOptions.hint = !options.disableHints; 111 contextOptions.hint = !options.disableHints;
112 context.analysisOptions = contextOptions; 112 context.analysisOptions = contextOptions;
113 } 113 }
114 114
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 var internalPath = pathos.join(libraryDirectory, '_internal') + pathos.s eparator; 200 var internalPath = pathos.join(libraryDirectory, '_internal') + pathos.s eparator;
201 if (!filePath.startsWith(internalPath)) { 201 if (!filePath.startsWith(internalPath)) {
202 return UriKind.DART_URI; 202 return UriKind.DART_URI;
203 } 203 }
204 } 204 }
205 } 205 }
206 // some generic file 206 // some generic file
207 return UriKind.FILE_URI; 207 return UriKind.FILE_URI;
208 } 208 }
209 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698