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

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

Issue 186153005: New analzyer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use meaningful name instead of '_' in predicate. 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
« 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1320
1321 CacheState(String name, int ordinal) : super(name, ordinal); 1321 CacheState(String name, int ordinal) : super(name, ordinal);
1322 } 1322 }
1323 1323
1324 /** 1324 /**
1325 * The interface `DartEntry` defines the behavior of objects that maintain the i nformation 1325 * The interface `DartEntry` defines the behavior of objects that maintain the i nformation
1326 * cached by an analysis context about an individual Dart file. 1326 * cached by an analysis context about an individual Dart file.
1327 */ 1327 */
1328 abstract class DartEntry implements SourceEntry { 1328 abstract class DartEntry implements SourceEntry {
1329 /** 1329 /**
1330 * The data descriptor representing the errors reported during Angular resolut ion.
1331 */
1332 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS");
1333
1334 /**
1330 * The data descriptor representing the list of libraries that contain this co mpilation unit. 1335 * The data descriptor representing the list of libraries that contain this co mpilation unit.
1331 */ 1336 */
1332 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); 1337 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES");
1333 1338
1334 /** 1339 /**
1335 * The data descriptor representing the library element for the library. This data is only 1340 * The data descriptor representing the library element for the library. This data is only
1336 * available for Dart files that are the defining compilation unit of a librar y. 1341 * available for Dart files that are the defining compilation unit of a librar y.
1337 */ 1342 */
1338 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra ryElement>("DartEntry.ELEMENT"); 1343 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra ryElement>("DartEntry.ELEMENT");
1339 1344
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 * The data descriptor representing the errors resulting from resolving the so urce. 1397 * The data descriptor representing the errors resulting from resolving the so urce.
1393 */ 1398 */
1394 static final DataDescriptor<List<AnalysisError>> RESOLUTION_ERRORS = new DataD escriptor<List<AnalysisError>>("DartEntry.RESOLUTION_ERRORS"); 1399 static final DataDescriptor<List<AnalysisError>> RESOLUTION_ERRORS = new DataD escriptor<List<AnalysisError>>("DartEntry.RESOLUTION_ERRORS");
1395 1400
1396 /** 1401 /**
1397 * The data descriptor representing the resolved AST structure. 1402 * The data descriptor representing the resolved AST structure.
1398 */ 1403 */
1399 static final DataDescriptor<CompilationUnit> RESOLVED_UNIT = new DataDescripto r<CompilationUnit>("DartEntry.RESOLVED_UNIT"); 1404 static final DataDescriptor<CompilationUnit> RESOLVED_UNIT = new DataDescripto r<CompilationUnit>("DartEntry.RESOLVED_UNIT");
1400 1405
1401 /** 1406 /**
1407 * The data descriptor representing the token stream.
1408 */
1409 static final DataDescriptor<List<AnalysisError>> SCAN_ERRORS = new DataDescrip tor<List<AnalysisError>>("DartEntry.SCAN_ERRORS");
1410
1411 /**
1402 * The data descriptor representing the source kind. 1412 * The data descriptor representing the source kind.
1403 */ 1413 */
1404 static final DataDescriptor<SourceKind> SOURCE_KIND = new DataDescriptor<Sourc eKind>("DartEntry.SOURCE_KIND"); 1414 static final DataDescriptor<SourceKind> SOURCE_KIND = new DataDescriptor<Sourc eKind>("DartEntry.SOURCE_KIND");
1405 1415
1406 /** 1416 /**
1407 * The data descriptor representing the token stream. 1417 * The data descriptor representing the token stream.
1408 */
1409 static final DataDescriptor<List<AnalysisError>> SCAN_ERRORS = new DataDescrip tor<List<AnalysisError>>("DartEntry.SCAN_ERRORS");
1410
1411 /**
1412 * The data descriptor representing the token stream.
1413 */ 1418 */
1414 static final DataDescriptor<Token> TOKEN_STREAM = new DataDescriptor<Token>("D artEntry.TOKEN_STREAM"); 1419 static final DataDescriptor<Token> TOKEN_STREAM = new DataDescriptor<Token>("D artEntry.TOKEN_STREAM");
1415 1420
1416 /** 1421 /**
1417 * The data descriptor representing the errors resulting from verifying the so urce. 1422 * The data descriptor representing the errors resulting from verifying the so urce.
1418 */ 1423 */
1419 static final DataDescriptor<List<AnalysisError>> VERIFICATION_ERRORS = new Dat aDescriptor<List<AnalysisError>>("DartEntry.VERIFICATION_ERRORS"); 1424 static final DataDescriptor<List<AnalysisError>> VERIFICATION_ERRORS = new Dat aDescriptor<List<AnalysisError>>("DartEntry.VERIFICATION_ERRORS");
1420 1425
1421 /** 1426 /**
1422 * The data descriptor representing the errors reported during Angular resolut ion.
1423 */
1424 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS");
1425
1426 /**
1427 * Return all of the errors associated with the compilation unit that are curr ently cached. 1427 * Return all of the errors associated with the compilation unit that are curr ently cached.
1428 * 1428 *
1429 * @return all of the errors associated with the compilation unit 1429 * @return all of the errors associated with the compilation unit
1430 */ 1430 */
1431 List<AnalysisError> get allErrors; 1431 List<AnalysisError> get allErrors;
1432 1432
1433 /** 1433 /**
1434 * Return a valid parsed compilation unit, either an unresolved AST structure or the result of 1434 * Return a valid parsed compilation unit, either an unresolved AST structure or the result of
1435 * resolving the AST structure in the context of some library, or `null` if th ere is no 1435 * resolving the AST structure in the context of some library, or `null` if th ere is no
1436 * parsed compilation unit available. 1436 * parsed compilation unit available.
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 while (state != null) { 1966 while (state != null) {
1967 CacheState resolvedState = state._resolvedUnitState; 1967 CacheState resolvedState = state._resolvedUnitState;
1968 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH ED) { 1968 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH ED) {
1969 return false; 1969 return false;
1970 } 1970 }
1971 state = state._nextState; 1971 state = state._nextState;
1972 } 1972 }
1973 return true; 1973 return true;
1974 } 1974 }
1975 1975
1976 void recordContentError() {
1977 super.recordContentError();
1978 recordScanError();
1979 }
1980
1976 /** 1981 /**
1977 * Record that an error occurred while attempting to resolve the directives in the source 1982 * Record that an error occurred while attempting to resolve the directives in the source
1978 * represented by this entry. 1983 * represented by this entry.
1979 */ 1984 */
1980 void recordDependencyError() { 1985 void recordDependencyError() {
1981 _exportedLibraries = Source.EMPTY_ARRAY; 1986 _exportedLibraries = Source.EMPTY_ARRAY;
1982 _exportedLibrariesState = CacheState.ERROR; 1987 _exportedLibrariesState = CacheState.ERROR;
1983 _importedLibraries = Source.EMPTY_ARRAY; 1988 _importedLibraries = Source.EMPTY_ARRAY;
1984 _importedLibrariesState = CacheState.ERROR; 1989 _importedLibrariesState = CacheState.ERROR;
1985 _includedParts = Source.EMPTY_ARRAY; 1990 _includedParts = Source.EMPTY_ARRAY;
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 _angularErrors = AnalysisError.NO_ERRORS; 3024 _angularErrors = AnalysisError.NO_ERRORS;
3020 _angularErrorsState = CacheState.INVALID; 3025 _angularErrorsState = CacheState.INVALID;
3021 _element = null; 3026 _element = null;
3022 _elementState = CacheState.INVALID; 3027 _elementState = CacheState.INVALID;
3023 _resolutionErrors = AnalysisError.NO_ERRORS; 3028 _resolutionErrors = AnalysisError.NO_ERRORS;
3024 _resolutionErrorsState = CacheState.INVALID; 3029 _resolutionErrorsState = CacheState.INVALID;
3025 _hints = AnalysisError.NO_ERRORS; 3030 _hints = AnalysisError.NO_ERRORS;
3026 _hintsState = CacheState.INVALID; 3031 _hintsState = CacheState.INVALID;
3027 } 3032 }
3028 3033
3034 void recordContentError() {
3035 super.recordContentError();
3036 recordParseError();
3037 }
3038
3029 /** 3039 /**
3030 * Record that an error was encountered while attempting to parse the source a ssociated with this 3040 * Record that an error was encountered while attempting to parse the source a ssociated with this
3031 * entry. 3041 * entry.
3032 */ 3042 */
3033 void recordParseError() { 3043 void recordParseError() {
3034 setState(SourceEntry.LINE_INFO, CacheState.ERROR); 3044 setState(SourceEntry.LINE_INFO, CacheState.ERROR);
3035 setState(HtmlEntry.PARSE_ERRORS, CacheState.ERROR); 3045 setState(HtmlEntry.PARSE_ERRORS, CacheState.ERROR);
3036 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); 3046 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR);
3037 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); 3047 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR);
3038 recordResolutionError(); 3048 recordResolutionError();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 3224
3215 /** 3225 /**
3216 * The interface `SourceEntry` defines the behavior of objects that maintain the information 3226 * The interface `SourceEntry` defines the behavior of objects that maintain the information
3217 * cached by an analysis context about an individual source, no matter what kind of source it is. 3227 * cached by an analysis context about an individual source, no matter what kind of source it is.
3218 * 3228 *
3219 * Source entries should be treated as if they were immutable unless a writable copy of the entry 3229 * Source entries should be treated as if they were immutable unless a writable copy of the entry
3220 * has been obtained and has not yet been made visible to other threads. 3230 * has been obtained and has not yet been made visible to other threads.
3221 */ 3231 */
3222 abstract class SourceEntry { 3232 abstract class SourceEntry {
3223 /** 3233 /**
3234 * The data descriptor representing the contents of the source.
3235 */
3236 static final DataDescriptor<String> CONTENT = new DataDescriptor<String>("Dart Entry.CONTENT");
3237
3238 /**
3224 * The data descriptor representing the line information. 3239 * The data descriptor representing the line information.
3225 */ 3240 */
3226 static final DataDescriptor<LineInfo> LINE_INFO = new DataDescriptor<LineInfo> ("SourceEntry.LINE_INFO"); 3241 static final DataDescriptor<LineInfo> LINE_INFO = new DataDescriptor<LineInfo> ("SourceEntry.LINE_INFO");
3227 3242
3228 /** 3243 /**
3229 * Return the exception that caused one or more values to have a state of [Cac heState#ERROR] 3244 * Return the exception that caused one or more values to have a state of [Cac heState#ERROR]
3230 * . 3245 * .
3231 * 3246 *
3232 * @return the exception that caused one or more values to be uncomputable 3247 * @return the exception that caused one or more values to be uncomputable
3233 */ 3248 */
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 * entry. 3299 * entry.
3285 */ 3300 */
3286 int _modificationTime = 0; 3301 int _modificationTime = 0;
3287 3302
3288 /** 3303 /**
3289 * The exception that caused one or more values to have a state of [CacheState #ERROR]. 3304 * The exception that caused one or more values to have a state of [CacheState #ERROR].
3290 */ 3305 */
3291 AnalysisException exception; 3306 AnalysisException exception;
3292 3307
3293 /** 3308 /**
3309 * The state of the cached content.
3310 */
3311 CacheState _contentState = CacheState.INVALID;
3312
3313 /**
3314 * The content of the source, or `null` if the content is not currently cached .
3315 */
3316 String _content;
3317
3318 /**
3294 * The state of the cached line information. 3319 * The state of the cached line information.
3295 */ 3320 */
3296 CacheState _lineInfoState = CacheState.INVALID; 3321 CacheState _lineInfoState = CacheState.INVALID;
3297 3322
3298 /** 3323 /**
3299 * The line information computed for the source, or `null` if the line informa tion is not 3324 * The line information computed for the source, or `null` if the line informa tion is not
3300 * currently cached. 3325 * currently cached.
3301 */ 3326 */
3302 LineInfo _lineInfo; 3327 LineInfo _lineInfo;
3303 3328
(...skipping 10 matching lines...) Expand all
3314 exception = new AnalysisException.con1("State set to ERROR without setti ng an exception"); 3339 exception = new AnalysisException.con1("State set to ERROR without setti ng an exception");
3315 } 3340 }
3316 } else { 3341 } else {
3317 exception = null; 3342 exception = null;
3318 } 3343 }
3319 } 3344 }
3320 3345
3321 int get modificationTime => _modificationTime; 3346 int get modificationTime => _modificationTime;
3322 3347
3323 CacheState getState(DataDescriptor descriptor) { 3348 CacheState getState(DataDescriptor descriptor) {
3324 if (identical(descriptor, SourceEntry.LINE_INFO)) { 3349 if (identical(descriptor, SourceEntry.CONTENT)) {
3350 return _contentState;
3351 } else if (identical(descriptor, SourceEntry.LINE_INFO)) {
3325 return _lineInfoState; 3352 return _lineInfoState;
3326 } else { 3353 } else {
3327 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); 3354 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}");
3328 } 3355 }
3329 } 3356 }
3330 3357
3331 Object getValue(DataDescriptor descriptor) { 3358 Object getValue(DataDescriptor descriptor) {
3332 if (identical(descriptor, SourceEntry.LINE_INFO)) { 3359 if (identical(descriptor, SourceEntry.CONTENT)) {
3360 return _content;
3361 } else if (identical(descriptor, SourceEntry.LINE_INFO)) {
3333 return _lineInfo; 3362 return _lineInfo;
3334 } else { 3363 } else {
3335 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); 3364 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}");
3336 } 3365 }
3337 } 3366 }
3338 3367
3339 /** 3368 /**
3340 * Invalidate all of the information associated with this source. 3369 * Invalidate all of the information associated with this source.
3341 */ 3370 */
3342 void invalidateAllInformation() { 3371 void invalidateAllInformation() {
3372 _content = null;
3373 _contentState = CacheState.INVALID;
3343 _lineInfo = null; 3374 _lineInfo = null;
3344 _lineInfoState = CacheState.INVALID; 3375 _lineInfoState = CacheState.INVALID;
3345 } 3376 }
3346 3377
3347 /** 3378 /**
3379 * Record that an error occurred while attempting to get the contents of the s ource represented by
3380 * this entry. This will set the state of all information, including any resol ution-based
3381 * information, as being in error.
3382 */
3383 void recordContentError() {
3384 _content = null;
3385 _contentState = CacheState.ERROR;
3386 }
3387
3388 /**
3348 * Set the most recent time at which the state of the source matched the state represented by this 3389 * Set the most recent time at which the state of the source matched the state represented by this
3349 * entry to the given time. 3390 * entry to the given time.
3350 * 3391 *
3351 * @param time the new modification time of this entry 3392 * @param time the new modification time of this entry
3352 */ 3393 */
3353 void set modificationTime(int time) { 3394 void set modificationTime(int time) {
3354 _modificationTime = time; 3395 _modificationTime = time;
3355 } 3396 }
3356 3397
3357 /** 3398 /**
3358 * Set the state of the data represented by the given descriptor to the given state. 3399 * Set the state of the data represented by the given descriptor to the given state.
3359 * 3400 *
3360 * @param descriptor the descriptor representing the data whose state is to be set 3401 * @param descriptor the descriptor representing the data whose state is to be set
3361 * @param the new state of the data represented by the given descriptor 3402 * @param the new state of the data represented by the given descriptor
3362 */ 3403 */
3363 void setState(DataDescriptor descriptor, CacheState state) { 3404 void setState(DataDescriptor descriptor, CacheState state) {
3364 if (identical(descriptor, SourceEntry.LINE_INFO)) { 3405 if (identical(descriptor, SourceEntry.CONTENT)) {
3406 _content = updatedValue(state, _content, null);
3407 _contentState = state;
3408 } else if (identical(descriptor, SourceEntry.LINE_INFO)) {
3365 _lineInfo = updatedValue(state, _lineInfo, null); 3409 _lineInfo = updatedValue(state, _lineInfo, null);
3366 _lineInfoState = state; 3410 _lineInfoState = state;
3367 } else { 3411 } else {
3368 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); 3412 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}");
3369 } 3413 }
3370 } 3414 }
3371 3415
3372 /** 3416 /**
3373 * Set the value of the data represented by the given descriptor to the given value. 3417 * Set the value of the data represented by the given descriptor to the given value.
3374 * 3418 *
3375 * @param descriptor the descriptor representing the data whose value is to be set 3419 * @param descriptor the descriptor representing the data whose value is to be set
3376 * @param value the new value of the data represented by the given descriptor 3420 * @param value the new value of the data represented by the given descriptor
3377 */ 3421 */
3378 void setValue(DataDescriptor descriptor, Object value) { 3422 void setValue(DataDescriptor descriptor, Object value) {
3379 if (identical(descriptor, SourceEntry.LINE_INFO)) { 3423 if (identical(descriptor, SourceEntry.CONTENT)) {
3424 _content = value as String;
3425 _contentState = CacheState.VALID;
3426 } else if (identical(descriptor, SourceEntry.LINE_INFO)) {
3380 _lineInfo = value as LineInfo; 3427 _lineInfo = value as LineInfo;
3381 _lineInfoState = CacheState.VALID; 3428 _lineInfoState = CacheState.VALID;
3382 } else { 3429 } else {
3383 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); 3430 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}");
3384 } 3431 }
3385 } 3432 }
3386 3433
3387 String toString() { 3434 String toString() {
3388 JavaStringBuilder builder = new JavaStringBuilder(); 3435 JavaStringBuilder builder = new JavaStringBuilder();
3389 writeOn(builder); 3436 writeOn(builder);
3390 return builder.toString(); 3437 return builder.toString();
3391 } 3438 }
3392 3439
3393 /** 3440 /**
3394 * Copy the information from the given cache entry. 3441 * Copy the information from the given cache entry.
3395 * 3442 *
3396 * @param entry the cache entry from which information will be copied 3443 * @param entry the cache entry from which information will be copied
3397 */ 3444 */
3398 void copyFrom(SourceEntryImpl entry) { 3445 void copyFrom(SourceEntryImpl entry) {
3399 _modificationTime = entry._modificationTime; 3446 _modificationTime = entry._modificationTime;
3400 exception = entry.exception; 3447 exception = entry.exception;
3448 _contentState = entry._contentState;
3449 _content = entry._content;
3401 _lineInfoState = entry._lineInfoState; 3450 _lineInfoState = entry._lineInfoState;
3402 _lineInfo = entry._lineInfo; 3451 _lineInfo = entry._lineInfo;
3403 } 3452 }
3404 3453
3405 /** 3454 /**
3406 * Return `true` if the state of any data value is [CacheState#ERROR]. 3455 * Return `true` if the state of any data value is [CacheState#ERROR].
3407 * 3456 *
3408 * @return `true` if the state of any data value is [CacheState#ERROR] 3457 * @return `true` if the state of any data value is [CacheState#ERROR]
3409 */ 3458 */
3410 bool hasErrorState() => identical(_lineInfoState, CacheState.ERROR); 3459 bool hasErrorState() => identical(_contentState, CacheState.ERROR) || identica l(_lineInfoState, CacheState.ERROR);
3411 3460
3412 /** 3461 /**
3413 * Given that some data is being transitioned to the given state, return the v alue that should be 3462 * Given that some data is being transitioned to the given state, return the v alue that should be
3414 * kept in the cache. 3463 * kept in the cache.
3415 * 3464 *
3416 * @param state the state to which the data is being transitioned 3465 * @param state the state to which the data is being transitioned
3417 * @param currentValue the value of the data before the transition 3466 * @param currentValue the value of the data before the transition
3418 * @param defaultValue the value to be used if the current value is to be remo ved from the cache 3467 * @param defaultValue the value to be used if the current value is to be remo ved from the cache
3419 * @return the value of the data that should be kept in the cache 3468 * @return the value of the data that should be kept in the cache
3420 */ 3469 */
(...skipping 10 matching lines...) Expand all
3431 } 3480 }
3432 3481
3433 /** 3482 /**
3434 * Write a textual representation of this entry to the given builder. The resu lt will only be used 3483 * Write a textual representation of this entry to the given builder. The resu lt will only be used
3435 * for debugging purposes. 3484 * for debugging purposes.
3436 * 3485 *
3437 * @param builder the builder to which the text should be written 3486 * @param builder the builder to which the text should be written
3438 */ 3487 */
3439 void writeOn(JavaStringBuilder builder) { 3488 void writeOn(JavaStringBuilder builder) {
3440 builder.append("time = "); 3489 builder.append("time = ");
3441 builder.append(_modificationTime.toRadixString(16)); 3490 builder.append(_modificationTime);
3491 builder.append("; content = ");
3492 builder.append(_contentState);
3442 builder.append("; lineInfo = "); 3493 builder.append("; lineInfo = ");
3443 builder.append(_lineInfoState); 3494 builder.append(_lineInfoState);
3444 } 3495 }
3445 } 3496 }
3446 3497
3447 /** 3498 /**
3448 * Implementation of the [AnalysisContentStatistics]. 3499 * Implementation of the [AnalysisContentStatistics].
3449 */ 3500 */
3450 class AnalysisContentStatisticsImpl implements AnalysisContentStatistics { 3501 class AnalysisContentStatisticsImpl implements AnalysisContentStatistics {
3451 Map<String, AnalysisContentStatistics_CacheRow> _dataMap = new Map<String, Ana lysisContentStatistics_CacheRow>(); 3502 Map<String, AnalysisContentStatistics_CacheRow> _dataMap = new Map<String, Ana lysisContentStatistics_CacheRow>();
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni t could not parse ${source.fullName}"); 3905 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni t could not parse ${source.fullName}");
3855 } 3906 }
3856 // If the unit is ever modified by resolution then we will need to create a copy of it. 3907 // If the unit is ever modified by resolution then we will need to create a copy of it.
3857 return new ResolvableHtmlUnit(htmlEntry.modificationTime, unit); 3908 return new ResolvableHtmlUnit(htmlEntry.modificationTime, unit);
3858 } 3909 }
3859 3910
3860 bool exists(Source source) { 3911 bool exists(Source source) {
3861 if (source == null) { 3912 if (source == null) {
3862 return false; 3913 return false;
3863 } 3914 }
3864 if (_contentCache.getContents(source) != null) { 3915 {
3865 return true; 3916 if (_contentCache.getContents(source) != null) {
3917 return true;
3918 }
3866 } 3919 }
3867 return source.exists(); 3920 return source.exists();
3868 } 3921 }
3869 3922
3870 AnalysisContext extractContext(SourceContainer container) => extractContextInt o(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysis Context); 3923 AnalysisContext extractContext(SourceContainer container) => extractContextInt o(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysis Context);
3871 3924
3872 InternalAnalysisContext extractContextInto(SourceContainer container, Internal AnalysisContext newContext) { 3925 InternalAnalysisContext extractContextInto(SourceContainer container, Internal AnalysisContext newContext) {
3873 List<Source> sourcesToRemove = new List<Source>(); 3926 List<Source> sourcesToRemove = new List<Source>();
3874 { 3927 {
3875 // Move sources in the specified directory to the new context 3928 // Move sources in the specified directory to the new context
(...skipping 22 matching lines...) Expand all
3898 for (CompilationUnitElement partUnit in libraryElement.parts) { 3951 for (CompilationUnitElement partUnit in libraryElement.parts) {
3899 if (partUnit.source == unitSource) { 3952 if (partUnit.source == unitSource) {
3900 return partUnit; 3953 return partUnit;
3901 } 3954 }
3902 } 3955 }
3903 } 3956 }
3904 return null; 3957 return null;
3905 } 3958 }
3906 3959
3907 TimestampedData<String> getContents(Source source) { 3960 TimestampedData<String> getContents(Source source) {
3908 String contents = _contentCache.getContents(source); 3961 {
3909 if (contents != null) { 3962 String contents = _contentCache.getContents(source);
3910 return new TimestampedData<String>(_contentCache.getModificationStamp(sour ce), contents); 3963 if (contents != null) {
3964 return new TimestampedData<String>(_contentCache.getModificationStamp(so urce), contents);
3965 }
3911 } 3966 }
3912 return source.contents; 3967 return source.contents;
3913 } 3968 }
3914 3969
3915 void getContentsToReceiver(Source source, Source_ContentReceiver receiver) { 3970 void getContentsToReceiver(Source source, Source_ContentReceiver receiver) {
3916 String contents = _contentCache.getContents(source); 3971 {
3917 if (contents != null) { 3972 String contents = _contentCache.getContents(source);
3918 receiver.accept(contents, _contentCache.getModificationStamp(source)); 3973 if (contents != null) {
3919 return; 3974 receiver.accept(contents, _contentCache.getModificationStamp(source));
3975 return;
3976 }
3920 } 3977 }
3921 source.getContentsToReceiver(receiver); 3978 source.getContentsToReceiver(receiver);
3922 } 3979 }
3923 3980
3924 Element getElement(ElementLocation location) { 3981 Element getElement(ElementLocation location) {
3925 // TODO(brianwilkerson) This should not be a "get" method. 3982 // TODO(brianwilkerson) This should not be a "get" method.
3926 try { 3983 try {
3927 List<String> components = (location as ElementLocationImpl).components; 3984 List<String> components = (location as ElementLocationImpl).components;
3928 Source librarySource = computeSourceFromEncoding(components[0]); 3985 Source librarySource = computeSourceFromEncoding(components[0]);
3929 ElementImpl element = computeLibraryElement(librarySource) as ElementImpl; 3986 ElementImpl element = computeLibraryElement(librarySource) as ElementImpl;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4076 4133
4077 LineInfo getLineInfo(Source source) { 4134 LineInfo getLineInfo(Source source) {
4078 SourceEntry sourceEntry = getReadableSourceEntry(source); 4135 SourceEntry sourceEntry = getReadableSourceEntry(source);
4079 if (sourceEntry != null) { 4136 if (sourceEntry != null) {
4080 return sourceEntry.getValue(SourceEntry.LINE_INFO); 4137 return sourceEntry.getValue(SourceEntry.LINE_INFO);
4081 } 4138 }
4082 return null; 4139 return null;
4083 } 4140 }
4084 4141
4085 int getModificationStamp(Source source) { 4142 int getModificationStamp(Source source) {
4086 int stamp = _contentCache.getModificationStamp(source); 4143 {
4087 if (stamp != null) { 4144 int stamp = _contentCache.getModificationStamp(source);
4088 return stamp; 4145 if (stamp != null) {
4146 return stamp;
4147 }
4089 } 4148 }
4090 return source.modificationStamp; 4149 return source.modificationStamp;
4091 } 4150 }
4092 4151
4093 Namespace getPublicNamespace(LibraryElement library) { 4152 Namespace getPublicNamespace(LibraryElement library) {
4094 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this is not part of the 4153 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this is not part of the
4095 // API of the interface. 4154 // API of the interface.
4096 Source source = library.definingCompilationUnit.source; 4155 Source source = library.definingCompilationUnit.source;
4097 DartEntry dartEntry = getReadableDartEntry(source); 4156 DartEntry dartEntry = getReadableDartEntry(source);
4098 if (dartEntry == null) { 4157 if (dartEntry == null) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
4464 void setChangedContents(Source source, String contents, int offset, int oldLen gth, int newLength) { 4523 void setChangedContents(Source source, String contents, int offset, int oldLen gth, int newLength) {
4465 { 4524 {
4466 _recentTasks.clear(); 4525 _recentTasks.clear();
4467 String originalContents = _contentCache.setContents(source, contents); 4526 String originalContents = _contentCache.setContents(source, contents);
4468 if (contents != null) { 4527 if (contents != null) {
4469 if (contents != originalContents) { 4528 if (contents != originalContents) {
4470 if (_options.incremental) { 4529 if (_options.incremental) {
4471 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increme ntalAnalysisCache, source, originalContents, contents, offset, oldLength, newLen gth, getReadableSourceEntry(source)); 4530 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increme ntalAnalysisCache, source, originalContents, contents, offset, oldLength, newLen gth, getReadableSourceEntry(source));
4472 } 4531 }
4473 sourceChanged(source); 4532 sourceChanged(source);
4533 SourceEntry sourceEntry = _cache.get(source);
4534 if (sourceEntry != null) {
4535 SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
4536 sourceCopy.modificationTime = _contentCache.getModificationStamp(sou rce);
4537 sourceCopy.setValue(SourceEntry.CONTENT, contents);
4538 _cache.put(source, sourceCopy);
4539 }
4474 } 4540 }
4475 } else if (originalContents != null) { 4541 } else if (originalContents != null) {
4476 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA nalysisCache, source); 4542 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA nalysisCache, source);
4477 sourceChanged(source); 4543 sourceChanged(source);
4478 } 4544 }
4479 } 4545 }
4480 } 4546 }
4481 4547
4482 void setContents(Source source, String contents) { 4548 void setContents(Source source, String contents) {
4483 { 4549 {
4484 _recentTasks.clear(); 4550 _recentTasks.clear();
4485 String originalContents = _contentCache.setContents(source, contents); 4551 String originalContents = _contentCache.setContents(source, contents);
4486 if (contents != null) { 4552 if (contents != null) {
4487 if (contents != originalContents) { 4553 if (contents != originalContents) {
4488 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementa lAnalysisCache, source); 4554 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementa lAnalysisCache, source);
4489 sourceChanged(source); 4555 sourceChanged(source);
4556 SourceEntry sourceEntry = _cache.get(source);
4557 if (sourceEntry != null) {
4558 SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
4559 sourceCopy.modificationTime = _contentCache.getModificationStamp(sou rce);
4560 sourceCopy.setValue(SourceEntry.CONTENT, contents);
4561 _cache.put(source, sourceCopy);
4562 }
4490 } 4563 }
4491 } else if (originalContents != null) { 4564 } else if (originalContents != null) {
4492 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA nalysisCache, source); 4565 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA nalysisCache, source);
4493 sourceChanged(source); 4566 sourceChanged(source);
4494 } 4567 }
4495 } 4568 }
4496 } 4569 }
4497 4570
4498 void set sourceFactory(SourceFactory factory) { 4571 void set sourceFactory(SourceFactory factory) {
4499 { 4572 {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
4915 } 4988 }
4916 // 4989 //
4917 // Check to see whether we already have the information being requested. 4990 // Check to see whether we already have the information being requested.
4918 // 4991 //
4919 CacheState state = htmlEntry.getState(descriptor); 4992 CacheState state = htmlEntry.getState(descriptor);
4920 while (state != CacheState.ERROR && state != CacheState.VALID) { 4993 while (state != CacheState.ERROR && state != CacheState.VALID) {
4921 // 4994 //
4922 // If not, compute the information. Unless the modification date of the so urce continues to 4995 // If not, compute the information. Unless the modification date of the so urce continues to
4923 // change, this loop will eventually terminate. 4996 // change, this loop will eventually terminate.
4924 // 4997 //
4925 htmlEntry = new ParseHtmlTask(this, source).perform(_resultRecorder) as Ht mlEntry; 4998 // TODO(brianwilkerson) Convert this to get the contents from the cache. ( I'm not sure how
4999 // that would work in an asynchronous environment.)
5000 try {
5001 htmlEntry = new ParseHtmlTask(this, source, getContents(source)).perform (_resultRecorder) as HtmlEntry;
5002 } on AnalysisException catch (exception) {
5003 throw exception;
5004 } on JavaException catch (exception) {
5005 throw new AnalysisException.con3(exception);
5006 }
4926 state = htmlEntry.getState(descriptor); 5007 state = htmlEntry.getState(descriptor);
4927 } 5008 }
4928 return htmlEntry; 5009 return htmlEntry;
4929 } 5010 }
4930 5011
4931 /** 5012 /**
4932 * Given a source for an HTML file, return a cache entry in which the state of the data 5013 * Given a source for an HTML file, return a cache entry in which the state of the data
4933 * represented by the given descriptor is either [CacheState#VALID] or 5014 * represented by the given descriptor is either [CacheState#VALID] or
4934 * [CacheState#ERROR]. This method assumes that the data can be produced by re solving the 5015 * [CacheState#ERROR]. This method assumes that the data can be produced by re solving the
4935 * source if it is not already cached. 5016 * source if it is not already cached.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
5342 /** 5423 /**
5343 * Look through the cache for a task that needs to be performed. Return the ta sk that was found, 5424 * Look through the cache for a task that needs to be performed. Return the ta sk that was found,
5344 * or `null` if there is no more work to be done. 5425 * or `null` if there is no more work to be done.
5345 * 5426 *
5346 * @return the next task that needs to be performed 5427 * @return the next task that needs to be performed
5347 */ 5428 */
5348 AnalysisTask get nextAnalysisTask { 5429 AnalysisTask get nextAnalysisTask {
5349 { 5430 {
5350 bool hintsEnabled = _options.hint; 5431 bool hintsEnabled = _options.hint;
5351 bool sdkErrorsEnabled = _options.generateSdkErrors; 5432 bool sdkErrorsEnabled = _options.generateSdkErrors;
5433 bool hasBlockedTask = false;
5352 // 5434 //
5353 // Look for incremental analysis 5435 // Look for incremental analysis
5354 // 5436 //
5355 if (_incrementalAnalysisCache != null && _incrementalAnalysisCache.hasWork ()) { 5437 if (_incrementalAnalysisCache != null && _incrementalAnalysisCache.hasWork ()) {
5356 AnalysisTask task = new IncrementalAnalysisTask(this, _incrementalAnalys isCache); 5438 AnalysisTask task = new IncrementalAnalysisTask(this, _incrementalAnalys isCache);
5357 _incrementalAnalysisCache = null; 5439 _incrementalAnalysisCache = null;
5358 return task; 5440 return task;
5359 } 5441 }
5360 // 5442 //
5361 // Look for a priority source that needs to be analyzed. 5443 // Look for a priority source that needs to be analyzed.
5362 // 5444 //
5363 for (Source source in _priorityOrder) { 5445 for (Source source in _priorityOrder) {
5364 AnalysisTask task = getNextAnalysisTask2(source, _cache.get(source), tru e, hintsEnabled, sdkErrorsEnabled); 5446 AnalysisContextImpl_TaskData taskData = getNextNondependentAnalysisTask( source, hintsEnabled, sdkErrorsEnabled);
5447 AnalysisTask task = taskData.task;
5365 if (task != null) { 5448 if (task != null) {
5366 return task; 5449 return task;
5450 } else if (taskData.isBlocked) {
5451 hasBlockedTask = true;
5367 } 5452 }
5368 } 5453 }
5369 // 5454 //
5370 // Look for a non-priority source that needs to be analyzed. 5455 // Look for a non-priority source that needs to be analyzed.
5371 // 5456 //
5372 Source source = _workManager.nextSource; 5457 Source source = _workManager.nextSource;
5373 while (source != null) { 5458 while (source != null) {
5374 AnalysisTask task = getNextAnalysisTask2(source, _cache.get(source), fal se, hintsEnabled, sdkErrorsEnabled); 5459 AnalysisContextImpl_TaskData taskData = getNextNondependentAnalysisTask( source, hintsEnabled, sdkErrorsEnabled);
5460 AnalysisTask task = taskData.task;
5375 if (task != null) { 5461 if (task != null) {
5376 return task; 5462 return task;
5463 } else if (taskData.isBlocked) {
5464 hasBlockedTask = true;
5465 } else {
5466 _workManager.remove(source);
5377 } 5467 }
5378 _workManager.remove(source);
5379 source = _workManager.nextSource; 5468 source = _workManager.nextSource;
5380 } 5469 }
5381 // // 5470 // //
5382 // // Look for a non-priority source that needs to be analyzed and wa s missed by the loop above. 5471 // // Look for a non-priority source that needs to be analyzed and wa s missed by the loop above.
5383 // // 5472 // //
5384 // for (Map.Entry<Source, SourceEntry> entry : cache.entrySet()) { 5473 // for (Map.Entry<Source, SourceEntry> entry : cache.entrySet()) {
5385 // source = entry.getKey(); 5474 // source = entry.getKey();
5386 // AnalysisTask task = getNextAnalysisTask(source, entry.getValue() , false, hintsEnabled); 5475 // TaskData taskData = getNextAnalysisTaskForSource(source, entry.g etValue(), false, hintsEnabled);
5476 // AnalysisTask task = taskData.getTask();
5387 // if (task != null) { 5477 // if (task != null) {
5388 // System.out.println("Failed to analyze " + source.getFullName() ); 5478 // System.out.println("Failed to analyze " + source.getFullName() );
5389 // return task; 5479 // return task;
5390 // } 5480 // }
5391 // } 5481 // }
5482 if (hasBlockedTask) {
5483 return WaitForAsyncTask.instance;
5484 }
5392 return null; 5485 return null;
5393 } 5486 }
5394 } 5487 }
5395 5488
5396 /** 5489 /**
5397 * Look at the given source to see whether a task needs to be performed relate d to it. Return the 5490 * Look at the given source to see whether a task needs to be performed relate d to it. Return the
5398 * task that should be performed, or `null` if there is no more work to be don e for the 5491 * task that should be performed, or `null` if there is no more work to be don e for the
5399 * source. 5492 * source.
5400 * 5493 *
5401 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 5494 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
5402 * 5495 *
5403 * @param source the source to be checked 5496 * @param source the source to be checked
5404 * @param sourceEntry the cache entry associated with the source 5497 * @param sourceEntry the cache entry associated with the source
5405 * @param isPriority `true` if the source is a priority source 5498 * @param isPriority `true` if the source is a priority source
5406 * @param hintsEnabled `true` if hints are currently enabled 5499 * @param hintsEnabled `true` if hints are currently enabled
5407 * @param sdkErrorsEnabled `true` if errors, warnings and hints should be gene rated for 5500 * @param sdkErrorsEnabled `true` if errors, warnings and hints should be gene rated for
5408 * sources in the SDK 5501 * sources in the SDK
5409 * @return the next task that needs to be performed for the given source 5502 * @return the next task that needs to be performed for the given source
5410 */ 5503 */
5411 AnalysisTask getNextAnalysisTask2(Source source, SourceEntry sourceEntry, bool isPriority, bool hintsEnabled, bool sdkErrorsEnabled) { 5504 AnalysisContextImpl_TaskData getNextAnalysisTaskForSource(Source source, Sourc eEntry sourceEntry, bool isPriority, bool hintsEnabled, bool sdkErrorsEnabled) {
5505 if (sourceEntry == null) {
5506 return new AnalysisContextImpl_TaskData(null, false, null);
5507 }
5508 CacheState contentState = sourceEntry.getState(SourceEntry.CONTENT);
5509 if (identical(contentState, CacheState.INVALID)) {
5510 SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
5511 sourceCopy.setState(SourceEntry.CONTENT, CacheState.IN_PROCESS);
5512 _cache.put(source, sourceCopy);
5513 return new AnalysisContextImpl_TaskData(new GetContentTask(this, source), false, null);
5514 } else if (identical(contentState, CacheState.IN_PROCESS)) {
5515 // We are in the process of getting the content. There's nothing else we c an do with this
5516 // source until that's complete.
5517 return new AnalysisContextImpl_TaskData(null, true, null);
5518 }
5412 if (sourceEntry is DartEntry) { 5519 if (sourceEntry is DartEntry) {
5413 DartEntry dartEntry = sourceEntry; 5520 DartEntry dartEntry = sourceEntry;
5414 CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS); 5521 CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS);
5415 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident ical(scanErrorsState, CacheState.FLUSHED))) { 5522 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident ical(scanErrorsState, CacheState.FLUSHED))) {
5416 // TODO(brianwilkerson) Convert this to get the contents from the cache or to asynchronously 5523 // TODO(brianwilkerson) Convert this to get the contents from the cache or to asynchronously
5417 // request the contents if they are not in the cache. 5524 // request the contents if they are not in the cache.
5418 try { 5525 try {
5419 DartEntryImpl dartCopy = dartEntry.writableCopy; 5526 DartEntryImpl dartCopy = dartEntry.writableCopy;
5420 dartCopy.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS); 5527 dartCopy.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS);
5528 TimestampedData<String> contentData;
5529 if (identical(contentState, CacheState.VALID)) {
5530 contentData = new TimestampedData<String>(dartCopy.modificationTime, dartCopy.getValue(SourceEntry.CONTENT));
5531 dartCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED);
5532 } else {
5533 contentData = getContents(source);
5534 }
5421 _cache.put(source, dartCopy); 5535 _cache.put(source, dartCopy);
5422 return new ScanDartTask(this, source, getContents(source)); 5536 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, contentData), false, null);
5423 } on JavaException catch (exception) { 5537 } on JavaException catch (exception) {
5424 DartEntryImpl dartCopy = dartEntry.writableCopy; 5538 DartEntryImpl dartCopy = dartEntry.writableCopy;
5425 dartCopy.recordScanError(); 5539 dartCopy.recordScanError();
5426 dartCopy.exception = new AnalysisException.con3(exception); 5540 dartCopy.exception = new AnalysisException.con3(exception);
5427 _cache.put(source, dartCopy); 5541 _cache.put(source, dartCopy);
5428 } 5542 }
5429 } 5543 }
5430 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); 5544 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS);
5431 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden tical(parseErrorsState, CacheState.FLUSHED))) { 5545 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden tical(parseErrorsState, CacheState.FLUSHED))) {
5432 DartEntryImpl dartCopy = dartEntry.writableCopy; 5546 DartEntryImpl dartCopy = dartEntry.writableCopy;
5433 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); 5547 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
5434 _cache.put(source, dartCopy); 5548 _cache.put(source, dartCopy);
5435 return new ParseDartTask(this, source); 5549 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source), false, null);
5436 } 5550 }
5437 if (isPriority && parseErrorsState != CacheState.ERROR) { 5551 if (isPriority && parseErrorsState != CacheState.ERROR) {
5438 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; 5552 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit;
5439 if (parseUnit == null) { 5553 if (parseUnit == null) {
5440 DartEntryImpl dartCopy = dartEntry.writableCopy; 5554 DartEntryImpl dartCopy = dartEntry.writableCopy;
5441 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.IN_PROCESS); 5555 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.IN_PROCESS);
5442 _cache.put(source, dartCopy); 5556 _cache.put(source, dartCopy);
5443 return new ParseDartTask(this, source); 5557 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source ), false, null);
5444 } 5558 }
5445 } 5559 }
5446 CacheState exportState = dartEntry.getState(DartEntry.EXPORTED_LIBRARIES); 5560 CacheState exportState = dartEntry.getState(DartEntry.EXPORTED_LIBRARIES);
5447 if (identical(exportState, CacheState.INVALID) || (isPriority && identical (exportState, CacheState.FLUSHED))) { 5561 if (identical(exportState, CacheState.INVALID) || (isPriority && identical (exportState, CacheState.FLUSHED))) {
5448 DartEntryImpl dartCopy = dartEntry.writableCopy; 5562 DartEntryImpl dartCopy = dartEntry.writableCopy;
5449 dartCopy.setState(DartEntry.EXPORTED_LIBRARIES, CacheState.IN_PROCESS); 5563 dartCopy.setState(DartEntry.EXPORTED_LIBRARIES, CacheState.IN_PROCESS);
5450 _cache.put(source, dartCopy); 5564 _cache.put(source, dartCopy);
5451 return new ResolveDartDependenciesTask(this, source); 5565 return new AnalysisContextImpl_TaskData(new ResolveDartDependenciesTask( this, source), false, null);
5452 } 5566 }
5453 List<Source> librariesContaining = dartEntry.getValue(DartEntry.CONTAINING _LIBRARIES); 5567 List<Source> librariesContaining = dartEntry.getValue(DartEntry.CONTAINING _LIBRARIES);
5454 for (Source librarySource in librariesContaining) { 5568 for (Source librarySource in librariesContaining) {
5455 SourceEntry libraryEntry = _cache.get(librarySource); 5569 SourceEntry libraryEntry = _cache.get(librarySource);
5456 if (libraryEntry is DartEntry) { 5570 if (libraryEntry is DartEntry) {
5457 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); 5571 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
5458 if (identical(elementState, CacheState.INVALID) || (isPriority && iden tical(elementState, CacheState.FLUSHED))) { 5572 if (identical(elementState, CacheState.INVALID) || (isPriority && iden tical(elementState, CacheState.FLUSHED))) {
5459 DartEntryImpl libraryCopy = libraryEntry.writableCopy; 5573 DartEntryImpl libraryCopy = libraryEntry.writableCopy;
5460 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); 5574 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS);
5461 _cache.put(librarySource, libraryCopy); 5575 _cache.put(librarySource, libraryCopy);
5462 return new ResolveDartLibraryTask(this, source, librarySource); 5576 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t his, source, librarySource), false, null);
5463 } 5577 }
5464 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_ UNIT, librarySource); 5578 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_ UNIT, librarySource);
5465 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && identical(resolvedUnitState, CacheState.FLUSHED))) { 5579 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && identical(resolvedUnitState, CacheState.FLUSHED))) {
5466 // 5580 //
5467 // The commented out lines below are an optimization that doesn't qu ite work yet. The 5581 // The commented out lines below are an optimization that doesn't qu ite work yet. The
5468 // problem is that if the source was not resolved because it wasn't part of any library, 5582 // problem is that if the source was not resolved because it wasn't part of any library,
5469 // then there won't be any elements in the element model that we can use to resolve it. 5583 // then there won't be any elements in the element model that we can use to resolve it.
5470 // 5584 //
5471 //LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL EMENT); 5585 //LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL EMENT);
5472 //if (libraryElement != null) { 5586 //if (libraryElement != null) {
5473 DartEntryImpl dartCopy = dartEntry.writableCopy; 5587 DartEntryImpl dartCopy = dartEntry.writableCopy;
5474 dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheStat e.IN_PROCESS); 5588 dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheStat e.IN_PROCESS);
5475 _cache.put(source, dartCopy); 5589 _cache.put(source, dartCopy);
5476 //return new ResolveDartUnitTask(this, source, libraryElement); 5590 //return new ResolveDartUnitTask(this, source, libraryElement);
5477 return new ResolveDartLibraryTask(this, source, librarySource); 5591 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t his, source, librarySource), false, null);
5478 } 5592 }
5479 if (sdkErrorsEnabled || !source.isInSystemLibrary) { 5593 if (sdkErrorsEnabled || !source.isInSystemLibrary) {
5480 CacheState verificationErrorsState = dartEntry.getState2(DartEntry.V ERIFICATION_ERRORS, librarySource); 5594 CacheState verificationErrorsState = dartEntry.getState2(DartEntry.V ERIFICATION_ERRORS, librarySource);
5481 if (identical(verificationErrorsState, CacheState.INVALID) || (isPri ority && identical(verificationErrorsState, CacheState.FLUSHED))) { 5595 if (identical(verificationErrorsState, CacheState.INVALID) || (isPri ority && identical(verificationErrorsState, CacheState.FLUSHED))) {
5482 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL EMENT); 5596 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL EMENT);
5483 if (libraryElement != null) { 5597 if (libraryElement != null) {
5484 DartEntryImpl dartCopy = dartEntry.writableCopy; 5598 DartEntryImpl dartCopy = dartEntry.writableCopy;
5485 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, CacheState.IN_PROCESS); 5599 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, CacheState.IN_PROCESS);
5486 _cache.put(source, dartCopy); 5600 _cache.put(source, dartCopy);
5487 return new GenerateDartErrorsTask(this, source, libraryElement); 5601 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTa sk(this, source, libraryElement), false, null);
5488 } 5602 }
5489 } 5603 }
5490 if (hintsEnabled) { 5604 if (hintsEnabled) {
5491 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, libra rySource); 5605 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, libra rySource);
5492 if (identical(hintsState, CacheState.INVALID) || (isPriority && id entical(hintsState, CacheState.FLUSHED))) { 5606 if (identical(hintsState, CacheState.INVALID) || (isPriority && id entical(hintsState, CacheState.FLUSHED))) {
5493 LibraryElement libraryElement = libraryEntry.getValue(DartEntry. ELEMENT); 5607 LibraryElement libraryElement = libraryEntry.getValue(DartEntry. ELEMENT);
5494 if (libraryElement != null) { 5608 if (libraryElement != null) {
5495 DartEntryImpl dartCopy = dartEntry.writableCopy; 5609 DartEntryImpl dartCopy = dartEntry.writableCopy;
5496 dartCopy.setState2(DartEntry.HINTS, librarySource, CacheState. IN_PROCESS); 5610 dartCopy.setState2(DartEntry.HINTS, librarySource, CacheState. IN_PROCESS);
5497 _cache.put(source, dartCopy); 5611 _cache.put(source, dartCopy);
5498 return new GenerateDartHintsTask(this, libraryElement); 5612 return new AnalysisContextImpl_TaskData(new GenerateDartHintsT ask(this, libraryElement), false, null);
5499 } 5613 }
5500 } 5614 }
5501 } 5615 }
5502 } 5616 }
5503 } 5617 }
5504 } 5618 }
5505 } else if (sourceEntry is HtmlEntry) { 5619 } else if (sourceEntry is HtmlEntry) {
5506 HtmlEntry htmlEntry = sourceEntry; 5620 HtmlEntry htmlEntry = sourceEntry;
5507 CacheState parseErrorsState = htmlEntry.getState(HtmlEntry.PARSE_ERRORS); 5621 CacheState parseErrorsState = htmlEntry.getState(HtmlEntry.PARSE_ERRORS);
5508 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden tical(parseErrorsState, CacheState.FLUSHED))) { 5622 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden tical(parseErrorsState, CacheState.FLUSHED))) {
5509 HtmlEntryImpl dartCopy = htmlEntry.writableCopy; 5623 try {
5510 dartCopy.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS); 5624 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5511 _cache.put(source, dartCopy); 5625 htmlCopy.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
5512 return new ParseHtmlTask(this, source); 5626 TimestampedData<String> contentData;
5627 if (identical(contentState, CacheState.VALID)) {
5628 contentData = new TimestampedData<String>(htmlCopy.modificationTime, htmlCopy.getValue(SourceEntry.CONTENT));
5629 htmlCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED);
5630 } else {
5631 contentData = getContents(source);
5632 }
5633 _cache.put(source, htmlCopy);
5634 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source , contentData), false, null);
5635 } on JavaException catch (exception) {
5636 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5637 htmlCopy.recordParseError();
5638 htmlCopy.exception = new AnalysisException.con3(exception);
5639 _cache.put(source, htmlCopy);
5640 }
5513 } 5641 }
5514 if (isPriority && parseErrorsState != CacheState.ERROR) { 5642 if (isPriority && parseErrorsState != CacheState.ERROR) {
5515 ht.HtmlUnit parsedUnit = htmlEntry.anyParsedUnit; 5643 ht.HtmlUnit parsedUnit = htmlEntry.anyParsedUnit;
5516 if (parsedUnit == null) { 5644 if (parsedUnit == null) {
5517 HtmlEntryImpl dartCopy = htmlEntry.writableCopy; 5645 try {
5518 dartCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS); 5646 HtmlEntryImpl dartCopy = htmlEntry.writableCopy;
5519 _cache.put(source, dartCopy); 5647 dartCopy.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
5520 return new ParseHtmlTask(this, source); 5648 TimestampedData<String> contentData;
5649 if (identical(contentState, CacheState.VALID)) {
5650 contentData = new TimestampedData<String>(dartCopy.modificationTim e, dartCopy.getValue(SourceEntry.CONTENT));
5651 dartCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED);
5652 } else {
5653 contentData = getContents(source);
5654 }
5655 _cache.put(source, dartCopy);
5656 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, sour ce, contentData), false, null);
5657 } on JavaException catch (exception) {
5658 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5659 htmlCopy.recordParseError();
5660 htmlCopy.exception = new AnalysisException.con3(exception);
5661 _cache.put(source, htmlCopy);
5662 }
5521 } 5663 }
5522 } 5664 }
5523 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) ; 5665 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) ;
5524 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide ntical(resolvedUnitState, CacheState.FLUSHED))) { 5666 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide ntical(resolvedUnitState, CacheState.FLUSHED))) {
5525 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5667 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5526 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.IN_PROCESS); 5668 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.IN_PROCESS);
5527 _cache.put(source, htmlCopy); 5669 _cache.put(source, htmlCopy);
5528 return new ResolveHtmlTask(this, source); 5670 return new AnalysisContextImpl_TaskData(new ResolveHtmlTask(this, source ), false, null);
5529 } 5671 }
5530 // Angular support 5672 // Angular support
5531 if (_options.analyzeAngular) { 5673 if (_options.analyzeAngular) {
5532 // try to resolve as an Angular entry point 5674 // try to resolve as an Angular entry point
5533 CacheState angularEntryState = htmlEntry.getState(HtmlEntry.ANGULAR_ENTR Y); 5675 CacheState angularEntryState = htmlEntry.getState(HtmlEntry.ANGULAR_ENTR Y);
5534 if (identical(angularEntryState, CacheState.INVALID)) { 5676 if (identical(angularEntryState, CacheState.INVALID)) {
5535 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5677 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5536 htmlCopy.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); 5678 htmlCopy.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS);
5537 _cache.put(source, htmlCopy); 5679 _cache.put(source, htmlCopy);
5538 return new ResolveAngularEntryHtmlTask(this, source); 5680 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTas k(this, source), false, null);
5539 } 5681 }
5540 // try to resolve as an Angular application part 5682 // try to resolve as an Angular application part
5541 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERR ORS); 5683 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERR ORS);
5542 if (identical(angularErrorsState, CacheState.INVALID)) { 5684 if (identical(angularErrorsState, CacheState.INVALID)) {
5543 AngularApplication application = htmlEntry.getValue(HtmlEntry.ANGULAR_ APPLICATION); 5685 AngularApplication application = htmlEntry.getValue(HtmlEntry.ANGULAR_ APPLICATION);
5544 // try to resolve as an Angular template 5686 // try to resolve as an Angular template
5545 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGUL AR_COMPONENT); 5687 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGUL AR_COMPONENT);
5546 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5688 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5547 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS); 5689 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS);
5548 _cache.put(source, htmlCopy); 5690 _cache.put(source, htmlCopy);
5549 return new ResolveAngularComponentTemplateTask(this, source, component , application); 5691 return new AnalysisContextImpl_TaskData(new ResolveAngularComponentTem plateTask(this, source, component, application), false, null);
5550 } 5692 }
5551 } 5693 }
5552 } 5694 }
5553 return null; 5695 return new AnalysisContextImpl_TaskData(null, false, null);
5696 }
5697
5698 AnalysisContextImpl_TaskData getNextNondependentAnalysisTask(Source source, bo ol hintsEnabled, bool sdkErrorsEnabled) {
5699 AnalysisContextImpl_TaskData taskData = getNextAnalysisTaskForSource(source, _cache.get(source), true, hintsEnabled, sdkErrorsEnabled);
5700 if (taskData.task != null || taskData.isBlocked) {
5701 return taskData;
5702 }
5703 while (taskData.dependentSource != null) {
5704 taskData = getNextAnalysisTaskForSource(source, _cache.get(source), true, hintsEnabled, sdkErrorsEnabled);
5705 if (taskData.task != null || taskData.isBlocked) {
5706 return taskData;
5707 }
5708 }
5709 return new AnalysisContextImpl_TaskData(null, false, null);
5554 } 5710 }
5555 5711
5556 /** 5712 /**
5557 * Return a change notice for the given source, creating one if one does not a lready exist. 5713 * Return a change notice for the given source, creating one if one does not a lready exist.
5558 * 5714 *
5559 * @param source the source for which changes are being reported 5715 * @param source the source for which changes are being reported
5560 * @return a change notice for the given source 5716 * @return a change notice for the given source
5561 */ 5717 */
5562 ChangeNoticeImpl getNotice(Source source) { 5718 ChangeNoticeImpl getNotice(Source source) {
5563 ChangeNoticeImpl notice = _pendingNotices[source]; 5719 ChangeNoticeImpl notice = _pendingNotices[source];
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
6191 } 6347 }
6192 } 6348 }
6193 } 6349 }
6194 if (thrownException != null) { 6350 if (thrownException != null) {
6195 throw thrownException; 6351 throw thrownException;
6196 } 6352 }
6197 return libraryEntry; 6353 return libraryEntry;
6198 } 6354 }
6199 6355
6200 /** 6356 /**
6357 * Record the results produced by performing a [GetContentTask].
6358 *
6359 * @param task the task that was performed
6360 * @return an entry containing the computed results
6361 * @throws AnalysisException if the results could not be recorded
6362 */
6363 SourceEntry recordGetContentsTask(GetContentTask task) {
6364 if (!task.isComplete) {
6365 return null;
6366 }
6367 Source source = task.source;
6368 AnalysisException thrownException = task.exception;
6369 SourceEntry sourceEntry = null;
6370 {
6371 sourceEntry = _cache.get(source);
6372 if (sourceEntry == null) {
6373 throw new ObsoleteSourceAnalysisException(source);
6374 }
6375 SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
6376 if (thrownException == null) {
6377 sourceCopy.modificationTime = task.modificationTime;
6378 sourceCopy.setValue(SourceEntry.CONTENT, task.content);
6379 } else {
6380 sourceCopy.exception = thrownException;
6381 sourceCopy.recordContentError();
6382 _workManager.remove(source);
6383 }
6384 _cache.put(source, sourceCopy);
6385 sourceEntry = sourceCopy;
6386 }
6387 if (thrownException != null) {
6388 throw thrownException;
6389 }
6390 return sourceEntry;
6391 }
6392
6393 /**
6201 * Record the results produced by performing a [IncrementalAnalysisTask]. 6394 * Record the results produced by performing a [IncrementalAnalysisTask].
6202 * 6395 *
6203 * @param task the task that was performed 6396 * @param task the task that was performed
6204 * @return an entry containing the computed results 6397 * @return an entry containing the computed results
6205 * @throws AnalysisException if the results could not be recorded 6398 * @throws AnalysisException if the results could not be recorded
6206 */ 6399 */
6207 DartEntry recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task) { 6400 DartEntry recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task) {
6208 { 6401 {
6209 CompilationUnit unit = task.compilationUnit; 6402 CompilationUnit unit = task.compilationUnit;
6210 if (unit != null) { 6403 if (unit != null) {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
6660 } 6853 }
6661 6854
6662 /** 6855 /**
6663 * Record the results produced by performing a [ResolveDartUnitTask]. If the r esults were 6856 * Record the results produced by performing a [ResolveDartUnitTask]. If the r esults were
6664 * computed from data that is now out-of-date, then the results will not be re corded. 6857 * computed from data that is now out-of-date, then the results will not be re corded.
6665 * 6858 *
6666 * @param task the task that was performed 6859 * @param task the task that was performed
6667 * @return an entry containing the computed results 6860 * @return an entry containing the computed results
6668 * @throws AnalysisException if the results could not be recorded 6861 * @throws AnalysisException if the results could not be recorded
6669 */ 6862 */
6670 SourceEntry recordResolveDartUnitTaskResults(ResolveDartUnitTask task) { 6863 DartEntry recordResolveDartUnitTaskResults(ResolveDartUnitTask task) {
6671 Source unitSource = task.source; 6864 Source unitSource = task.source;
6672 Source librarySource = task.librarySource; 6865 Source librarySource = task.librarySource;
6673 AnalysisException thrownException = task.exception; 6866 AnalysisException thrownException = task.exception;
6674 DartEntry dartEntry = null; 6867 DartEntry dartEntry = null;
6675 { 6868 {
6676 SourceEntry sourceEntry = _cache.get(unitSource); 6869 SourceEntry sourceEntry = _cache.get(unitSource);
6677 if (sourceEntry == null) { 6870 if (sourceEntry == null) {
6678 throw new ObsoleteSourceAnalysisException(unitSource); 6871 throw new ObsoleteSourceAnalysisException(unitSource);
6679 } else if (sourceEntry is! DartEntry) { 6872 } else if (sourceEntry is! DartEntry) {
6680 // This shouldn't be possible because we should never have performed the task if the source 6873 // This shouldn't be possible because we should never have performed the task if the source
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6740 } 6933 }
6741 6934
6742 /** 6935 /**
6743 * Record the results produced by performing a [ResolveHtmlTask]. If the resul ts were 6936 * Record the results produced by performing a [ResolveHtmlTask]. If the resul ts were
6744 * computed from data that is now out-of-date, then the results will not be re corded. 6937 * computed from data that is now out-of-date, then the results will not be re corded.
6745 * 6938 *
6746 * @param task the task that was performed 6939 * @param task the task that was performed
6747 * @return an entry containing the computed results 6940 * @return an entry containing the computed results
6748 * @throws AnalysisException if the results could not be recorded 6941 * @throws AnalysisException if the results could not be recorded
6749 */ 6942 */
6750 SourceEntry recordResolveHtmlTaskResults(ResolveHtmlTask task) { 6943 HtmlEntry recordResolveHtmlTaskResults(ResolveHtmlTask task) {
6751 Source source = task.source; 6944 Source source = task.source;
6752 AnalysisException thrownException = task.exception; 6945 AnalysisException thrownException = task.exception;
6753 HtmlEntry htmlEntry = null; 6946 HtmlEntry htmlEntry = null;
6754 { 6947 {
6755 SourceEntry sourceEntry = _cache.get(source); 6948 SourceEntry sourceEntry = _cache.get(source);
6756 if (sourceEntry == null) { 6949 if (sourceEntry == null) {
6757 throw new ObsoleteSourceAnalysisException(source); 6950 throw new ObsoleteSourceAnalysisException(source);
6758 } else if (sourceEntry is! HtmlEntry) { 6951 } else if (sourceEntry is! HtmlEntry) {
6759 // This shouldn't be possible because we should never have performed the task if the source 6952 // This shouldn't be possible because we should never have performed the task if the source
6760 // didn't represent an HTML file, but check to be safe. 6953 // didn't represent an HTML file, but check to be safe.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
6919 * @param dartEntry the entry containing the list of included parts 7112 * @param dartEntry the entry containing the list of included parts
6920 */ 7113 */
6921 void removeFromParts(Source librarySource, DartEntry dartEntry) { 7114 void removeFromParts(Source librarySource, DartEntry dartEntry) {
6922 List<Source> oldParts = dartEntry.getValue(DartEntry.INCLUDED_PARTS); 7115 List<Source> oldParts = dartEntry.getValue(DartEntry.INCLUDED_PARTS);
6923 for (int i = 0; i < oldParts.length; i++) { 7116 for (int i = 0; i < oldParts.length; i++) {
6924 Source partSource = oldParts[i]; 7117 Source partSource = oldParts[i];
6925 DartEntry partEntry = getReadableDartEntry(partSource); 7118 DartEntry partEntry = getReadableDartEntry(partSource);
6926 if (partEntry != null && partEntry != dartEntry) { 7119 if (partEntry != null && partEntry != dartEntry) {
6927 DartEntryImpl partCopy = partEntry.writableCopy; 7120 DartEntryImpl partCopy = partEntry.writableCopy;
6928 partCopy.removeContainingLibrary(librarySource); 7121 partCopy.removeContainingLibrary(librarySource);
6929 _cache.put(partSource, partCopy); 7122 if (partCopy.librariesContaining.length == 0 && !exists(partSource)) {
7123 _cache.remove(partSource);
7124 } else {
7125 _cache.put(partSource, partCopy);
7126 }
6930 } 7127 }
6931 } 7128 }
6932 } 7129 }
6933 7130
6934 /** 7131 /**
6935 * Remove the given source from the priority order if it is in the list. 7132 * Remove the given source from the priority order if it is in the list.
6936 * 7133 *
6937 * @param source the source to be removed 7134 * @param source the source to be removed
6938 */ 7135 */
6939 void removeFromPriorityOrder(Source source) { 7136 void removeFromPriorityOrder(Source source) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
7114 7311
7115 /** 7312 /**
7116 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c ontext to 7313 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c ontext to
7117 * record the results of a task. 7314 * record the results of a task.
7118 */ 7315 */
7119 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi tor<SourceEntry> { 7316 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi tor<SourceEntry> {
7120 final AnalysisContextImpl AnalysisContextImpl_this; 7317 final AnalysisContextImpl AnalysisContextImpl_this;
7121 7318
7122 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this); 7319 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this);
7123 7320
7124 SourceEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => Analys isContextImpl_this.recordGenerateDartErrorsTask(task); 7321 DartEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => Analysis ContextImpl_this.recordGenerateDartErrorsTask(task);
7125 7322
7126 SourceEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => Analysis ContextImpl_this.recordGenerateDartHintsTask(task); 7323 DartEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => AnalysisCo ntextImpl_this.recordGenerateDartHintsTask(task);
7127 7324
7128 SourceEntry visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => Anal ysisContextImpl_this.recordIncrementalAnalysisTaskResults(task); 7325 SourceEntry visitGetContentTask(GetContentTask task) => AnalysisContextImpl_th is.recordGetContentsTask(task);
7326
7327 DartEntry visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => Analys isContextImpl_this.recordIncrementalAnalysisTaskResults(task);
7129 7328
7130 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this.r ecordParseDartTaskResults(task); 7329 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this.r ecordParseDartTaskResults(task);
7131 7330
7132 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this.r ecordParseHtmlTaskResults(task); 7331 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this.r ecordParseHtmlTaskResults(task);
7133 7332
7134 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp lateTask task) => AnalysisContextImpl_this.recordResolveAngularComponentTemplate TaskResults(task); 7333 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp lateTask task) => AnalysisContextImpl_this.recordResolveAngularComponentTemplate TaskResults(task);
7135 7334
7136 SourceEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) => AnalysisContextImpl_this.recordResolveAngularEntryHtmlTaskResults(task); 7335 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) = > AnalysisContextImpl_this.recordResolveAngularEntryHtmlTaskResults(task);
7137 7336
7138 DartEntry visitResolveDartDependenciesTask(ResolveDartDependenciesTask task) = > AnalysisContextImpl_this.recordResolveDartDependenciesTaskResults(task); 7337 DartEntry visitResolveDartDependenciesTask(ResolveDartDependenciesTask task) = > AnalysisContextImpl_this.recordResolveDartDependenciesTaskResults(task);
7139 7338
7140 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis ContextImpl_this.recordResolveDartLibraryTaskResults(task); 7339 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis ContextImpl_this.recordResolveDartLibraryTaskResults(task);
7141 7340
7142 SourceEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisCont extImpl_this.recordResolveDartUnitTaskResults(task); 7341 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContex tImpl_this.recordResolveDartUnitTaskResults(task);
7143 7342
7144 SourceEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_ this.recordResolveHtmlTaskResults(task); 7343 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_th is.recordResolveHtmlTaskResults(task);
7145 7344
7146 SourceEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this.r ecordScanDartTaskResults(task); 7345 DartEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this.rec ordScanDartTaskResults(task);
7147 } 7346 }
7148 7347
7149 class AnalysisContextImpl_ContextRetentionPolicy implements CacheRetentionPolicy { 7348 class AnalysisContextImpl_ContextRetentionPolicy implements CacheRetentionPolicy {
7150 final AnalysisContextImpl AnalysisContextImpl_this; 7349 final AnalysisContextImpl AnalysisContextImpl_this;
7151 7350
7152 AnalysisContextImpl_ContextRetentionPolicy(this.AnalysisContextImpl_this); 7351 AnalysisContextImpl_ContextRetentionPolicy(this.AnalysisContextImpl_this);
7153 7352
7154 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) { 7353 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) {
7155 for (Source prioritySource in AnalysisContextImpl_this._priorityOrder) { 7354 for (Source prioritySource in AnalysisContextImpl_this._priorityOrder) {
7156 if (source == prioritySource) { 7355 if (source == prioritySource) {
7157 return RetentionPriority.HIGH; 7356 return RetentionPriority.HIGH;
7158 } 7357 }
7159 } 7358 }
7160 if (sourceEntry is DartEntry) { 7359 if (sourceEntry is DartEntry) {
7161 DartEntry dartEntry = sourceEntry; 7360 DartEntry dartEntry = sourceEntry;
7162 if (astIsNeeded(dartEntry)) { 7361 if (astIsNeeded(dartEntry)) {
7163 return RetentionPriority.MEDIUM; 7362 return RetentionPriority.MEDIUM;
7164 } 7363 }
7165 } 7364 }
7166 return RetentionPriority.LOW; 7365 return RetentionPriority.LOW;
7167 } 7366 }
7168 7367
7169 bool astIsNeeded(DartEntry dartEntry) => dartEntry.hasInvalidData(DartEntry.HI NTS) || dartEntry.hasInvalidData(DartEntry.VERIFICATION_ERRORS) || dartEntry.has InvalidData(DartEntry.RESOLUTION_ERRORS); 7368 bool astIsNeeded(DartEntry dartEntry) => dartEntry.hasInvalidData(DartEntry.HI NTS) || dartEntry.hasInvalidData(DartEntry.VERIFICATION_ERRORS) || dartEntry.has InvalidData(DartEntry.RESOLUTION_ERRORS);
7170 } 7369 }
7171 7370
7172 /** 7371 /**
7372 * Instances of the class `TaskData` represent information about the next task t o be
7373 * performed. Each data has an implicit associated source: the source that might need to be
7374 * analyzed. There are essentially three states that can be represented:
7375 * * If [getTask] returns a non-`null` value, then that is the task that should
7376 * be executed to further analyze the associated source.
7377 * * Otherwise, if [isBlocked] returns `true`, then there is no work that can be
7378 * done, but analysis for the associated source is not complete.
7379 * * Otherwise, [getDependentSource] should return a source that needs to be ana lyzed
7380 * before the analysis of the associated source can be completed.
7381 */
7382 class AnalysisContextImpl_TaskData {
7383 /**
7384 * The task that is to be performed.
7385 */
7386 final AnalysisTask task;
7387
7388 /**
7389 * A flag indicating whether the associated source is blocked waiting for its contents to be
7390 * loaded.
7391 */
7392 bool _blocked = false;
7393
7394 /**
7395 * The source that needs to be analyzed before further progress can be made on the associated
7396 * source.
7397 */
7398 final Source dependentSource;
7399
7400 /**
7401 * Initialize a newly created data holder.
7402 *
7403 * @param task the task that is to be performed
7404 * @param blocked `true` if the associated source is blocked waiting for its c ontents to
7405 * be loaded
7406 * @param dependentSource t
7407 */
7408 AnalysisContextImpl_TaskData(this.task, bool blocked, this.dependentSource) {
7409 this._blocked = blocked;
7410 }
7411
7412 /**
7413 * Return `true` if the associated source is blocked waiting for its contents to be
7414 * loaded.
7415 *
7416 * @return `true` if the associated source is blocked waiting for its contents to be
7417 * loaded
7418 */
7419 bool get isBlocked => _blocked;
7420 }
7421
7422 /**
7173 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors and line info 7423 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors and line info
7174 * associated with a source. 7424 * associated with a source.
7175 */ 7425 */
7176 class AnalysisErrorInfoImpl implements AnalysisErrorInfo { 7426 class AnalysisErrorInfoImpl implements AnalysisErrorInfo {
7177 /** 7427 /**
7178 * The analysis errors associated with a source, or `null` if there are no err ors. 7428 * The analysis errors associated with a source, or `null` if there are no err ors.
7179 */ 7429 */
7180 final List<AnalysisError> errors; 7430 final List<AnalysisError> errors;
7181 7431
7182 /** 7432 /**
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
9076 StringToken token = createStringToken(name, offset); 9326 StringToken token = createStringToken(name, offset);
9077 return new SimpleIdentifier(token); 9327 return new SimpleIdentifier(token);
9078 } 9328 }
9079 9329
9080 /** 9330 /**
9081 * Adds [AngularElement] declared by the given top-level [Element]. 9331 * Adds [AngularElement] declared by the given top-level [Element].
9082 * 9332 *
9083 * @param angularElements the list to fill with top-level [AngularElement]s 9333 * @param angularElements the list to fill with top-level [AngularElement]s
9084 * @param classElement the [ClassElement] to get [AngularElement]s from 9334 * @param classElement the [ClassElement] to get [AngularElement]s from
9085 */ 9335 */
9086 static void addAngularElements(Set<AngularElement> angularElements, ClassEleme nt classElement) { 9336 static void addAngularElementsFromClass(Set<AngularElement> angularElements, C lassElement classElement) {
9087 for (ToolkitObjectElement toolkitObject in classElement.toolkitObjects) { 9337 for (ToolkitObjectElement toolkitObject in classElement.toolkitObjects) {
9088 if (toolkitObject is AngularElement) { 9338 if (toolkitObject is AngularElement) {
9089 angularElements.add(toolkitObject); 9339 angularElements.add(toolkitObject);
9090 } 9340 }
9091 } 9341 }
9092 } 9342 }
9093 9343
9094 /** 9344 /**
9095 * Returns the array of all top-level Angular elements that could be used in t his library. 9345 * Returns the array of all top-level Angular elements that could be used in t his library.
9096 * 9346 *
9097 * @param libraryElement the [LibraryElement] to analyze 9347 * @param libraryElement the [LibraryElement] to analyze
9098 * @return the array of all top-level Angular elements that could be used in t his library 9348 * @return the array of all top-level Angular elements that could be used in t his library
9099 */ 9349 */
9100 static void addAngularElements2(Set<AngularElement> angularElements, LibraryEl ement library, Set<LibraryElement> visited) { 9350 static void addAngularElementsFromLibrary(Set<AngularElement> angularElements, LibraryElement library, Set<LibraryElement> visited) {
9101 if (library == null) { 9351 if (library == null) {
9102 return; 9352 return;
9103 } 9353 }
9104 if (!visited.add(library)) { 9354 if (!visited.add(library)) {
9105 return; 9355 return;
9106 } 9356 }
9107 // add Angular elements from current library 9357 // add Angular elements from current library
9108 for (CompilationUnitElement unit in library.units) { 9358 for (CompilationUnitElement unit in library.units) {
9109 angularElements.addAll(unit.angularViews); 9359 angularElements.addAll(unit.angularViews);
9110 for (ClassElement type in unit.types) { 9360 for (ClassElement type in unit.types) {
9111 addAngularElements(angularElements, type); 9361 addAngularElementsFromClass(angularElements, type);
9112 } 9362 }
9113 } 9363 }
9114 // handle imports 9364 // handle imports
9115 for (ImportElement importElement in library.imports) { 9365 for (ImportElement importElement in library.imports) {
9116 LibraryElement importedLibrary = importElement.importedLibrary; 9366 LibraryElement importedLibrary = importElement.importedLibrary;
9117 addAngularElements2(angularElements, importedLibrary, visited); 9367 addAngularElementsFromLibrary(angularElements, importedLibrary, visited);
9118 } 9368 }
9119 } 9369 }
9120 9370
9121 static StringToken createStringToken(String name, int offset) => new StringTok en(TokenType.IDENTIFIER, name, offset); 9371 static StringToken createStringToken(String name, int offset) => new StringTok en(TokenType.IDENTIFIER, name, offset);
9122 9372
9123 /** 9373 /**
9124 * Returns the array of all top-level Angular elements that could be used in t his library. 9374 * Returns the array of all top-level Angular elements that could be used in t his library.
9125 * 9375 *
9126 * @param libraryElement the [LibraryElement] to analyze 9376 * @param libraryElement the [LibraryElement] to analyze
9127 * @return the array of all top-level Angular elements that could be used in t his library 9377 * @return the array of all top-level Angular elements that could be used in t his library
9128 */ 9378 */
9129 static List<AngularElement> getAngularElements(Set<LibraryElement> libraries, LibraryElement libraryElement) { 9379 static List<AngularElement> getAngularElements(Set<LibraryElement> libraries, LibraryElement libraryElement) {
9130 Set<AngularElement> angularElements = new Set(); 9380 Set<AngularElement> angularElements = new Set();
9131 addAngularElements2(angularElements, libraryElement, libraries); 9381 addAngularElementsFromLibrary(angularElements, libraryElement, libraries);
9132 return new List.from(angularElements); 9382 return new List.from(angularElements);
9133 } 9383 }
9134 9384
9135 /** 9385 /**
9136 * Returns the external Dart [CompilationUnit] referenced by the given [HtmlUn it]. 9386 * Returns the external Dart [CompilationUnit] referenced by the given [HtmlUn it].
9137 */ 9387 */
9138 static CompilationUnit getDartUnit(AnalysisContext context, ht.HtmlUnit unit) { 9388 static CompilationUnit getDartUnit(AnalysisContext context, ht.HtmlUnit unit) {
9139 for (HtmlScriptElement script in unit.element.scripts) { 9389 for (HtmlScriptElement script in unit.element.scripts) {
9140 if (script is ExternalHtmlScriptElement) { 9390 if (script is ExternalHtmlScriptElement) {
9141 Source scriptSource = script.scriptSource; 9391 Source scriptSource = script.scriptSource;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
9272 } 9522 }
9273 9523
9274 /** 9524 /**
9275 * Resolves [source] as an Angular application entry point. 9525 * Resolves [source] as an Angular application entry point.
9276 */ 9526 */
9277 void resolveEntryPoint(AngularApplication application) { 9527 void resolveEntryPoint(AngularApplication application) {
9278 resolveInternal(application.elements, null); 9528 resolveInternal(application.elements, null);
9279 } 9529 }
9280 9530
9281 Object visitXmlAttributeNode(ht.XmlAttributeNode node) { 9531 Object visitXmlAttributeNode(ht.XmlAttributeNode node) {
9282 parseEmbeddedExpressions2(node); 9532 parseEmbeddedExpressionsInAttribute(node);
9283 resolveExpressions(node.expressions); 9533 resolveExpressions(node.expressions);
9284 return super.visitXmlAttributeNode(node); 9534 return super.visitXmlAttributeNode(node);
9285 } 9535 }
9286 9536
9287 Object visitXmlTagNode(ht.XmlTagNode node) { 9537 Object visitXmlTagNode(ht.XmlTagNode node) {
9288 bool wasAngular = _isAngular; 9538 bool wasAngular = _isAngular;
9289 try { 9539 try {
9290 // new Angular context 9540 // new Angular context
9291 if (node.getAttribute(_NG_APP) != null) { 9541 if (node.getAttribute(_NG_APP) != null) {
9292 _isAngular = true; 9542 _isAngular = true;
9293 visitModelDirectives(node); 9543 visitModelDirectives(node);
9294 } 9544 }
9295 // not Angular 9545 // not Angular
9296 if (!_isAngular) { 9546 if (!_isAngular) {
9297 return super.visitXmlTagNode(node); 9547 return super.visitXmlTagNode(node);
9298 } 9548 }
9299 // process node in separate name scope 9549 // process node in separate name scope
9300 pushNameScope(); 9550 pushNameScope();
9301 try { 9551 try {
9302 parseEmbeddedExpressions3(node); 9552 parseEmbeddedExpressions2(node);
9303 // apply processors 9553 // apply processors
9304 for (NgProcessor processor in _processors) { 9554 for (NgProcessor processor in _processors) {
9305 if (processor.canApply(node)) { 9555 if (processor.canApply(node)) {
9306 processor.apply(this, node); 9556 processor.apply(this, node);
9307 } 9557 }
9308 } 9558 }
9309 // resolve expressions 9559 // resolve expressions
9310 resolveExpressions(node.expressions); 9560 resolveExpressions(node.expressions);
9311 // process children 9561 // process children
9312 return super.visitXmlTagNode(node); 9562 return super.visitXmlTagNode(node);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
9402 SimpleIdentifier name = parseDartExpression3(filterToken) as SimpleIdentif ier; 9652 SimpleIdentifier name = parseDartExpression3(filterToken) as SimpleIdentif ier;
9403 filterToken = name.endToken.next; 9653 filterToken = name.endToken.next;
9404 // parse arguments 9654 // parse arguments
9405 List<AngularFilterArgument> arguments = []; 9655 List<AngularFilterArgument> arguments = [];
9406 while (filterToken.type != TokenType.EOF) { 9656 while (filterToken.type != TokenType.EOF) {
9407 // skip ":" 9657 // skip ":"
9408 Token colonToken = filterToken; 9658 Token colonToken = filterToken;
9409 if (identical(colonToken.type, TokenType.COLON)) { 9659 if (identical(colonToken.type, TokenType.COLON)) {
9410 filterToken = filterToken.next; 9660 filterToken = filterToken.next;
9411 } else { 9661 } else {
9412 reportError8(colonToken, AngularCode.MISSING_FILTER_COLON, []); 9662 reportErrorForToken(AngularCode.MISSING_FILTER_COLON, colonToken, []);
9413 } 9663 }
9414 // parse argument 9664 // parse argument
9415 Expression argument = parseDartExpression3(filterToken); 9665 Expression argument = parseDartExpression3(filterToken);
9416 arguments.add(new AngularFilterArgument(colonToken, argument)); 9666 arguments.add(new AngularFilterArgument(colonToken, argument));
9417 // next token 9667 // next token
9418 filterToken = argument.endToken.next; 9668 filterToken = argument.endToken.next;
9419 } 9669 }
9420 filters.add(new AngularFilterNode(barToken, name, arguments)); 9670 filters.add(new AngularFilterNode(barToken, name, arguments));
9421 } 9671 }
9422 // done 9672 // done
(...skipping 19 matching lines...) Expand all
9442 _nameScope = _resolver.popNameScope(); 9692 _nameScope = _resolver.popNameScope();
9443 } 9693 }
9444 9694
9445 void pushNameScope() { 9695 void pushNameScope() {
9446 _nameScope = _resolver.pushNameScope(); 9696 _nameScope = _resolver.pushNameScope();
9447 } 9697 }
9448 9698
9449 /** 9699 /**
9450 * Reports given [ErrorCode] at the given [AstNode]. 9700 * Reports given [ErrorCode] at the given [AstNode].
9451 */ 9701 */
9452 void reportError(AstNode node, ErrorCode errorCode, List<Object> arguments) { 9702 void reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> argume nts) {
9453 reportError7(node.offset, node.length, errorCode, arguments); 9703 reportErrorForOffset(errorCode, node.offset, node.length, arguments);
9454 } 9704 }
9455 9705
9456 /** 9706 /**
9457 * Reports given [ErrorCode] at the given position. 9707 * Reports given [ErrorCode] at the given position.
9458 */ 9708 */
9459 void reportError7(int offset, int length, ErrorCode errorCode, List<Object> ar guments) { 9709 void reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<Ob ject> arguments) {
9460 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error Code, arguments)); 9710 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error Code, arguments));
9461 } 9711 }
9462 9712
9463 /** 9713 /**
9464 * Reports given [ErrorCode] at the given [Token]. 9714 * Reports given [ErrorCode] at the given [Token].
9465 */ 9715 */
9466 void reportError8(Token token, ErrorCode errorCode, List<Object> arguments) { 9716 void reportErrorForToken(ErrorCode errorCode, Token token, List<Object> argume nts) {
9467 reportError7(token.offset, token.length, errorCode, arguments); 9717 reportErrorForOffset(errorCode, token.offset, token.length, arguments);
9468 } 9718 }
9469 9719
9470 void resolveExpression(AngularExpression angularExpression) { 9720 void resolveExpression(AngularExpression angularExpression) {
9471 List<Expression> dartExpressions = angularExpression.expressions; 9721 List<Expression> dartExpressions = angularExpression.expressions;
9472 for (Expression dartExpression in dartExpressions) { 9722 for (Expression dartExpression in dartExpressions) {
9473 resolveNode(dartExpression); 9723 resolveNode(dartExpression);
9474 } 9724 }
9475 } 9725 }
9476 9726
9477 /** 9727 /**
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
9581 return; 9831 return;
9582 } else if (startIndex + AngularMoustacheXmlExpression.OPENING_DELIMITER_LE NGTH < endIndex) { 9832 } else if (startIndex + AngularMoustacheXmlExpression.OPENING_DELIMITER_LE NGTH < endIndex) {
9583 startIndex += AngularMoustacheXmlExpression.OPENING_DELIMITER_LENGTH; 9833 startIndex += AngularMoustacheXmlExpression.OPENING_DELIMITER_LENGTH;
9584 AngularExpression expression = parseAngularExpression2(lexeme, startInde x, endIndex, offset); 9834 AngularExpression expression = parseAngularExpression2(lexeme, startInde x, endIndex, offset);
9585 expressions.add(new AngularMoustacheXmlExpression(startIndex, endIndex, expression)); 9835 expressions.add(new AngularMoustacheXmlExpression(startIndex, endIndex, expression));
9586 } 9836 }
9587 startIndex = StringUtilities.indexOf2(lexeme, endIndex + AngularMoustacheX mlExpression.CLOSING_DELIMITER_LENGTH, AngularMoustacheXmlExpression.OPENING_DEL IMITER_CHAR, AngularMoustacheXmlExpression.OPENING_DELIMITER_CHAR); 9837 startIndex = StringUtilities.indexOf2(lexeme, endIndex + AngularMoustacheX mlExpression.CLOSING_DELIMITER_LENGTH, AngularMoustacheXmlExpression.OPENING_DEL IMITER_CHAR, AngularMoustacheXmlExpression.OPENING_DELIMITER_CHAR);
9588 } 9838 }
9589 } 9839 }
9590 9840
9591 void parseEmbeddedExpressions2(ht.XmlAttributeNode node) { 9841 void parseEmbeddedExpressions2(ht.XmlTagNode node) {
9592 List<AngularMoustacheXmlExpression> expressions = [];
9593 parseEmbeddedExpressions(expressions, node.valueToken);
9594 if (!expressions.isEmpty) {
9595 node.expressions = new List.from(expressions);
9596 }
9597 }
9598
9599 void parseEmbeddedExpressions3(ht.XmlTagNode node) {
9600 List<AngularMoustacheXmlExpression> expressions = []; 9842 List<AngularMoustacheXmlExpression> expressions = [];
9601 ht.Token token = node.attributeEnd; 9843 ht.Token token = node.attributeEnd;
9602 ht.Token endToken = node.endToken; 9844 ht.Token endToken = node.endToken;
9603 bool inChild = false; 9845 bool inChild = false;
9604 while (token != endToken) { 9846 while (token != endToken) {
9605 for (ht.XmlTagNode child in node.tagNodes) { 9847 for (ht.XmlTagNode child in node.tagNodes) {
9606 if (identical(token, child.beginToken)) { 9848 if (identical(token, child.beginToken)) {
9607 inChild = true; 9849 inChild = true;
9608 break; 9850 break;
9609 } 9851 }
9610 if (identical(token, child.endToken)) { 9852 if (identical(token, child.endToken)) {
9611 inChild = false; 9853 inChild = false;
9612 break; 9854 break;
9613 } 9855 }
9614 } 9856 }
9615 if (!inChild && identical(token.type, ht.TokenType.TEXT)) { 9857 if (!inChild && identical(token.type, ht.TokenType.TEXT)) {
9616 parseEmbeddedExpressions(expressions, token); 9858 parseEmbeddedExpressions(expressions, token);
9617 } 9859 }
9618 token = token.next; 9860 token = token.next;
9619 } 9861 }
9620 node.expressions = new List.from(expressions); 9862 node.expressions = new List.from(expressions);
9621 } 9863 }
9622 9864
9865 void parseEmbeddedExpressionsInAttribute(ht.XmlAttributeNode node) {
9866 List<AngularMoustacheXmlExpression> expressions = [];
9867 parseEmbeddedExpressions(expressions, node.valueToken);
9868 if (!expressions.isEmpty) {
9869 node.expressions = new List.from(expressions);
9870 }
9871 }
9872
9623 void recordDefinedVariable(LocalVariableElementImpl variable) { 9873 void recordDefinedVariable(LocalVariableElementImpl variable) {
9624 _definedVariables.add(variable); 9874 _definedVariables.add(variable);
9625 _functionElement.localVariables = new List.from(_definedVariables); 9875 _functionElement.localVariables = new List.from(_definedVariables);
9626 } 9876 }
9627 9877
9628 /** 9878 /**
9629 * When we inject variable, we give access to the library of its type. 9879 * When we inject variable, we give access to the library of its type.
9630 */ 9880 */
9631 void recordTypeLibraryInjected(LocalVariableElementImpl variable) { 9881 void recordTypeLibraryInjected(LocalVariableElementImpl variable) {
9632 LibraryElement typeLibrary = variable.type.element.library; 9882 LibraryElement typeLibrary = variable.type.element.library;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
9832 abstract class AngularXmlExpression extends ht.XmlExpression { 10082 abstract class AngularXmlExpression extends ht.XmlExpression {
9833 /** 10083 /**
9834 * The expression that is enclosed between the delimiters. 10084 * The expression that is enclosed between the delimiters.
9835 */ 10085 */
9836 final AngularExpression expression; 10086 final AngularExpression expression;
9837 10087
9838 AngularXmlExpression(this.expression); 10088 AngularXmlExpression(this.expression);
9839 10089
9840 ht.XmlExpression_Reference getReference(int offset) { 10090 ht.XmlExpression_Reference getReference(int offset) {
9841 // main expression 10091 // main expression
9842 ht.XmlExpression_Reference reference = getReference2(expression.expression, offset); 10092 ht.XmlExpression_Reference reference = getReferenceAtNode(expression.express ion, offset);
9843 if (reference != null) { 10093 if (reference != null) {
9844 return reference; 10094 return reference;
9845 } 10095 }
9846 // filters 10096 // filters
9847 for (AngularFilterNode filter in expression.filters) { 10097 for (AngularFilterNode filter in expression.filters) {
9848 // filter name 10098 // filter name
9849 reference = getReference2(filter.name, offset); 10099 reference = getReferenceAtNode(filter.name, offset);
9850 if (reference != null) { 10100 if (reference != null) {
9851 return reference; 10101 return reference;
9852 } 10102 }
9853 // filter arguments 10103 // filter arguments
9854 for (AngularFilterArgument filterArgument in filter.arguments) { 10104 for (AngularFilterArgument filterArgument in filter.arguments) {
9855 reference = getReference2(filterArgument.expression, offset); 10105 reference = getReferenceAtNode(filterArgument.expression, offset);
9856 if (reference != null) { 10106 if (reference != null) {
9857 return reference; 10107 return reference;
9858 } 10108 }
9859 } 10109 }
9860 } 10110 }
9861 return null; 10111 return null;
9862 } 10112 }
9863 10113
9864 /** 10114 /**
9865 * If the given [AstNode] has an [Element] at the given offset, then returns 10115 * If the given [AstNode] has an [Element] at the given offset, then returns
9866 * [Reference] with this [Element]. 10116 * [Reference] with this [Element].
9867 */ 10117 */
9868 ht.XmlExpression_Reference getReference2(AstNode root, int offset) { 10118 ht.XmlExpression_Reference getReferenceAtNode(AstNode root, int offset) {
9869 AstNode node = new NodeLocator.con1(offset).searchWithin(root); 10119 AstNode node = new NodeLocator.con1(offset).searchWithin(root);
9870 if (node != null) { 10120 if (node != null) {
9871 Element element = ElementLocator.locate(node); 10121 Element element = ElementLocator.locate(node);
9872 return new ht.XmlExpression_Reference(element, node.offset, node.length); 10122 return new ht.XmlExpression_Reference(element, node.offset, node.length);
9873 } 10123 }
9874 return null; 10124 return null;
9875 } 10125 }
9876 } 10126 }
9877 10127
9878 /** 10128 /**
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
10257 /** 10507 /**
10258 * Visit a [GenerateDartHintsTask]. 10508 * Visit a [GenerateDartHintsTask].
10259 * 10509 *
10260 * @param task the task to be visited 10510 * @param task the task to be visited
10261 * @return the result of visiting the task 10511 * @return the result of visiting the task
10262 * @throws AnalysisException if the visitor throws an exception for some reaso n 10512 * @throws AnalysisException if the visitor throws an exception for some reaso n
10263 */ 10513 */
10264 E visitGenerateDartHintsTask(GenerateDartHintsTask task); 10514 E visitGenerateDartHintsTask(GenerateDartHintsTask task);
10265 10515
10266 /** 10516 /**
10517 * Visit a [GetContentTask].
10518 *
10519 * @param task the task to be visited
10520 * @return the result of visiting the task
10521 * @throws AnalysisException if the visitor throws an exception for some reaso n
10522 */
10523 E visitGetContentTask(GetContentTask task);
10524
10525 /**
10267 * Visit an [IncrementalAnalysisTask]. 10526 * Visit an [IncrementalAnalysisTask].
10268 * 10527 *
10269 * @param task the task to be visited 10528 * @param task the task to be visited
10270 * @return the result of visiting the task 10529 * @return the result of visiting the task
10271 * @throws AnalysisException if the visitor throws an exception for some reaso n 10530 * @throws AnalysisException if the visitor throws an exception for some reaso n
10272 */ 10531 */
10273 E visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTask ); 10532 E visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTask );
10274 10533
10275 /** 10534 /**
10276 * Visit a [ParseDartTask]. 10535 * Visit a [ParseDartTask].
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
10526 * Return the resolved compilation unit associated with the given source. 10785 * Return the resolved compilation unit associated with the given source.
10527 * 10786 *
10528 * @param unitSource the source for the compilation unit whose resolved AST is to be returned 10787 * @param unitSource the source for the compilation unit whose resolved AST is to be returned
10529 * @return the resolved compilation unit associated with the given source 10788 * @return the resolved compilation unit associated with the given source
10530 * @throws AnalysisException if the resolved compilation unit could not be com puted 10789 * @throws AnalysisException if the resolved compilation unit could not be com puted
10531 */ 10790 */
10532 TimestampedData<CompilationUnit> getCompilationUnit(Source unitSource) => cont ext.internalResolveCompilationUnit(unitSource, libraryElement); 10791 TimestampedData<CompilationUnit> getCompilationUnit(Source unitSource) => cont ext.internalResolveCompilationUnit(unitSource, libraryElement);
10533 } 10792 }
10534 10793
10535 /** 10794 /**
10795 * Instances of the class `GetContentTask` get the contents of a source.
10796 */
10797 class GetContentTask extends AnalysisTask {
10798 /**
10799 * The source to be read.
10800 */
10801 final Source source;
10802
10803 /**
10804 * A flag indicating whether this task is complete.
10805 */
10806 bool _complete = false;
10807
10808 /**
10809 * The contents of the source.
10810 */
10811 String _content;
10812
10813 /**
10814 * The time at which the contents of the source were last modified.
10815 */
10816 int _modificationTime = -1;
10817
10818 /**
10819 * Initialize a newly created task to perform analysis within the given contex t.
10820 *
10821 * @param context the context in which the task is to be performed
10822 * @param source the source to be parsed
10823 * @param contentData the time-stamped contents of the source
10824 */
10825 GetContentTask(InternalAnalysisContext context, this.source) : super(context) {
10826 if (source == null) {
10827 throw new IllegalArgumentException("Cannot get contents of null source");
10828 }
10829 }
10830
10831 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this);
10832
10833 /**
10834 * Return the contents of the source, or `null` if the task has not completed or if there
10835 * was an exception while getting the contents.
10836 *
10837 * @return the contents of the source
10838 */
10839 String get content => _content;
10840
10841 /**
10842 * Return the time at which the contents of the source that was parsed were la st modified, or a
10843 * negative value if the task has not yet been performed or if an exception oc curred.
10844 *
10845 * @return the time at which the contents of the source that was parsed were l ast modified
10846 */
10847 int get modificationTime => _modificationTime;
10848
10849 /**
10850 * Return `true` if this task is complete. Unlike most tasks, this task is all owed to be
10851 * visited more than once in order to support asynchronous IO. If the task is not complete when it
10852 * is visited synchronously as part of the [AnalysisTask#perform]
10853 * method, it will be visited again, using the same visitor, when the IO opera tion has been
10854 * performed.
10855 *
10856 * @return `true` if this task is complete
10857 */
10858 bool get isComplete => _complete;
10859
10860 String get taskDescription => "get contents of ${source.fullName}";
10861
10862 void internalPerform() {
10863 _complete = true;
10864 try {
10865 TimestampedData<String> data = context.getContents(source);
10866 _content = data.data;
10867 _modificationTime = data.modificationTime;
10868 } on JavaException catch (exception) {
10869 throw new AnalysisException.con2("Could not get contents of ${source}", ex ception);
10870 }
10871 }
10872 }
10873
10874 /**
10536 * Instances of the class `IncrementalAnalysisTask` incrementally update existin g analysis. 10875 * Instances of the class `IncrementalAnalysisTask` incrementally update existin g analysis.
10537 */ 10876 */
10538 class IncrementalAnalysisTask extends AnalysisTask { 10877 class IncrementalAnalysisTask extends AnalysisTask {
10539 /** 10878 /**
10540 * The information used to perform incremental analysis. 10879 * The information used to perform incremental analysis.
10541 */ 10880 */
10542 final IncrementalAnalysisCache cache; 10881 final IncrementalAnalysisCache cache;
10543 10882
10544 /** 10883 /**
10545 * The compilation unit that was produced by incrementally updating the existi ng unit. 10884 * The compilation unit that was produced by incrementally updating the existi ng unit.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
10641 CompilationUnit _unit; 10980 CompilationUnit _unit;
10642 10981
10643 /** 10982 /**
10644 * The errors that were produced by scanning and parsing the source. 10983 * The errors that were produced by scanning and parsing the source.
10645 */ 10984 */
10646 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; 10985 List<AnalysisError> _errors = AnalysisError.NO_ERRORS;
10647 10986
10648 /** 10987 /**
10649 * A flag indicating whether the source contains a 'part of' directive. 10988 * A flag indicating whether the source contains a 'part of' directive.
10650 */ 10989 */
10651 bool _hasPartOfDirective2 = false; 10990 bool _containsPartOfDirective = false;
10652 10991
10653 /** 10992 /**
10654 * A flag indicating whether the source contains a 'library' directive. 10993 * A flag indicating whether the source contains a 'library' directive.
10655 */ 10994 */
10656 bool _hasLibraryDirective2 = false; 10995 bool _containsLibraryDirective = false;
10657 10996
10658 /** 10997 /**
10659 * Initialize a newly created task to perform analysis within the given contex t. 10998 * Initialize a newly created task to perform analysis within the given contex t.
10660 * 10999 *
10661 * @param context the context in which the task is to be performed 11000 * @param context the context in which the task is to be performed
10662 * @param source the source to be parsed 11001 * @param source the source to be parsed
10663 */ 11002 */
10664 ParseDartTask(InternalAnalysisContext context, this.source) : super(context); 11003 ParseDartTask(InternalAnalysisContext context, this.source) : super(context);
10665 11004
10666 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); 11005 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this);
(...skipping 21 matching lines...) Expand all
10688 * @return the time at which the contents of the source that was parsed were l ast modified 11027 * @return the time at which the contents of the source that was parsed were l ast modified
10689 */ 11028 */
10690 int get modificationTime => _modificationTime; 11029 int get modificationTime => _modificationTime;
10691 11030
10692 /** 11031 /**
10693 * Return `true` if the source contains a 'library' directive, or `false` if t he task 11032 * Return `true` if the source contains a 'library' directive, or `false` if t he task
10694 * has not yet been performed or if an exception occurred. 11033 * has not yet been performed or if an exception occurred.
10695 * 11034 *
10696 * @return `true` if the source contains a 'library' directive 11035 * @return `true` if the source contains a 'library' directive
10697 */ 11036 */
10698 bool hasLibraryDirective() => _hasLibraryDirective2; 11037 bool hasLibraryDirective() => _containsLibraryDirective;
10699 11038
10700 /** 11039 /**
10701 * Return `true` if the source contains a 'part of' directive, or `false` if t he task 11040 * Return `true` if the source contains a 'part of' directive, or `false` if t he task
10702 * has not yet been performed or if an exception occurred. 11041 * has not yet been performed or if an exception occurred.
10703 * 11042 *
10704 * @return `true` if the source contains a 'part of' directive 11043 * @return `true` if the source contains a 'part of' directive
10705 */ 11044 */
10706 bool hasPartOfDirective() => _hasPartOfDirective2; 11045 bool hasPartOfDirective() => _containsPartOfDirective;
10707 11046
10708 String get taskDescription { 11047 String get taskDescription {
10709 if (source == null) { 11048 if (source == null) {
10710 return "parse as dart null source"; 11049 return "parse as dart null source";
10711 } 11050 }
10712 return "parse as dart ${source.fullName}"; 11051 return "parse as dart ${source.fullName}";
10713 } 11052 }
10714 11053
10715 void internalPerform() { 11054 void internalPerform() {
10716 RecordingErrorListener errorListener = new RecordingErrorListener(); 11055 RecordingErrorListener errorListener = new RecordingErrorListener();
10717 InternalAnalysisContext context = this.context; 11056 InternalAnalysisContext context = this.context;
10718 TimestampedData<Token> data = context.internalScanTokenStream(source); 11057 TimestampedData<Token> data = context.internalScanTokenStream(source);
10719 _modificationTime = data.modificationTime; 11058 _modificationTime = data.modificationTime;
10720 Token token = data.data; 11059 Token token = data.data;
10721 if (token == null) { 11060 if (token == null) {
10722 throw new AnalysisException.con1("Could not get token stream for ${source. fullName}"); 11061 throw new AnalysisException.con1("Could not get token stream for ${source. fullName}");
10723 } 11062 }
10724 // 11063 //
10725 // Then parse the token stream. 11064 // Then parse the token stream.
10726 // 11065 //
10727 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse .start(); 11066 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse .start();
10728 try { 11067 try {
10729 Parser parser = new Parser(source, errorListener); 11068 Parser parser = new Parser(source, errorListener);
10730 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies ; 11069 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies ;
10731 _unit = parser.parseCompilationUnit(token); 11070 _unit = parser.parseCompilationUnit(token);
10732 _errors = errorListener.getErrors2(source); 11071 _errors = errorListener.getErrors2(source);
10733 for (Directive directive in _unit.directives) { 11072 for (Directive directive in _unit.directives) {
10734 if (directive is LibraryDirective) { 11073 if (directive is LibraryDirective) {
10735 _hasLibraryDirective2 = true; 11074 _containsLibraryDirective = true;
10736 } else if (directive is PartOfDirective) { 11075 } else if (directive is PartOfDirective) {
10737 _hasPartOfDirective2 = true; 11076 _containsPartOfDirective = true;
10738 } 11077 }
10739 } 11078 }
10740 _unit.lineInfo = context.getLineInfo(source); 11079 _unit.lineInfo = context.getLineInfo(source);
10741 } finally { 11080 } finally {
10742 timeCounterParse.stop(); 11081 timeCounterParse.stop();
10743 } 11082 }
10744 } 11083 }
10745 } 11084 }
10746 11085
10747 /** 11086 /**
10748 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil e. 11087 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil e.
10749 */ 11088 */
10750 class ParseHtmlTask extends AnalysisTask { 11089 class ParseHtmlTask extends AnalysisTask {
10751 /** 11090 /**
10752 * The source to be parsed. 11091 * The source to be parsed.
10753 */ 11092 */
10754 final Source source; 11093 final Source source;
10755 11094
10756 /** 11095 /**
11096 * The contents of the source.
11097 */
11098 String _content;
11099
11100 /**
10757 * The time at which the contents of the source were last modified. 11101 * The time at which the contents of the source were last modified.
10758 */ 11102 */
10759 int _modificationTime = -1; 11103 int _modificationTime = 0;
10760 11104
10761 /** 11105 /**
10762 * The line information that was produced. 11106 * The line information that was produced.
10763 */ 11107 */
10764 LineInfo _lineInfo; 11108 LineInfo _lineInfo;
10765 11109
10766 /** 11110 /**
10767 * The HTML unit that was produced by parsing the source. 11111 * The HTML unit that was produced by parsing the source.
10768 */ 11112 */
10769 ht.HtmlUnit _unit; 11113 ht.HtmlUnit _unit;
(...skipping 16 matching lines...) Expand all
10786 /** 11130 /**
10787 * The name of the 'script' tag in an HTML file. 11131 * The name of the 'script' tag in an HTML file.
10788 */ 11132 */
10789 static String _TAG_SCRIPT = "script"; 11133 static String _TAG_SCRIPT = "script";
10790 11134
10791 /** 11135 /**
10792 * Initialize a newly created task to perform analysis within the given contex t. 11136 * Initialize a newly created task to perform analysis within the given contex t.
10793 * 11137 *
10794 * @param context the context in which the task is to be performed 11138 * @param context the context in which the task is to be performed
10795 * @param source the source to be parsed 11139 * @param source the source to be parsed
11140 * @param contentData the time-stamped contents of the source
10796 */ 11141 */
10797 ParseHtmlTask(InternalAnalysisContext context, this.source) : super(context); 11142 ParseHtmlTask(InternalAnalysisContext context, this.source, TimestampedData<St ring> contentData) : super(context) {
11143 _content = contentData.data;
11144 _modificationTime = contentData.modificationTime;
11145 }
10798 11146
10799 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); 11147 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this);
10800 11148
10801 /** 11149 /**
10802 * Return the errors that were produced by scanning and parsing the source, or `null` if the 11150 * Return the errors that were produced by scanning and parsing the source, or `null` if the
10803 * task has not yet been performed or if an exception occurred. 11151 * task has not yet been performed or if an exception occurred.
10804 * 11152 *
10805 * @return the errors that were produced by scanning and parsing the source 11153 * @return the errors that were produced by scanning and parsing the source
10806 */ 11154 */
10807 List<AnalysisError> get errors => _errors; 11155 List<AnalysisError> get errors => _errors;
(...skipping 30 matching lines...) Expand all
10838 11186
10839 String get taskDescription { 11187 String get taskDescription {
10840 if (source == null) { 11188 if (source == null) {
10841 return "parse as html null source"; 11189 return "parse as html null source";
10842 } 11190 }
10843 return "parse as html ${source.fullName}"; 11191 return "parse as html ${source.fullName}";
10844 } 11192 }
10845 11193
10846 void internalPerform() { 11194 void internalPerform() {
10847 try { 11195 try {
10848 TimestampedData<String> contents = context.getContents(source); 11196 ht.AbstractScanner scanner = new ht.StringScanner(source, _content);
10849 _modificationTime = contents.modificationTime;
10850 ht.AbstractScanner scanner = new ht.StringScanner(source, contents.data);
10851 scanner.passThroughElements = <String> [_TAG_SCRIPT]; 11197 scanner.passThroughElements = <String> [_TAG_SCRIPT];
10852 ht.Token token = scanner.tokenize(); 11198 ht.Token token = scanner.tokenize();
10853 _lineInfo = new LineInfo(scanner.lineStarts); 11199 _lineInfo = new LineInfo(scanner.lineStarts);
10854 RecordingErrorListener errorListener = new RecordingErrorListener(); 11200 RecordingErrorListener errorListener = new RecordingErrorListener();
10855 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); 11201 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo);
10856 _errors = errorListener.getErrors2(source); 11202 _errors = errorListener.getErrors2(source);
10857 _referencedLibraries = librarySources; 11203 _referencedLibraries = librarySources;
10858 } on JavaException catch (exception) { 11204 } on JavaException catch (exception) {
10859 throw new AnalysisException.con3(exception); 11205 throw new AnalysisException.con3(exception);
10860 } 11206 }
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
11618 _errors = errorListener.getErrors2(source); 11964 _errors = errorListener.getErrors2(source);
11619 } on JavaException catch (exception) { 11965 } on JavaException catch (exception) {
11620 throw new AnalysisException.con3(exception); 11966 throw new AnalysisException.con3(exception);
11621 } finally { 11967 } finally {
11622 timeCounterScan.stop(); 11968 timeCounterScan.stop();
11623 } 11969 }
11624 } 11970 }
11625 } 11971 }
11626 11972
11627 /** 11973 /**
11974 * The unique instances of the class `WaitForAsyncTask` represents a state in wh ich there is
11975 * no analysis work that can be done until some asynchronous task (such as IO) h as completed, but
11976 * where analysis is not yet complete.
11977 */
11978 class WaitForAsyncTask extends AnalysisTask {
11979 /**
11980 * The unique instance of this class.
11981 */
11982 static WaitForAsyncTask _UniqueInstance = new WaitForAsyncTask();
11983
11984 /**
11985 * Return the unique instance of this class.
11986 *
11987 * @return the unique instance of this class
11988 */
11989 static WaitForAsyncTask get instance => _UniqueInstance;
11990
11991 /**
11992 * Prevent the creation of instances of this class.
11993 */
11994 WaitForAsyncTask() : super(null);
11995
11996 accept(AnalysisTaskVisitor visitor) => null;
11997
11998 String get taskDescription => "Waiting for async analysis";
11999
12000 void internalPerform() {
12001 }
12002 }
12003
12004 /**
11628 * The interface `Logger` defines the behavior of objects that can be used to re ceive 12005 * The interface `Logger` defines the behavior of objects that can be used to re ceive
11629 * information about errors within the analysis engine. Implementations usually write this 12006 * information about errors within the analysis engine. Implementations usually write this
11630 * information to a file, but can also record the information for later use (suc h as during testing) 12007 * information to a file, but can also record the information for later use (suc h as during testing)
11631 * or even ignore the information. 12008 * or even ignore the information.
11632 */ 12009 */
11633 abstract class Logger { 12010 abstract class Logger {
11634 static final Logger NULL = new Logger_NullLogger(); 12011 static final Logger NULL = new Logger_NullLogger();
11635 12012
11636 /** 12013 /**
11637 * Log the given message as an error. 12014 * Log the given message as an error.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
11674 12051
11675 void logError2(String message, Exception exception) { 12052 void logError2(String message, Exception exception) {
11676 } 12053 }
11677 12054
11678 void logInformation(String message) { 12055 void logInformation(String message) {
11679 } 12056 }
11680 12057
11681 void logInformation3(String message, Exception exception) { 12058 void logInformation3(String message, Exception exception) {
11682 } 12059 }
11683 } 12060 }
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