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

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

Issue 1045553002: Implement the new '??' operator in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix if_null_precedence_test for unchecked operation. Created 5 years, 8 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/analyzer_impl.dart ('k') | pkg/analyzer/lib/src/generated/html.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 "dart:math" as math; 10 import "dart:math" as math;
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 @override 1036 @override
1037 void set analysisOptions(AnalysisOptions options) { 1037 void set analysisOptions(AnalysisOptions options) {
1038 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != 1038 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate !=
1039 options.analyzeFunctionBodiesPredicate || 1039 options.analyzeFunctionBodiesPredicate ||
1040 this._options.generateImplicitErrors != 1040 this._options.generateImplicitErrors !=
1041 options.generateImplicitErrors || 1041 options.generateImplicitErrors ||
1042 this._options.generateSdkErrors != options.generateSdkErrors || 1042 this._options.generateSdkErrors != options.generateSdkErrors ||
1043 this._options.dart2jsHint != options.dart2jsHint || 1043 this._options.dart2jsHint != options.dart2jsHint ||
1044 (this._options.hint && !options.hint) || 1044 (this._options.hint && !options.hint) ||
1045 this._options.preserveComments != options.preserveComments || 1045 this._options.preserveComments != options.preserveComments ||
1046 this._options.enableNullAwareOperators !=
1047 options.enableNullAwareOperators ||
1046 this._options.enableStrictCallChecks != options.enableStrictCallChecks; 1048 this._options.enableStrictCallChecks != options.enableStrictCallChecks;
1047 int cacheSize = options.cacheSize; 1049 int cacheSize = options.cacheSize;
1048 if (this._options.cacheSize != cacheSize) { 1050 if (this._options.cacheSize != cacheSize) {
1049 this._options.cacheSize = cacheSize; 1051 this._options.cacheSize = cacheSize;
1050 //cache.setMaxCacheSize(cacheSize); 1052 //cache.setMaxCacheSize(cacheSize);
1051 _privatePartition.maxCacheSize = cacheSize; 1053 _privatePartition.maxCacheSize = cacheSize;
1052 // 1054 //
1053 // Cap the size of the priority list to being less than the cache size. 1055 // Cap the size of the priority list to being less than the cache size.
1054 // Failure to do so can result in an infinite loop in 1056 // Failure to do so can result in an infinite loop in
1055 // performAnalysisTask() because re-caching one AST structure 1057 // performAnalysisTask() because re-caching one AST structure
1056 // can cause another priority source's AST structure to be flushed. 1058 // can cause another priority source's AST structure to be flushed.
1057 // 1059 //
1058 // TODO(brianwilkerson) Remove this constraint when the new task model is 1060 // TODO(brianwilkerson) Remove this constraint when the new task model is
1059 // implemented. 1061 // implemented.
1060 // 1062 //
1061 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; 1063 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA;
1062 if (_priorityOrder.length > maxPriorityOrderSize) { 1064 if (_priorityOrder.length > maxPriorityOrderSize) {
1063 _priorityOrder = _priorityOrder.sublist(0, maxPriorityOrderSize); 1065 _priorityOrder = _priorityOrder.sublist(0, maxPriorityOrderSize);
1064 } 1066 }
1065 } 1067 }
1066 this._options.analyzeFunctionBodiesPredicate = 1068 this._options.analyzeFunctionBodiesPredicate =
1067 options.analyzeFunctionBodiesPredicate; 1069 options.analyzeFunctionBodiesPredicate;
1068 this._options.generateImplicitErrors = options.generateImplicitErrors; 1070 this._options.generateImplicitErrors = options.generateImplicitErrors;
1069 this._options.generateSdkErrors = options.generateSdkErrors; 1071 this._options.generateSdkErrors = options.generateSdkErrors;
1070 this._options.dart2jsHint = options.dart2jsHint; 1072 this._options.dart2jsHint = options.dart2jsHint;
1073 this._options.enableNullAwareOperators = options.enableNullAwareOperators;
1071 this._options.enableStrictCallChecks = options.enableStrictCallChecks; 1074 this._options.enableStrictCallChecks = options.enableStrictCallChecks;
1072 this._options.hint = options.hint; 1075 this._options.hint = options.hint;
1073 this._options.incremental = options.incremental; 1076 this._options.incremental = options.incremental;
1074 this._options.incrementalApi = options.incrementalApi; 1077 this._options.incrementalApi = options.incrementalApi;
1075 this._options.incrementalValidation = options.incrementalValidation; 1078 this._options.incrementalValidation = options.incrementalValidation;
1076 this._options.lint = options.lint; 1079 this._options.lint = options.lint;
1077 this._options.preserveComments = options.preserveComments; 1080 this._options.preserveComments = options.preserveComments;
1078 _generateImplicitErrors = options.generateImplicitErrors; 1081 _generateImplicitErrors = options.generateImplicitErrors;
1079 _generateSdkErrors = options.generateSdkErrors; 1082 _generateSdkErrors = options.generateSdkErrors;
1080 if (needsRecompute) { 1083 if (needsRecompute) {
(...skipping 3575 matching lines...) Expand 10 before | Expand all | Expand 10 after
4656 // prepare the existing unit 4659 // prepare the existing unit
4657 CompilationUnit oldUnit = 4660 CompilationUnit oldUnit =
4658 getResolvedCompilationUnit2(unitSource, librarySource); 4661 getResolvedCompilationUnit2(unitSource, librarySource);
4659 if (oldUnit == null) { 4662 if (oldUnit == null) {
4660 return false; 4663 return false;
4661 } 4664 }
4662 // do resolution 4665 // do resolution
4663 Stopwatch perfCounter = new Stopwatch()..start(); 4666 Stopwatch perfCounter = new Stopwatch()..start();
4664 PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver( 4667 PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver(
4665 typeProvider, unitSource, dartEntry, oldUnit, 4668 typeProvider, unitSource, dartEntry, oldUnit,
4666 analysisOptions.incrementalApi); 4669 analysisOptions.incrementalApi, analysisOptions);
4667 bool success = resolver.resolve(newCode); 4670 bool success = resolver.resolve(newCode);
4668 AnalysisEngine.instance.instrumentationService.logPerformance( 4671 AnalysisEngine.instance.instrumentationService.logPerformance(
4669 AnalysisPerformanceKind.INCREMENTAL, perfCounter, 4672 AnalysisPerformanceKind.INCREMENTAL, perfCounter,
4670 'success=$success,context_id=$_id,code_length=${newCode.length}'); 4673 'success=$success,context_id=$_id,code_length=${newCode.length}');
4671 if (!success) { 4674 if (!success) {
4672 return false; 4675 return false;
4673 } 4676 }
4674 // if validation, remember the result, but throw it away 4677 // if validation, remember the result, but throw it away
4675 if (analysisOptions.incrementalValidation) { 4678 if (analysisOptions.incrementalValidation) {
4676 incrementalResolutionValidation_lastUnitSource = oldUnit.element.source; 4679 incrementalResolutionValidation_lastUnitSource = oldUnit.element.source;
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
5987 @deprecated // Always true 5990 @deprecated // Always true
5988 bool get enableDeferredLoading; 5991 bool get enableDeferredLoading;
5989 5992
5990 /** 5993 /**
5991 * Return `true` if analysis is to include the new enum support. 5994 * Return `true` if analysis is to include the new enum support.
5992 */ 5995 */
5993 @deprecated // Always true 5996 @deprecated // Always true
5994 bool get enableEnum; 5997 bool get enableEnum;
5995 5998
5996 /** 5999 /**
6000 * Return `true` to enable null-aware operators (DEP 9).
6001 */
6002 bool get enableNullAwareOperators;
6003
6004 /**
5997 * Return `true` to strictly follow the specification when generating 6005 * Return `true` to strictly follow the specification when generating
5998 * warnings on "call" methods (fixes dartbug.com/21938). 6006 * warnings on "call" methods (fixes dartbug.com/21938).
5999 */ 6007 */
6000 bool get enableStrictCallChecks; 6008 bool get enableStrictCallChecks;
6001 6009
6002 /** 6010 /**
6003 * Return `true` if errors, warnings and hints should be generated for sources 6011 * Return `true` if errors, warnings and hints should be generated for sources
6004 * that are implicitly being analyzed. The default value is `true`. 6012 * that are implicitly being analyzed. The default value is `true`.
6005 */ 6013 */
6006 bool get generateImplicitErrors; 6014 bool get generateImplicitErrors;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6080 */ 6088 */
6081 int cacheSize = DEFAULT_CACHE_SIZE; 6089 int cacheSize = DEFAULT_CACHE_SIZE;
6082 6090
6083 /** 6091 /**
6084 * A flag indicating whether analysis is to generate dart2js related hint 6092 * A flag indicating whether analysis is to generate dart2js related hint
6085 * results. 6093 * results.
6086 */ 6094 */
6087 bool dart2jsHint = true; 6095 bool dart2jsHint = true;
6088 6096
6089 /** 6097 /**
6098 * A flag indicating whether null-aware operators should be parsed (DEP 9).
6099 */
6100 bool enableNullAwareOperators = false;
6101
6102 /**
6090 * A flag indicating whether analysis is to strictly follow the specification 6103 * A flag indicating whether analysis is to strictly follow the specification
6091 * when generating warnings on "call" methods (fixes dartbug.com/21938). 6104 * when generating warnings on "call" methods (fixes dartbug.com/21938).
6092 */ 6105 */
6093 bool enableStrictCallChecks = false; 6106 bool enableStrictCallChecks = false;
6094 6107
6095 /** 6108 /**
6096 * A flag indicating whether errors, warnings and hints should be generated 6109 * A flag indicating whether errors, warnings and hints should be generated
6097 * for sources that are implicitly being analyzed. 6110 * for sources that are implicitly being analyzed.
6098 */ 6111 */
6099 bool generateImplicitErrors = true; 6112 bool generateImplicitErrors = true;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 AnalysisOptionsImpl(); 6157 AnalysisOptionsImpl();
6145 6158
6146 /** 6159 /**
6147 * Initialize a newly created set of analysis options to have the same values 6160 * Initialize a newly created set of analysis options to have the same values
6148 * as those in the given set of analysis [options]. 6161 * as those in the given set of analysis [options].
6149 */ 6162 */
6150 AnalysisOptionsImpl.con1(AnalysisOptions options) { 6163 AnalysisOptionsImpl.con1(AnalysisOptions options) {
6151 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; 6164 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
6152 cacheSize = options.cacheSize; 6165 cacheSize = options.cacheSize;
6153 dart2jsHint = options.dart2jsHint; 6166 dart2jsHint = options.dart2jsHint;
6167 enableNullAwareOperators = options.enableNullAwareOperators;
6154 enableStrictCallChecks = options.enableStrictCallChecks; 6168 enableStrictCallChecks = options.enableStrictCallChecks;
6155 generateImplicitErrors = options.generateImplicitErrors; 6169 generateImplicitErrors = options.generateImplicitErrors;
6156 generateSdkErrors = options.generateSdkErrors; 6170 generateSdkErrors = options.generateSdkErrors;
6157 hint = options.hint; 6171 hint = options.hint;
6158 incremental = options.incremental; 6172 incremental = options.incremental;
6159 incrementalApi = options.incrementalApi; 6173 incrementalApi = options.incrementalApi;
6160 incrementalValidation = options.incrementalValidation; 6174 incrementalValidation = options.incrementalValidation;
6161 lint = options.lint; 6175 lint = options.lint;
6162 preserveComments = options.preserveComments; 6176 preserveComments = options.preserveComments;
6163 } 6177 }
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after
8947 if (cache == null) { 8961 if (cache == null) {
8948 return; 8962 return;
8949 } 8963 }
8950 // Only handle small changes 8964 // Only handle small changes
8951 if (cache.oldLength > 0 || cache.newLength > 30) { 8965 if (cache.oldLength > 0 || cache.newLength > 30) {
8952 return; 8966 return;
8953 } 8967 }
8954 // Produce an updated token stream 8968 // Produce an updated token stream
8955 CharacterReader reader = new CharSequenceReader(cache.newContents); 8969 CharacterReader reader = new CharSequenceReader(cache.newContents);
8956 BooleanErrorListener errorListener = new BooleanErrorListener(); 8970 BooleanErrorListener errorListener = new BooleanErrorListener();
8957 IncrementalScanner scanner = 8971 IncrementalScanner scanner = new IncrementalScanner(
8958 new IncrementalScanner(cache.source, reader, errorListener); 8972 cache.source, reader, errorListener, context.analysisOptions);
8959 scanner.rescan(cache.resolvedUnit.beginToken, cache.offset, cache.oldLength, 8973 scanner.rescan(cache.resolvedUnit.beginToken, cache.offset, cache.oldLength,
8960 cache.newLength); 8974 cache.newLength);
8961 if (errorListener.errorReported) { 8975 if (errorListener.errorReported) {
8962 return; 8976 return;
8963 } 8977 }
8964 // Produce an updated AST 8978 // Produce an updated AST
8965 IncrementalParser parser = new IncrementalParser( 8979 IncrementalParser parser = new IncrementalParser(
8966 cache.source, scanner.tokenMap, AnalysisErrorListener.NULL_LISTENER); 8980 cache.source, scanner.tokenMap, AnalysisErrorListener.NULL_LISTENER);
8967 _updatedUnit = parser.reparse(cache.resolvedUnit, scanner.leftToken, 8981 _updatedUnit = parser.reparse(cache.resolvedUnit, scanner.leftToken,
8968 scanner.rightToken, cache.offset, cache.offset + cache.oldLength); 8982 scanner.rightToken, cache.offset, cache.offset + cache.oldLength);
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
9541 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); 9555 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this);
9542 9556
9543 @override 9557 @override
9544 void internalPerform() { 9558 void internalPerform() {
9545 try { 9559 try {
9546 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); 9560 ht.AbstractScanner scanner = new ht.StringScanner(source, _content);
9547 scanner.passThroughElements = <String>[_TAG_SCRIPT]; 9561 scanner.passThroughElements = <String>[_TAG_SCRIPT];
9548 ht.Token token = scanner.tokenize(); 9562 ht.Token token = scanner.tokenize();
9549 _lineInfo = new LineInfo(scanner.lineStarts); 9563 _lineInfo = new LineInfo(scanner.lineStarts);
9550 RecordingErrorListener errorListener = new RecordingErrorListener(); 9564 RecordingErrorListener errorListener = new RecordingErrorListener();
9551 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); 9565 _unit = new ht.HtmlParser(source, errorListener, context.analysisOptions)
9566 .parse(token, _lineInfo);
9552 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform( 9567 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform(
9553 this, errorListener)); 9568 this, errorListener));
9554 _errors = errorListener.getErrorsForSource(source); 9569 _errors = errorListener.getErrorsForSource(source);
9555 _referencedLibraries = librarySources; 9570 _referencedLibraries = librarySources;
9556 } catch (exception, stackTrace) { 9571 } catch (exception, stackTrace) {
9557 throw new AnalysisException( 9572 throw new AnalysisException(
9558 "Exception", new CaughtException(exception, stackTrace)); 9573 "Exception", new CaughtException(exception, stackTrace));
9559 } 9574 }
9560 } 9575 }
9561 9576
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
10774 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); 10789 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this);
10775 10790
10776 @override 10791 @override
10777 void internalPerform() { 10792 void internalPerform() {
10778 PerformanceStatistics.scan.makeCurrentWhile(() { 10793 PerformanceStatistics.scan.makeCurrentWhile(() {
10779 RecordingErrorListener errorListener = new RecordingErrorListener(); 10794 RecordingErrorListener errorListener = new RecordingErrorListener();
10780 try { 10795 try {
10781 Scanner scanner = new Scanner( 10796 Scanner scanner = new Scanner(
10782 source, new CharSequenceReader(_content), errorListener); 10797 source, new CharSequenceReader(_content), errorListener);
10783 scanner.preserveComments = context.analysisOptions.preserveComments; 10798 scanner.preserveComments = context.analysisOptions.preserveComments;
10799 scanner.enableNullAwareOperators =
10800 context.analysisOptions.enableNullAwareOperators;
10784 _tokenStream = scanner.tokenize(); 10801 _tokenStream = scanner.tokenize();
10785 _lineInfo = new LineInfo(scanner.lineStarts); 10802 _lineInfo = new LineInfo(scanner.lineStarts);
10786 _errors = errorListener.getErrorsForSource(source); 10803 _errors = errorListener.getErrorsForSource(source);
10787 } catch (exception, stackTrace) { 10804 } catch (exception, stackTrace) {
10788 throw new AnalysisException( 10805 throw new AnalysisException(
10789 "Exception", new CaughtException(exception, stackTrace)); 10806 "Exception", new CaughtException(exception, stackTrace));
10790 } 10807 }
10791 }); 10808 });
10792 } 10809 }
10793 } 10810 }
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
11643 visitElement(Element element) { 11660 visitElement(Element element) {
11644 if (element.id == _id) { 11661 if (element.id == _id) {
11645 result = element; 11662 result = element;
11646 throw new _ElementByIdFinderException(); 11663 throw new _ElementByIdFinderException();
11647 } 11664 }
11648 super.visitElement(element); 11665 super.visitElement(element);
11649 } 11666 }
11650 } 11667 }
11651 11668
11652 class _ElementByIdFinderException {} 11669 class _ElementByIdFinderException {}
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698