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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 267293006: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc e) => _getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT , null); 1714 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc e) => _getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT , null);
1715 1715
1716 @override 1716 @override
1717 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { 1717 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) {
1718 computeHtmlElement(htmlSource); 1718 computeHtmlElement(htmlSource);
1719 return parseHtmlUnit(htmlSource); 1719 return parseHtmlUnit(htmlSource);
1720 } 1720 }
1721 1721
1722 @override 1722 @override
1723 void set analysisOptions(AnalysisOptions options) { 1723 void set analysisOptions(AnalysisOptions options) {
1724 bool needsRecompute = this._options.analyzeFunctionBodies != options.analyze FunctionBodies || this._options.generateSdkErrors != options.generateSdkErrors | | this._options.dart2jsHint != options.dart2jsHint || (this._options.hint && !op tions.hint) || this._options.preserveComments != options.preserveComments; 1724 bool needsRecompute = this._options.analyzeFunctionBodies != options.analyze FunctionBodies || this._options.generateSdkErrors != options.generateSdkErrors | | this._options.enableDeferredLoading != options.enableDeferredLoading || this._ options.dart2jsHint != options.dart2jsHint || (this._options.hint && !options.hi nt) || this._options.preserveComments != options.preserveComments;
1725 int cacheSize = options.cacheSize; 1725 int cacheSize = options.cacheSize;
1726 if (this._options.cacheSize != cacheSize) { 1726 if (this._options.cacheSize != cacheSize) {
1727 this._options.cacheSize = cacheSize; 1727 this._options.cacheSize = cacheSize;
1728 //cache.setMaxCacheSize(cacheSize); 1728 //cache.setMaxCacheSize(cacheSize);
1729 _privatePartition.maxCacheSize = cacheSize; 1729 _privatePartition.maxCacheSize = cacheSize;
1730 // 1730 //
1731 // Cap the size of the priority list to being less than the cache size. Fa ilure to do so can 1731 // Cap the size of the priority list to being less than the cache size. Fa ilure to do so can
1732 // result in an infinite loop in performAnalysisTask() because re-caching one AST structure 1732 // result in an infinite loop in performAnalysisTask() because re-caching one AST structure
1733 // can cause another priority source's AST structure to be flushed. 1733 // can cause another priority source's AST structure to be flushed.
1734 // 1734 //
1735 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; 1735 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA;
1736 if (_priorityOrder.length > maxPriorityOrderSize) { 1736 if (_priorityOrder.length > maxPriorityOrderSize) {
1737 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize); 1737 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize);
1738 JavaSystem.arraycopy(_priorityOrder, 0, newPriorityOrder, 0, maxPriority OrderSize); 1738 JavaSystem.arraycopy(_priorityOrder, 0, newPriorityOrder, 0, maxPriority OrderSize);
1739 _priorityOrder = newPriorityOrder; 1739 _priorityOrder = newPriorityOrder;
1740 } 1740 }
1741 } 1741 }
1742 this._options.analyzeFunctionBodies = options.analyzeFunctionBodies; 1742 this._options.analyzeFunctionBodies = options.analyzeFunctionBodies;
1743 this._options.generateSdkErrors = options.generateSdkErrors; 1743 this._options.generateSdkErrors = options.generateSdkErrors;
1744 this._options.enableDeferredLoading = options.enableDeferredLoading;
1744 this._options.dart2jsHint = options.dart2jsHint; 1745 this._options.dart2jsHint = options.dart2jsHint;
1745 this._options.hint = options.hint; 1746 this._options.hint = options.hint;
1746 this._options.incremental = options.incremental; 1747 this._options.incremental = options.incremental;
1747 this._options.preserveComments = options.preserveComments; 1748 this._options.preserveComments = options.preserveComments;
1748 _generateSdkErrors = options.generateSdkErrors; 1749 _generateSdkErrors = options.generateSdkErrors;
1749 if (needsRecompute) { 1750 if (needsRecompute) {
1750 _invalidateAllLocalResolutionInformation(); 1751 _invalidateAllLocalResolutionInformation();
1751 } 1752 }
1752 } 1753 }
1753 1754
(...skipping 4517 matching lines...) Expand 10 before | Expand all | Expand 10 after
6271 int get cacheSize; 6272 int get cacheSize;
6272 6273
6273 /** 6274 /**
6274 * Return `true` if analysis is to generate dart2js related hint results. 6275 * Return `true` if analysis is to generate dart2js related hint results.
6275 * 6276 *
6276 * @return `true` if analysis is to generate dart2js related hint results 6277 * @return `true` if analysis is to generate dart2js related hint results
6277 */ 6278 */
6278 bool get dart2jsHint; 6279 bool get dart2jsHint;
6279 6280
6280 /** 6281 /**
6282 * Return `true` if analysis is to include the new "deferred loading" support.
6283 *
6284 * @return `true` if analysis is to include the new "deferred loading" support
6285 */
6286 bool get enableDeferredLoading;
6287
6288 /**
6281 * Return `true` if errors, warnings and hints should be generated for sources in the SDK. 6289 * Return `true` if errors, warnings and hints should be generated for sources in the SDK.
6282 * The default value is `false`. 6290 * The default value is `false`.
6283 * 6291 *
6284 * @return `true` if errors, warnings and hints should be generated for the SD K 6292 * @return `true` if errors, warnings and hints should be generated for the SD K
6285 */ 6293 */
6286 bool get generateSdkErrors; 6294 bool get generateSdkErrors;
6287 6295
6288 /** 6296 /**
6289 * Return `true` if analysis is to generate hint results (e.g. type inference based 6297 * Return `true` if analysis is to generate hint results (e.g. type inference based
6290 * information and pub best practices). 6298 * information and pub best practices).
(...skipping 21 matching lines...) Expand all
6312 * Instances of the class `AnalysisOptions` represent a set of analysis options used to 6320 * Instances of the class `AnalysisOptions` represent a set of analysis options used to
6313 * control the behavior of an analysis context. 6321 * control the behavior of an analysis context.
6314 */ 6322 */
6315 class AnalysisOptionsImpl implements AnalysisOptions { 6323 class AnalysisOptionsImpl implements AnalysisOptions {
6316 /** 6324 /**
6317 * The maximum number of sources for which data should be kept in the cache. 6325 * The maximum number of sources for which data should be kept in the cache.
6318 */ 6326 */
6319 static int DEFAULT_CACHE_SIZE = 64; 6327 static int DEFAULT_CACHE_SIZE = 64;
6320 6328
6321 /** 6329 /**
6322 * The maximum number of sources for which AST structures should be kept in th e cache. 6330 * The default value for enabling deferred loading.
6323 */ 6331 */
6324 int cacheSize = DEFAULT_CACHE_SIZE; 6332 static bool DEFAULT_ENABLE_DEFERRED_LOADING = true;
6333
6334 /**
6335 * A flag indicating whether analysis is to analyze Angular.
6336 */
6337 bool analyzeAngular = true;
6325 6338
6326 /** 6339 /**
6327 * A flag indicating whether analysis is to parse and analyze function bodies. 6340 * A flag indicating whether analysis is to parse and analyze function bodies.
6328 */ 6341 */
6329 bool analyzeFunctionBodies = true; 6342 bool analyzeFunctionBodies = true;
6330 6343
6331 /** 6344 /**
6345 * A flag indicating whether analysis is to analyze Polymer.
6346 */
6347 bool analyzePolymer = true;
6348
6349 /**
6350 * The maximum number of sources for which AST structures should be kept in th e cache.
6351 */
6352 int cacheSize = DEFAULT_CACHE_SIZE;
6353
6354 /**
6332 * A flag indicating whether analysis is to generate dart2js related hint resu lts. 6355 * A flag indicating whether analysis is to generate dart2js related hint resu lts.
6333 */ 6356 */
6334 bool dart2jsHint = true; 6357 bool dart2jsHint = true;
6335 6358
6336 /** 6359 /**
6360 * A flag indicating whether analysis is to enable deferred loading.
6361 */
6362 bool enableDeferredLoading = DEFAULT_ENABLE_DEFERRED_LOADING;
6363
6364 /**
6337 * A flag indicating whether errors, warnings and hints should be generated fo r sources in the 6365 * A flag indicating whether errors, warnings and hints should be generated fo r sources in the
6338 * SDK. 6366 * SDK.
6339 */ 6367 */
6340 bool _generateSdkErrors = false; 6368 bool _generateSdkErrors = false;
6341 6369
6342 /** 6370 /**
6343 * A flag indicating whether analysis is to generate hint results (e.g. type i nference based 6371 * A flag indicating whether analysis is to generate hint results (e.g. type i nference based
6344 * information and pub best practices). 6372 * information and pub best practices).
6345 */ 6373 */
6346 bool hint = true; 6374 bool hint = true;
6347 6375
6348 /** 6376 /**
6349 * A flag indicating whether incremental analysis should be used. 6377 * A flag indicating whether incremental analysis should be used.
6350 */ 6378 */
6351 bool incremental = false; 6379 bool incremental = false;
6352 6380
6353 /** 6381 /**
6354 * A flag indicating whether analysis is to parse comments. 6382 * A flag indicating whether analysis is to parse comments.
6355 */ 6383 */
6356 bool preserveComments = true; 6384 bool preserveComments = true;
6357 6385
6358 /** 6386 /**
6359 * A flag indicating whether analysis is to analyze Angular.
6360 */
6361 bool analyzeAngular = true;
6362
6363 /**
6364 * A flag indicating whether analysis is to analyze Polymer.
6365 */
6366 bool analyzePolymer = true;
6367
6368 /**
6369 * Initialize a newly created set of analysis options to have their default va lues. 6387 * Initialize a newly created set of analysis options to have their default va lues.
6370 */ 6388 */
6371 AnalysisOptionsImpl(); 6389 AnalysisOptionsImpl();
6372 6390
6373 /** 6391 /**
6374 * Initialize a newly created set of analysis options to have the same values as those in the 6392 * Initialize a newly created set of analysis options to have the same values as those in the
6375 * given set of analysis options. 6393 * given set of analysis options.
6376 * 6394 *
6377 * @param options the analysis options whose values are being copied 6395 * @param options the analysis options whose values are being copied
6378 */ 6396 */
6379 AnalysisOptionsImpl.con1(AnalysisOptions options) { 6397 AnalysisOptionsImpl.con1(AnalysisOptions options) {
6398 analyzeAngular = options.analyzeAngular;
6399 analyzeFunctionBodies = options.analyzeFunctionBodies;
6400 analyzePolymer = options.analyzePolymer;
6380 cacheSize = options.cacheSize; 6401 cacheSize = options.cacheSize;
6381 dart2jsHint = options.dart2jsHint; 6402 dart2jsHint = options.dart2jsHint;
6403 enableDeferredLoading = options.enableDeferredLoading;
6404 _generateSdkErrors = options.generateSdkErrors;
6382 hint = options.hint; 6405 hint = options.hint;
6383 incremental = options.incremental; 6406 incremental = options.incremental;
6407 preserveComments = options.preserveComments;
6384 } 6408 }
6385 6409
6386 @override 6410 @override
6387 bool get generateSdkErrors => _generateSdkErrors; 6411 bool get generateSdkErrors => _generateSdkErrors;
6388 6412
6389 /** 6413 /**
6390 * Set whether errors, warnings and hints should be generated for sources in t he SDK to match the 6414 * Set whether errors, warnings and hints should be generated for sources in t he SDK to match the
6391 * given value. 6415 * given value.
6392 * 6416 *
6393 * @param generate `true` if errors, warnings and hints should be generated fo r sources in 6417 * @param generate `true` if errors, warnings and hints should be generated fo r sources in
(...skipping 4039 matching lines...) Expand 10 before | Expand all | Expand 10 after
10433 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); 10457 ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
10434 TypeProvider typeProvider = context.typeProvider; 10458 TypeProvider typeProvider = context.typeProvider;
10435 // 10459 //
10436 // Validate the directives 10460 // Validate the directives
10437 // 10461 //
10438 validateDirectives(context, source, _unit, errorListener); 10462 validateDirectives(context, source, _unit, errorListener);
10439 // 10463 //
10440 // Use the ConstantVerifier to verify the use of constants. This needs to happen before using 10464 // Use the ConstantVerifier to verify the use of constants. This needs to happen before using
10441 // the ErrorVerifier because some error codes need the computed constant v alues. 10465 // the ErrorVerifier because some error codes need the computed constant v alues.
10442 // 10466 //
10443 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, ty peProvider); 10467 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, li braryElement, typeProvider);
10444 _unit.accept(constantVerifier); 10468 _unit.accept(constantVerifier);
10445 // 10469 //
10446 // Use the ErrorVerifier to compute the rest of the errors. 10470 // Use the ErrorVerifier to compute the rest of the errors.
10447 // 10471 //
10448 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElem ent, typeProvider, new InheritanceManager(libraryElement)); 10472 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElem ent, typeProvider, new InheritanceManager(libraryElement));
10449 _unit.accept(errorVerifier); 10473 _unit.accept(errorVerifier);
10450 _errors = errorListener.getErrorsForSource(source); 10474 _errors = errorListener.getErrorsForSource(source);
10451 } finally { 10475 } finally {
10452 timeCounter.stop(); 10476 timeCounter.stop();
10453 } 10477 }
(...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after
12851 12875
12852 @override 12876 @override
12853 void internalPerform() { 12877 void internalPerform() {
12854 // 12878 //
12855 // Then parse the token stream. 12879 // Then parse the token stream.
12856 // 12880 //
12857 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse .start(); 12881 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse .start();
12858 try { 12882 try {
12859 RecordingErrorListener errorListener = new RecordingErrorListener(); 12883 RecordingErrorListener errorListener = new RecordingErrorListener();
12860 Parser parser = new Parser(source, errorListener); 12884 Parser parser = new Parser(source, errorListener);
12861 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies ; 12885 AnalysisOptions options = context.analysisOptions;
12886 parser.parseFunctionBodies = options.analyzeFunctionBodies;
12887 parser.parseDeferredLibraries = options.enableDeferredLoading;
12862 _unit = parser.parseCompilationUnit(_tokenStream); 12888 _unit = parser.parseCompilationUnit(_tokenStream);
12863 _unit.lineInfo = lineInfo; 12889 _unit.lineInfo = lineInfo;
12864 AnalysisContext analysisContext = context; 12890 AnalysisContext analysisContext = context;
12865 for (Directive directive in _unit.directives) { 12891 for (Directive directive in _unit.directives) {
12866 if (directive is PartOfDirective) { 12892 if (directive is PartOfDirective) {
12867 _containsPartOfDirective = true; 12893 _containsPartOfDirective = true;
12868 } else { 12894 } else {
12869 _containsNonPartOfDirective = true; 12895 _containsNonPartOfDirective = true;
12870 if (directive is UriBasedDirective) { 12896 if (directive is UriBasedDirective) {
12871 Source referencedSource = resolveDirective(analysisContext, source, directive, errorListener); 12897 Source referencedSource = resolveDirective(analysisContext, source, directive, errorListener);
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
14377 ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement, source, typeProvider, inheritanceManager, errorListener); 14403 ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement, source, typeProvider, inheritanceManager, errorListener);
14378 unit.accept(resolverVisitor); 14404 unit.accept(resolverVisitor);
14379 // 14405 //
14380 // Perform additional error checking. 14406 // Perform additional error checking.
14381 // 14407 //
14382 TimeCounter_TimeCounterHandle counterHandleErrors = PerformanceStatistics.er rors.start(); 14408 TimeCounter_TimeCounterHandle counterHandleErrors = PerformanceStatistics.er rors.start();
14383 try { 14409 try {
14384 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); 14410 ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
14385 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryEle ment, typeProvider, inheritanceManager); 14411 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryEle ment, typeProvider, inheritanceManager);
14386 unit.accept(errorVerifier); 14412 unit.accept(errorVerifier);
14387 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, ty peProvider); 14413 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _l ibraryElement, typeProvider);
14388 unit.accept(constantVerifier); 14414 unit.accept(constantVerifier);
14389 } finally { 14415 } finally {
14390 counterHandleErrors.stop(); 14416 counterHandleErrors.stop();
14391 } 14417 }
14392 // 14418 //
14393 // Capture the results. 14419 // Capture the results.
14394 // 14420 //
14395 _resolvedUnit = unit; 14421 _resolvedUnit = unit;
14396 } 14422 }
14397 14423
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
15357 _index++; 15383 _index++;
15358 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { 15384 if (_index >= WorkManager_this._workQueues[_queueIndex].length) {
15359 _index = 0; 15385 _index = 0;
15360 _queueIndex++; 15386 _queueIndex++;
15361 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th is._workQueues[_queueIndex].isEmpty) { 15387 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th is._workQueues[_queueIndex].isEmpty) {
15362 _queueIndex++; 15388 _queueIndex++;
15363 } 15389 }
15364 } 15390 }
15365 } 15391 }
15366 } 15392 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698