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

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

Issue 1262163002: Implement DEP 34 (less restricted mixins) in analysis engine. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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:async'; 10 import 'dart:async';
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 @override 1111 @override
1112 void set analysisOptions(AnalysisOptions options) { 1112 void set analysisOptions(AnalysisOptions options) {
1113 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != 1113 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate !=
1114 options.analyzeFunctionBodiesPredicate || 1114 options.analyzeFunctionBodiesPredicate ||
1115 this._options.generateImplicitErrors != 1115 this._options.generateImplicitErrors !=
1116 options.generateImplicitErrors || 1116 options.generateImplicitErrors ||
1117 this._options.generateSdkErrors != options.generateSdkErrors || 1117 this._options.generateSdkErrors != options.generateSdkErrors ||
1118 this._options.dart2jsHint != options.dart2jsHint || 1118 this._options.dart2jsHint != options.dart2jsHint ||
1119 (this._options.hint && !options.hint) || 1119 (this._options.hint && !options.hint) ||
1120 this._options.preserveComments != options.preserveComments || 1120 this._options.preserveComments != options.preserveComments ||
1121 this._options.enableStrictCallChecks != options.enableStrictCallChecks; 1121 this._options.enableStrictCallChecks !=
1122 options.enableStrictCallChecks ||
1123 this._options.enableSuperMixins != options.enableSuperMixins;
1122 int cacheSize = options.cacheSize; 1124 int cacheSize = options.cacheSize;
1123 if (this._options.cacheSize != cacheSize) { 1125 if (this._options.cacheSize != cacheSize) {
1124 this._options.cacheSize = cacheSize; 1126 this._options.cacheSize = cacheSize;
1125 //cache.setMaxCacheSize(cacheSize); 1127 //cache.setMaxCacheSize(cacheSize);
1126 _privatePartition.maxCacheSize = cacheSize; 1128 _privatePartition.maxCacheSize = cacheSize;
1127 // 1129 //
1128 // Cap the size of the priority list to being less than the cache size. 1130 // Cap the size of the priority list to being less than the cache size.
1129 // Failure to do so can result in an infinite loop in 1131 // Failure to do so can result in an infinite loop in
1130 // performAnalysisTask() because re-caching one AST structure 1132 // performAnalysisTask() because re-caching one AST structure
1131 // can cause another priority source's AST structure to be flushed. 1133 // can cause another priority source's AST structure to be flushed.
1132 // 1134 //
1133 // TODO(brianwilkerson) Remove this constraint when the new task model is 1135 // TODO(brianwilkerson) Remove this constraint when the new task model is
1134 // implemented. 1136 // implemented.
1135 // 1137 //
1136 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; 1138 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA;
1137 if (_priorityOrder.length > maxPriorityOrderSize) { 1139 if (_priorityOrder.length > maxPriorityOrderSize) {
1138 _priorityOrder = _priorityOrder.sublist(0, maxPriorityOrderSize); 1140 _priorityOrder = _priorityOrder.sublist(0, maxPriorityOrderSize);
1139 } 1141 }
1140 } 1142 }
1141 this._options.analyzeFunctionBodiesPredicate = 1143 this._options.analyzeFunctionBodiesPredicate =
1142 options.analyzeFunctionBodiesPredicate; 1144 options.analyzeFunctionBodiesPredicate;
1143 this._options.generateImplicitErrors = options.generateImplicitErrors; 1145 this._options.generateImplicitErrors = options.generateImplicitErrors;
1144 this._options.generateSdkErrors = options.generateSdkErrors; 1146 this._options.generateSdkErrors = options.generateSdkErrors;
1145 this._options.dart2jsHint = options.dart2jsHint; 1147 this._options.dart2jsHint = options.dart2jsHint;
1146 this._options.enableStrictCallChecks = options.enableStrictCallChecks; 1148 this._options.enableStrictCallChecks = options.enableStrictCallChecks;
1149 this._options.enableSuperMixins = options.enableSuperMixins;
1147 this._options.hint = options.hint; 1150 this._options.hint = options.hint;
1148 this._options.incremental = options.incremental; 1151 this._options.incremental = options.incremental;
1149 this._options.incrementalApi = options.incrementalApi; 1152 this._options.incrementalApi = options.incrementalApi;
1150 this._options.incrementalValidation = options.incrementalValidation; 1153 this._options.incrementalValidation = options.incrementalValidation;
1151 this._options.lint = options.lint; 1154 this._options.lint = options.lint;
1152 this._options.preserveComments = options.preserveComments; 1155 this._options.preserveComments = options.preserveComments;
1153 _generateImplicitErrors = options.generateImplicitErrors; 1156 _generateImplicitErrors = options.generateImplicitErrors;
1154 _generateSdkErrors = options.generateSdkErrors; 1157 _generateSdkErrors = options.generateSdkErrors;
1155 if (needsRecompute) { 1158 if (needsRecompute) {
1156 _invalidateAllLocalResolutionInformation(false); 1159 _invalidateAllLocalResolutionInformation(false);
(...skipping 4985 matching lines...) Expand 10 before | Expand all | Expand 10 after
6142 @deprecated // Always true 6145 @deprecated // Always true
6143 bool get enableNullAwareOperators; 6146 bool get enableNullAwareOperators;
6144 6147
6145 /** 6148 /**
6146 * Return `true` to strictly follow the specification when generating 6149 * Return `true` to strictly follow the specification when generating
6147 * warnings on "call" methods (fixes dartbug.com/21938). 6150 * warnings on "call" methods (fixes dartbug.com/21938).
6148 */ 6151 */
6149 bool get enableStrictCallChecks; 6152 bool get enableStrictCallChecks;
6150 6153
6151 /** 6154 /**
6155 * Return `true` if mixins are allowed to inherit from types other than
6156 * Object, and are allowed to reference `super`.
6157 */
6158 bool get enableSuperMixins;
6159
6160 /**
6152 * Return `true` if errors, warnings and hints should be generated for sources 6161 * Return `true` if errors, warnings and hints should be generated for sources
6153 * that are implicitly being analyzed. The default value is `true`. 6162 * that are implicitly being analyzed. The default value is `true`.
6154 */ 6163 */
6155 bool get generateImplicitErrors; 6164 bool get generateImplicitErrors;
6156 6165
6157 /** 6166 /**
6158 * Return `true` if errors, warnings and hints should be generated for sources 6167 * Return `true` if errors, warnings and hints should be generated for sources
6159 * in the SDK. The default value is `false`. 6168 * in the SDK. The default value is `false`.
6160 */ 6169 */
6161 bool get generateSdkErrors; 6170 bool get generateSdkErrors;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6245 */ 6254 */
6246 bool enableGenericMethods = false; 6255 bool enableGenericMethods = false;
6247 6256
6248 /** 6257 /**
6249 * A flag indicating whether analysis is to strictly follow the specification 6258 * A flag indicating whether analysis is to strictly follow the specification
6250 * when generating warnings on "call" methods (fixes dartbug.com/21938). 6259 * when generating warnings on "call" methods (fixes dartbug.com/21938).
6251 */ 6260 */
6252 bool enableStrictCallChecks = false; 6261 bool enableStrictCallChecks = false;
6253 6262
6254 /** 6263 /**
6264 * A flag indicating whether mixins are allowed to inherit from types other
6265 * than Object, and are allowed to reference `super`.
6266 */
6267 bool enableSuperMixins = false;
6268
6269 /**
6255 * A flag indicating whether errors, warnings and hints should be generated 6270 * A flag indicating whether errors, warnings and hints should be generated
6256 * for sources that are implicitly being analyzed. 6271 * for sources that are implicitly being analyzed.
6257 */ 6272 */
6258 bool generateImplicitErrors = true; 6273 bool generateImplicitErrors = true;
6259 6274
6260 /** 6275 /**
6261 * A flag indicating whether errors, warnings and hints should be generated 6276 * A flag indicating whether errors, warnings and hints should be generated
6262 * for sources in the SDK. 6277 * for sources in the SDK.
6263 */ 6278 */
6264 bool generateSdkErrors = false; 6279 bool generateSdkErrors = false;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
6310 /** 6325 /**
6311 * Initialize a newly created set of analysis options to have the same values 6326 * Initialize a newly created set of analysis options to have the same values
6312 * as those in the given set of analysis [options]. 6327 * as those in the given set of analysis [options].
6313 */ 6328 */
6314 @deprecated // Use new AnalysisOptionsImpl.from(options) 6329 @deprecated // Use new AnalysisOptionsImpl.from(options)
6315 AnalysisOptionsImpl.con1(AnalysisOptions options) { 6330 AnalysisOptionsImpl.con1(AnalysisOptions options) {
6316 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; 6331 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
6317 cacheSize = options.cacheSize; 6332 cacheSize = options.cacheSize;
6318 dart2jsHint = options.dart2jsHint; 6333 dart2jsHint = options.dart2jsHint;
6319 enableStrictCallChecks = options.enableStrictCallChecks; 6334 enableStrictCallChecks = options.enableStrictCallChecks;
6335 enableSuperMixins = options.enableSuperMixins;
6320 generateImplicitErrors = options.generateImplicitErrors; 6336 generateImplicitErrors = options.generateImplicitErrors;
6321 generateSdkErrors = options.generateSdkErrors; 6337 generateSdkErrors = options.generateSdkErrors;
6322 hint = options.hint; 6338 hint = options.hint;
6323 incremental = options.incremental; 6339 incremental = options.incremental;
6324 incrementalApi = options.incrementalApi; 6340 incrementalApi = options.incrementalApi;
6325 incrementalValidation = options.incrementalValidation; 6341 incrementalValidation = options.incrementalValidation;
6326 lint = options.lint; 6342 lint = options.lint;
6327 preserveComments = options.preserveComments; 6343 preserveComments = options.preserveComments;
6328 strongMode = options.strongMode; 6344 strongMode = options.strongMode;
6329 } 6345 }
6330 6346
6331 /** 6347 /**
6332 * Initialize a newly created set of analysis options to have the same values 6348 * Initialize a newly created set of analysis options to have the same values
6333 * as those in the given set of analysis [options]. 6349 * as those in the given set of analysis [options].
6334 */ 6350 */
6335 AnalysisOptionsImpl.from(AnalysisOptions options) { 6351 AnalysisOptionsImpl.from(AnalysisOptions options) {
6336 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; 6352 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
6337 cacheSize = options.cacheSize; 6353 cacheSize = options.cacheSize;
6338 dart2jsHint = options.dart2jsHint; 6354 dart2jsHint = options.dart2jsHint;
6339 enableStrictCallChecks = options.enableStrictCallChecks; 6355 enableStrictCallChecks = options.enableStrictCallChecks;
6356 enableSuperMixins = options.enableSuperMixins;
6340 generateImplicitErrors = options.generateImplicitErrors; 6357 generateImplicitErrors = options.generateImplicitErrors;
6341 generateSdkErrors = options.generateSdkErrors; 6358 generateSdkErrors = options.generateSdkErrors;
6342 hint = options.hint; 6359 hint = options.hint;
6343 incremental = options.incremental; 6360 incremental = options.incremental;
6344 incrementalApi = options.incrementalApi; 6361 incrementalApi = options.incrementalApi;
6345 incrementalValidation = options.incrementalValidation; 6362 incrementalValidation = options.incrementalValidation;
6346 lint = options.lint; 6363 lint = options.lint;
6347 preserveComments = options.preserveComments; 6364 preserveComments = options.preserveComments;
6348 strongMode = options.strongMode; 6365 strongMode = options.strongMode;
6349 } 6366 }
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
8382 // TODO(paulberry): as a temporary workaround for issue 21572, 8399 // TODO(paulberry): as a temporary workaround for issue 21572,
8383 // ConstantVerifier is being run right after ConstantValueComputer, so we 8400 // ConstantVerifier is being run right after ConstantValueComputer, so we
8384 // don't need to run it here. Once issue 21572 is fixed, re-enable the 8401 // don't need to run it here. Once issue 21572 is fixed, re-enable the
8385 // call to ConstantVerifier. 8402 // call to ConstantVerifier.
8386 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, libraryElement, typeProvider); 8403 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, libraryElement, typeProvider);
8387 // _unit.accept(constantVerifier); 8404 // _unit.accept(constantVerifier);
8388 // 8405 //
8389 // Use the ErrorVerifier to compute the rest of the errors. 8406 // Use the ErrorVerifier to compute the rest of the errors.
8390 // 8407 //
8391 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, 8408 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter,
8392 libraryElement, typeProvider, new InheritanceManager(libraryElement)); 8409 libraryElement, typeProvider, new InheritanceManager(libraryElement),
8410 context.analysisOptions.enableSuperMixins);
8393 _unit.accept(errorVerifier); 8411 _unit.accept(errorVerifier);
8394 _errors = errorListener.getErrorsForSource(source); 8412 _errors = errorListener.getErrorsForSource(source);
8395 }); 8413 });
8396 } 8414 }
8397 8415
8398 /** 8416 /**
8399 * Check each directive in the given compilation unit to see if the referenced source exists and 8417 * Check each directive in the given compilation unit to see if the referenced source exists and
8400 * report an error if it does not. 8418 * report an error if it does not.
8401 * 8419 *
8402 * @param context the context in which the library exists 8420 * @param context the context in which the library exists
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after
10812 new InheritanceManager(_libraryElement); 10830 new InheritanceManager(_libraryElement);
10813 ResolverVisitor resolverVisitor = new ResolverVisitor( 10831 ResolverVisitor resolverVisitor = new ResolverVisitor(
10814 _libraryElement, source, typeProvider, errorListener, 10832 _libraryElement, source, typeProvider, errorListener,
10815 inheritanceManager: inheritanceManager); 10833 inheritanceManager: inheritanceManager);
10816 unit.accept(resolverVisitor); 10834 unit.accept(resolverVisitor);
10817 // 10835 //
10818 // Perform additional error checking. 10836 // Perform additional error checking.
10819 // 10837 //
10820 PerformanceStatistics.errors.makeCurrentWhile(() { 10838 PerformanceStatistics.errors.makeCurrentWhile(() {
10821 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); 10839 ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
10822 ErrorVerifier errorVerifier = new ErrorVerifier( 10840 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter,
10823 errorReporter, _libraryElement, typeProvider, inheritanceManager); 10841 _libraryElement, typeProvider, inheritanceManager,
10842 context.analysisOptions.enableSuperMixins);
10824 unit.accept(errorVerifier); 10843 unit.accept(errorVerifier);
10825 // TODO(paulberry): as a temporary workaround for issue 21572, 10844 // TODO(paulberry): as a temporary workaround for issue 21572,
10826 // ConstantVerifier is being run right after ConstantValueComputer, so we 10845 // ConstantVerifier is being run right after ConstantValueComputer, so we
10827 // don't need to run it here. Once issue 21572 is fixed, re-enable the 10846 // don't need to run it here. Once issue 21572 is fixed, re-enable the
10828 // call to ConstantVerifier. 10847 // call to ConstantVerifier.
10829 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _libraryElement, typeProvider); 10848 // ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _libraryElement, typeProvider);
10830 // unit.accept(constantVerifier); 10849 // unit.accept(constantVerifier);
10831 }); 10850 });
10832 // 10851 //
10833 // Capture the results. 10852 // Capture the results.
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
11907 PendingFuture pendingFuture = 11926 PendingFuture pendingFuture =
11908 new PendingFuture<T>(_context, source, computeValue); 11927 new PendingFuture<T>(_context, source, computeValue);
11909 if (!pendingFuture.evaluate(sourceEntry)) { 11928 if (!pendingFuture.evaluate(sourceEntry)) {
11910 _context._pendingFutureSources 11929 _context._pendingFutureSources
11911 .putIfAbsent(source, () => <PendingFuture>[]) 11930 .putIfAbsent(source, () => <PendingFuture>[])
11912 .add(pendingFuture); 11931 .add(pendingFuture);
11913 } 11932 }
11914 return pendingFuture.future; 11933 return pendingFuture.future;
11915 } 11934 }
11916 } 11935 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698