| OLD | NEW |
| 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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 return null; | 1528 return null; |
| 1529 } | 1529 } |
| 1530 Source source = element.source; | 1530 Source source = element.source; |
| 1531 if (source == null) { | 1531 if (source == null) { |
| 1532 return null; | 1532 return null; |
| 1533 } | 1533 } |
| 1534 CompilationUnit unit = parseCompilationUnit(source); | 1534 CompilationUnit unit = parseCompilationUnit(source); |
| 1535 if (unit == null) { | 1535 if (unit == null) { |
| 1536 return null; | 1536 return null; |
| 1537 } | 1537 } |
| 1538 NodeLocator locator = new NodeLocator.con1(element.nameOffset); | 1538 NodeLocator locator = new NodeLocator(element.nameOffset); |
| 1539 AstNode nameNode = locator.searchWithin(unit); | 1539 AstNode nameNode = locator.searchWithin(unit); |
| 1540 while (nameNode != null) { | 1540 while (nameNode != null) { |
| 1541 if (nameNode is AnnotatedNode) { | 1541 if (nameNode is AnnotatedNode) { |
| 1542 Comment comment = nameNode.documentationComment; | 1542 Comment comment = nameNode.documentationComment; |
| 1543 if (comment == null) { | 1543 if (comment == null) { |
| 1544 return null; | 1544 return null; |
| 1545 } | 1545 } |
| 1546 StringBuffer buffer = new StringBuffer(); | 1546 StringBuffer buffer = new StringBuffer(); |
| 1547 List<Token> tokens = comment.tokens; | 1547 List<Token> tokens = comment.tokens; |
| 1548 for (int i = 0; i < tokens.length; i++) { | 1548 for (int i = 0; i < tokens.length; i++) { |
| (...skipping 4529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6078 /** | 6078 /** |
| 6079 * The default value for enabling deferred loading. | 6079 * The default value for enabling deferred loading. |
| 6080 */ | 6080 */ |
| 6081 @deprecated | 6081 @deprecated |
| 6082 static bool DEFAULT_ENABLE_DEFERRED_LOADING = true; | 6082 static bool DEFAULT_ENABLE_DEFERRED_LOADING = true; |
| 6083 | 6083 |
| 6084 /** | 6084 /** |
| 6085 * The default value for enabling enum support. | 6085 * The default value for enabling enum support. |
| 6086 */ | 6086 */ |
| 6087 @deprecated | 6087 @deprecated |
| 6088 static bool DEFAULT_ENABLE_ENUM = false; | 6088 static bool DEFAULT_ENABLE_ENUM = true; |
| 6089 | 6089 |
| 6090 /** | 6090 /** |
| 6091 * A predicate indicating whether analysis is to parse and analyze function | 6091 * A predicate indicating whether analysis is to parse and analyze function |
| 6092 * bodies. | 6092 * bodies. |
| 6093 */ | 6093 */ |
| 6094 AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate = | 6094 AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate = |
| 6095 _analyzeAllFunctionBodies; | 6095 _analyzeAllFunctionBodies; |
| 6096 | 6096 |
| 6097 /** | 6097 /** |
| 6098 * The maximum number of sources for which AST structures should be kept in | 6098 * The maximum number of sources for which AST structures should be kept in |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6165 /** | 6165 /** |
| 6166 * Initialize a newly created set of analysis options to have their default | 6166 * Initialize a newly created set of analysis options to have their default |
| 6167 * values. | 6167 * values. |
| 6168 */ | 6168 */ |
| 6169 AnalysisOptionsImpl(); | 6169 AnalysisOptionsImpl(); |
| 6170 | 6170 |
| 6171 /** | 6171 /** |
| 6172 * Initialize a newly created set of analysis options to have the same values | 6172 * Initialize a newly created set of analysis options to have the same values |
| 6173 * as those in the given set of analysis [options]. | 6173 * as those in the given set of analysis [options]. |
| 6174 */ | 6174 */ |
| 6175 @deprecated // Use new AnalysisOptionsImpl.from(options) |
| 6175 AnalysisOptionsImpl.con1(AnalysisOptions options) { | 6176 AnalysisOptionsImpl.con1(AnalysisOptions options) { |
| 6176 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; | 6177 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
| 6177 cacheSize = options.cacheSize; | 6178 cacheSize = options.cacheSize; |
| 6178 dart2jsHint = options.dart2jsHint; | 6179 dart2jsHint = options.dart2jsHint; |
| 6179 enableNullAwareOperators = options.enableNullAwareOperators; | 6180 enableNullAwareOperators = options.enableNullAwareOperators; |
| 6180 enableStrictCallChecks = options.enableStrictCallChecks; | 6181 enableStrictCallChecks = options.enableStrictCallChecks; |
| 6181 generateImplicitErrors = options.generateImplicitErrors; | 6182 generateImplicitErrors = options.generateImplicitErrors; |
| 6182 generateSdkErrors = options.generateSdkErrors; | 6183 generateSdkErrors = options.generateSdkErrors; |
| 6183 hint = options.hint; | 6184 hint = options.hint; |
| 6184 incremental = options.incremental; | 6185 incremental = options.incremental; |
| 6185 incrementalApi = options.incrementalApi; | 6186 incrementalApi = options.incrementalApi; |
| 6186 incrementalValidation = options.incrementalValidation; | 6187 incrementalValidation = options.incrementalValidation; |
| 6187 lint = options.lint; | 6188 lint = options.lint; |
| 6188 preserveComments = options.preserveComments; | 6189 preserveComments = options.preserveComments; |
| 6189 } | 6190 } |
| 6190 | 6191 |
| 6192 /** |
| 6193 * Initialize a newly created set of analysis options to have the same values |
| 6194 * as those in the given set of analysis [options]. |
| 6195 */ |
| 6196 AnalysisOptionsImpl.from(AnalysisOptions options) { |
| 6197 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
| 6198 cacheSize = options.cacheSize; |
| 6199 dart2jsHint = options.dart2jsHint; |
| 6200 enableNullAwareOperators = options.enableNullAwareOperators; |
| 6201 enableStrictCallChecks = options.enableStrictCallChecks; |
| 6202 generateImplicitErrors = options.generateImplicitErrors; |
| 6203 generateSdkErrors = options.generateSdkErrors; |
| 6204 hint = options.hint; |
| 6205 incremental = options.incremental; |
| 6206 incrementalApi = options.incrementalApi; |
| 6207 incrementalValidation = options.incrementalValidation; |
| 6208 lint = options.lint; |
| 6209 preserveComments = options.preserveComments; |
| 6210 } |
| 6211 |
| 6191 bool get analyzeFunctionBodies { | 6212 bool get analyzeFunctionBodies { |
| 6192 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { | 6213 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { |
| 6193 return true; | 6214 return true; |
| 6194 } else if (identical( | 6215 } else if (identical( |
| 6195 analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) { | 6216 analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) { |
| 6196 return false; | 6217 return false; |
| 6197 } else { | 6218 } else { |
| 6198 throw new StateError('analyzeFunctionBodiesPredicate in use'); | 6219 throw new StateError('analyzeFunctionBodiesPredicate in use'); |
| 6199 } | 6220 } |
| 6200 } | 6221 } |
| (...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8242 if (context.exists(source)) { | 8263 if (context.exists(source)) { |
| 8243 return; | 8264 return; |
| 8244 } | 8265 } |
| 8245 } else { | 8266 } else { |
| 8246 // Don't report errors already reported by ParseDartTask.resolveDirective | 8267 // Don't report errors already reported by ParseDartTask.resolveDirective |
| 8247 if (directive.validate() != null) { | 8268 if (directive.validate() != null) { |
| 8248 return; | 8269 return; |
| 8249 } | 8270 } |
| 8250 } | 8271 } |
| 8251 StringLiteral uriLiteral = directive.uri; | 8272 StringLiteral uriLiteral = directive.uri; |
| 8252 errorListener.onError(new AnalysisError.con2(librarySource, | 8273 errorListener.onError(new AnalysisError(librarySource, uriLiteral.offset, |
| 8253 uriLiteral.offset, uriLiteral.length, | 8274 uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 8254 CompileTimeErrorCode.URI_DOES_NOT_EXIST, [directive.uriContent])); | 8275 [directive.uriContent])); |
| 8255 } | 8276 } |
| 8256 } | 8277 } |
| 8257 | 8278 |
| 8258 /** | 8279 /** |
| 8259 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da
rt library. | 8280 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da
rt library. |
| 8260 */ | 8281 */ |
| 8261 class GenerateDartHintsTask extends AnalysisTask { | 8282 class GenerateDartHintsTask extends AnalysisTask { |
| 8262 /** | 8283 /** |
| 8263 * The compilation units that comprise the library, with the defining compilat
ion unit appearing | 8284 * The compilation units that comprise the library, with the defining compilat
ion unit appearing |
| 8264 * first in the list. | 8285 * first in the list. |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8468 @override | 8489 @override |
| 8469 void internalPerform() { | 8490 void internalPerform() { |
| 8470 _complete = true; | 8491 _complete = true; |
| 8471 try { | 8492 try { |
| 8472 TimestampedData<String> data = context.getContents(source); | 8493 TimestampedData<String> data = context.getContents(source); |
| 8473 _content = data.data; | 8494 _content = data.data; |
| 8474 _modificationTime = data.modificationTime; | 8495 _modificationTime = data.modificationTime; |
| 8475 AnalysisEngine.instance.instrumentationService.logFileRead( | 8496 AnalysisEngine.instance.instrumentationService.logFileRead( |
| 8476 source.fullName, _modificationTime, _content); | 8497 source.fullName, _modificationTime, _content); |
| 8477 } catch (exception, stackTrace) { | 8498 } catch (exception, stackTrace) { |
| 8478 errors.add(new AnalysisError.con1( | 8499 errors.add(new AnalysisError( |
| 8479 source, ScannerErrorCode.UNABLE_GET_CONTENT, [exception])); | 8500 source, 0, 0, ScannerErrorCode.UNABLE_GET_CONTENT, [exception])); |
| 8480 throw new AnalysisException("Could not get contents of $source", | 8501 throw new AnalysisException("Could not get contents of $source", |
| 8481 new CaughtException(exception, stackTrace)); | 8502 new CaughtException(exception, stackTrace)); |
| 8482 } | 8503 } |
| 8483 } | 8504 } |
| 8484 } | 8505 } |
| 8485 | 8506 |
| 8486 /** | 8507 /** |
| 8487 * The information cached by an analysis context about an individual HTML file. | 8508 * The information cached by an analysis context about an individual HTML file. |
| 8488 */ | 8509 */ |
| 8489 class HtmlEntry extends SourceEntry { | 8510 class HtmlEntry extends SourceEntry { |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9159 * explanation of why the error occurred or what it means. The [exception] is | 9180 * explanation of why the error occurred or what it means. The [exception] is |
| 9160 * expected to be the reason for the error. At least one argument must be | 9181 * expected to be the reason for the error. At least one argument must be |
| 9161 * provided. | 9182 * provided. |
| 9162 */ | 9183 */ |
| 9163 void logError(String message, [CaughtException exception]); | 9184 void logError(String message, [CaughtException exception]); |
| 9164 | 9185 |
| 9165 /** | 9186 /** |
| 9166 * Log the given [exception] as one representing an error. The [message] is an | 9187 * Log the given [exception] as one representing an error. The [message] is an |
| 9167 * explanation of why the error occurred or what it means. | 9188 * explanation of why the error occurred or what it means. |
| 9168 */ | 9189 */ |
| 9169 @deprecated | 9190 @deprecated // Use logError(message, exception) |
| 9170 void logError2(String message, Object exception); | 9191 void logError2(String message, Object exception); |
| 9171 | 9192 |
| 9172 /** | 9193 /** |
| 9173 * Log the given informational message. The [message] is expected to be an | 9194 * Log the given informational message. The [message] is expected to be an |
| 9174 * explanation of why the error occurred or what it means. The [exception] is | 9195 * explanation of why the error occurred or what it means. The [exception] is |
| 9175 * expected to be the reason for the error. | 9196 * expected to be the reason for the error. |
| 9176 */ | 9197 */ |
| 9177 void logInformation(String message, [CaughtException exception]); | 9198 void logInformation(String message, [CaughtException exception]); |
| 9178 | 9199 |
| 9179 /** | 9200 /** |
| 9180 * Log the given [exception] as one representing an informational message. The | 9201 * Log the given [exception] as one representing an informational message. The |
| 9181 * [message] is an explanation of why the error occurred or what it means. | 9202 * [message] is an explanation of why the error occurred or what it means. |
| 9182 */ | 9203 */ |
| 9183 @deprecated | 9204 @deprecated // Use logInformation(message, exception) |
| 9184 void logInformation2(String message, Object exception); | 9205 void logInformation2(String message, Object exception); |
| 9185 } | 9206 } |
| 9186 | 9207 |
| 9187 /** | 9208 /** |
| 9188 * An implementation of [Logger] that does nothing. | 9209 * An implementation of [Logger] that does nothing. |
| 9189 */ | 9210 */ |
| 9190 class NullLogger implements Logger { | 9211 class NullLogger implements Logger { |
| 9191 @override | 9212 @override |
| 9192 void logError(String message, [CaughtException exception]) {} | 9213 void logError(String message, [CaughtException exception]) {} |
| 9193 | 9214 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9441 directive.source = source; | 9462 directive.source = source; |
| 9442 return source; | 9463 return source; |
| 9443 } on JavaIOException { | 9464 } on JavaIOException { |
| 9444 code = UriValidationCode.INVALID_URI; | 9465 code = UriValidationCode.INVALID_URI; |
| 9445 } | 9466 } |
| 9446 } | 9467 } |
| 9447 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { | 9468 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { |
| 9448 return null; | 9469 return null; |
| 9449 } | 9470 } |
| 9450 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { | 9471 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { |
| 9451 errorListener.onError(new AnalysisError.con2(librarySource, | 9472 errorListener.onError(new AnalysisError(librarySource, uriLiteral.offset, |
| 9452 uriLiteral.offset, uriLiteral.length, | 9473 uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION)); |
| 9453 CompileTimeErrorCode.URI_WITH_INTERPOLATION)); | |
| 9454 return null; | 9474 return null; |
| 9455 } | 9475 } |
| 9456 if (code == UriValidationCode.INVALID_URI) { | 9476 if (code == UriValidationCode.INVALID_URI) { |
| 9457 errorListener.onError(new AnalysisError.con2(librarySource, | 9477 errorListener.onError(new AnalysisError(librarySource, uriLiteral.offset, |
| 9458 uriLiteral.offset, uriLiteral.length, | 9478 uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
| 9459 CompileTimeErrorCode.INVALID_URI, [uriContent])); | |
| 9460 return null; | 9479 return null; |
| 9461 } | 9480 } |
| 9462 throw new RuntimeException( | 9481 throw new RuntimeException( |
| 9463 message: "Failed to handle validation code: $code"); | 9482 message: "Failed to handle validation code: $code"); |
| 9464 } | 9483 } |
| 9465 } | 9484 } |
| 9466 | 9485 |
| 9467 /** | 9486 /** |
| 9468 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. | 9487 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. |
| 9469 */ | 9488 */ |
| (...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11664 PendingFuture pendingFuture = | 11683 PendingFuture pendingFuture = |
| 11665 new PendingFuture<T>(_context, source, computeValue); | 11684 new PendingFuture<T>(_context, source, computeValue); |
| 11666 if (!pendingFuture.evaluate(sourceEntry)) { | 11685 if (!pendingFuture.evaluate(sourceEntry)) { |
| 11667 _context._pendingFutureSources | 11686 _context._pendingFutureSources |
| 11668 .putIfAbsent(source, () => <PendingFuture>[]) | 11687 .putIfAbsent(source, () => <PendingFuture>[]) |
| 11669 .add(pendingFuture); | 11688 .add(pendingFuture); |
| 11670 } | 11689 } |
| 11671 return pendingFuture.future; | 11690 return pendingFuture.future; |
| 11672 } | 11691 } |
| 11673 } | 11692 } |
| OLD | NEW |