Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 991 | 991 |
| 992 /** | 992 /** |
| 993 * The listeners that are to be notified when various analysis results are pro duced in this | 993 * The listeners that are to be notified when various analysis results are pro duced in this |
| 994 * context. | 994 * context. |
| 995 */ | 995 */ |
| 996 List<AnalysisListener> _listeners = new List<AnalysisListener>(); | 996 List<AnalysisListener> _listeners = new List<AnalysisListener>(); |
| 997 | 997 |
| 998 /** | 998 /** |
| 999 * Initialize a newly created analysis context. | 999 * Initialize a newly created analysis context. |
| 1000 */ | 1000 */ |
| 1001 AnalysisContextImpl() : super() { | 1001 AnalysisContextImpl() { |
| 1002 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); | 1002 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); |
| 1003 _privatePartition = new UniversalCachePartition(this, AnalysisOptionsImpl.DE FAULT_CACHE_SIZE, new AnalysisContextImpl_ContextRetentionPolicy(this)); | 1003 _privatePartition = new UniversalCachePartition(this, AnalysisOptionsImpl.DE FAULT_CACHE_SIZE, new AnalysisContextImpl_ContextRetentionPolicy(this)); |
| 1004 _cache = createCacheFromSourceFactory(null); | 1004 _cache = createCacheFromSourceFactory(null); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 IncrementalAnalysisCache get test_incrementalAnalysisCache { | |
|
Brian Wilkerson
2014/10/05 17:54:37
I really dislike having methods that exist only fo
scheglov
2014/10/05 19:55:36
These methods are used instead of using reflection
| |
| 1008 return _incrementalAnalysisCache; | |
| 1009 } | |
| 1010 | |
| 1011 set test_incrementalAnalysisCache(IncrementalAnalysisCache value) { | |
| 1012 _incrementalAnalysisCache = value; | |
| 1013 } | |
| 1014 | |
| 1015 List<Source> get test_priorityOrder => _priorityOrder; | |
| 1016 | |
| 1007 @override | 1017 @override |
| 1008 void addListener(AnalysisListener listener) { | 1018 void addListener(AnalysisListener listener) { |
| 1009 if (!_listeners.contains(listener)) { | 1019 if (!_listeners.contains(listener)) { |
| 1010 _listeners.add(listener); | 1020 _listeners.add(listener); |
| 1011 } | 1021 } |
| 1012 } | 1022 } |
| 1013 | 1023 |
| 1014 @override | 1024 @override |
| 1015 void addSourceInfo(Source source, SourceEntry info) { | 1025 void addSourceInfo(Source source, SourceEntry info) { |
| 1016 // This implementation assumes that the access to the cache does not need to be synchronized | 1026 // This implementation assumes that the access to the cache does not need to be synchronized |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 } | 1403 } |
| 1394 | 1404 |
| 1395 @override | 1405 @override |
| 1396 List<Source> getHtmlFilesReferencing(Source source) { | 1406 List<Source> getHtmlFilesReferencing(Source source) { |
| 1397 SourceKind sourceKind = getKindOf(source); | 1407 SourceKind sourceKind = getKindOf(source); |
| 1398 if (sourceKind == null) { | 1408 if (sourceKind == null) { |
| 1399 return Source.EMPTY_ARRAY; | 1409 return Source.EMPTY_ARRAY; |
| 1400 } | 1410 } |
| 1401 List<Source> htmlSources = new List<Source>(); | 1411 List<Source> htmlSources = new List<Source>(); |
| 1402 while (true) { | 1412 while (true) { |
| 1403 if (sourceKind == SourceKind.LIBRARY) { | 1413 if (sourceKind == SourceKind.PART) { |
| 1404 } else if (sourceKind == SourceKind.PART) { | |
| 1405 List<Source> librarySources = getLibrariesContaining(source); | 1414 List<Source> librarySources = getLibrariesContaining(source); |
| 1406 MapIterator<Source, SourceEntry> partIterator = _cache.iterator(); | 1415 MapIterator<Source, SourceEntry> partIterator = _cache.iterator(); |
| 1407 while (partIterator.moveNext()) { | 1416 while (partIterator.moveNext()) { |
| 1408 SourceEntry sourceEntry = partIterator.value; | 1417 SourceEntry sourceEntry = partIterator.value; |
| 1409 if (sourceEntry.kind == SourceKind.HTML) { | 1418 if (sourceEntry.kind == SourceKind.HTML) { |
| 1410 List<Source> referencedLibraries = (sourceEntry as HtmlEntry).getVal ue(HtmlEntry.REFERENCED_LIBRARIES); | 1419 List<Source> referencedLibraries = (sourceEntry as HtmlEntry).getVal ue(HtmlEntry.REFERENCED_LIBRARIES); |
| 1411 if (_containsAny(referencedLibraries, librarySources)) { | 1420 if (_containsAny(referencedLibraries, librarySources)) { |
| 1412 htmlSources.add(partIterator.key); | 1421 htmlSources.add(partIterator.key); |
| 1413 } | 1422 } |
| 1414 } | 1423 } |
| 1415 } | 1424 } |
| 1425 } else { | |
| 1426 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | |
| 1427 while (iterator.moveNext()) { | |
| 1428 SourceEntry sourceEntry = iterator.value; | |
| 1429 if (sourceEntry.kind == SourceKind.HTML) { | |
| 1430 List<Source> referencedLibraries = (sourceEntry as HtmlEntry).getVal ue(HtmlEntry.REFERENCED_LIBRARIES); | |
| 1431 if (_contains(referencedLibraries, source)) { | |
| 1432 htmlSources.add(iterator.key); | |
| 1433 } | |
| 1434 } | |
| 1435 } | |
| 1416 } | 1436 } |
| 1417 break; | 1437 break; |
| 1418 } | 1438 } |
| 1419 if (htmlSources.isEmpty) { | 1439 if (htmlSources.isEmpty) { |
| 1420 return Source.EMPTY_ARRAY; | 1440 return Source.EMPTY_ARRAY; |
| 1421 } | 1441 } |
| 1422 return new List.from(htmlSources); | 1442 return new List.from(htmlSources); |
| 1423 } | 1443 } |
| 1424 | 1444 |
| 1425 @override | 1445 @override |
| (...skipping 11757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13183 } | 13203 } |
| 13184 } | 13204 } |
| 13185 | 13205 |
| 13186 /** | 13206 /** |
| 13187 * Return the sources of libraries that are referenced in the specified HTML f ile. | 13207 * Return the sources of libraries that are referenced in the specified HTML f ile. |
| 13188 * | 13208 * |
| 13189 * @return the sources of libraries that are referenced in the HTML file | 13209 * @return the sources of libraries that are referenced in the HTML file |
| 13190 */ | 13210 */ |
| 13191 List<Source> get librarySources { | 13211 List<Source> get librarySources { |
| 13192 List<Source> libraries = new List<Source>(); | 13212 List<Source> libraries = new List<Source>(); |
| 13193 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources(this, l ibraries)); | 13213 _unit.accept(new ParseHtmlTask_getLibrarySources(this, libraries)); |
| 13194 if (libraries.isEmpty) { | 13214 if (libraries.isEmpty) { |
| 13195 return Source.EMPTY_ARRAY; | 13215 return Source.EMPTY_ARRAY; |
| 13196 } | 13216 } |
| 13197 return new List.from(libraries); | 13217 return libraries; |
| 13198 } | 13218 } |
| 13199 | 13219 |
| 13200 /** | 13220 /** |
| 13201 * Resolves directives in the given [CompilationUnit]. | 13221 * Resolves directives in the given [CompilationUnit]. |
| 13202 */ | 13222 */ |
| 13203 void _resolveScriptDirectives(CompilationUnit script, AnalysisErrorListener er rorListener) { | 13223 void _resolveScriptDirectives(CompilationUnit script, AnalysisErrorListener er rorListener) { |
| 13204 if (script == null) { | 13224 if (script == null) { |
| 13205 return; | 13225 return; |
| 13206 } | 13226 } |
| 13207 AnalysisContext analysisContext = context; | 13227 AnalysisContext analysisContext = context; |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13902 @override | 13922 @override |
| 13903 Object visitXmlTagNode(ht.XmlTagNode node) { | 13923 Object visitXmlTagNode(ht.XmlTagNode node) { |
| 13904 NgModelProcessor directive = NgModelProcessor.INSTANCE; | 13924 NgModelProcessor directive = NgModelProcessor.INSTANCE; |
| 13905 if (directive.canApply(node)) { | 13925 if (directive.canApply(node)) { |
| 13906 directive._applyTopDeclarations(AngularHtmlUnitResolver_this, node); | 13926 directive._applyTopDeclarations(AngularHtmlUnitResolver_this, node); |
| 13907 } | 13927 } |
| 13908 return super.visitXmlTagNode(node); | 13928 return super.visitXmlTagNode(node); |
| 13909 } | 13929 } |
| 13910 } | 13930 } |
| 13911 | 13931 |
| 13912 class RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources extends ht.RecursiveXm lVisitor<Object> { | 13932 class ParseHtmlTask_getLibrarySources extends ht.RecursiveXmlVisitor<Object> { |
| 13913 final ParseHtmlTask ParseHtmlTask_this; | 13933 final ParseHtmlTask _task; |
| 13914 | 13934 |
| 13915 List<Source> libraries; | 13935 List<Source> libraries; |
| 13916 | 13936 |
| 13917 RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources(this.ParseHtmlTask_this, t his.libraries) : super(); | 13937 ParseHtmlTask_getLibrarySources(this._task, this.libraries) : super(); |
| 13918 | 13938 |
| 13919 @override | 13939 @override |
| 13920 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) { | 13940 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) { |
| 13921 ht.XmlAttributeNode scriptAttribute = null; | 13941 ht.XmlAttributeNode scriptAttribute = null; |
| 13922 for (ht.XmlAttributeNode attribute in node.attributes) { | 13942 for (ht.XmlAttributeNode attribute in node.attributes) { |
| 13923 if (javaStringEqualsIgnoreCase(attribute.name, ParseHtmlTask._ATTRIBUTE_SR C)) { | 13943 if (javaStringEqualsIgnoreCase(attribute.name, ParseHtmlTask._ATTRIBUTE_SR C)) { |
| 13924 scriptAttribute = attribute; | 13944 scriptAttribute = attribute; |
| 13925 } | 13945 } |
| 13926 } | 13946 } |
| 13927 if (scriptAttribute != null) { | 13947 if (scriptAttribute != null) { |
| 13928 try { | 13948 try { |
| 13929 Uri uri = new Uri(path: scriptAttribute.text); | 13949 Uri uri = new Uri(path: scriptAttribute.text); |
| 13930 String fileName = uri.path; | 13950 String fileName = uri.path; |
| 13931 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolveU ri(ParseHtmlTask_this.source, fileName); | 13951 Source librarySource = _task.context.sourceFactory.resolveUri(_task.sour ce, fileName); |
| 13932 if (ParseHtmlTask_this.context.exists(librarySource)) { | 13952 if (_task.context.exists(librarySource)) { |
| 13933 libraries.add(librarySource); | 13953 libraries.add(librarySource); |
| 13934 } | 13954 } |
| 13935 } on URISyntaxException catch (e) { | 13955 } on FormatException catch (e) { |
| 13936 } | 13956 } |
| 13937 } | 13957 } |
| 13938 return super.visitHtmlScriptTagNode(node); | 13958 return super.visitHtmlScriptTagNode(node); |
| 13939 } | 13959 } |
| 13940 } | 13960 } |
| 13941 | 13961 |
| 13942 class RecursiveXmlVisitor_ParseHtmlTask_internalPerform extends ht.RecursiveXmlV isitor<Object> { | 13962 class RecursiveXmlVisitor_ParseHtmlTask_internalPerform extends ht.RecursiveXmlV isitor<Object> { |
| 13943 final ParseHtmlTask ParseHtmlTask_this; | 13963 final ParseHtmlTask ParseHtmlTask_this; |
| 13944 | 13964 |
| 13945 RecordingErrorListener errorListener; | 13965 RecordingErrorListener errorListener; |
| (...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15546 } | 15566 } |
| 15547 return builder.toString(); | 15567 return builder.toString(); |
| 15548 } | 15568 } |
| 15549 } | 15569 } |
| 15550 | 15570 |
| 15551 /** | 15571 /** |
| 15552 * Instances of the class `WorkIterator` implement an iterator that returns the sources in a | 15572 * Instances of the class `WorkIterator` implement an iterator that returns the sources in a |
| 15553 * work manager in the order in which they are to be analyzed. | 15573 * work manager in the order in which they are to be analyzed. |
| 15554 */ | 15574 */ |
| 15555 class WorkManager_WorkIterator { | 15575 class WorkManager_WorkIterator { |
| 15556 final WorkManager WorkManager_this; | 15576 final WorkManager _manager; |
| 15557 | 15577 |
| 15558 /** | 15578 /** |
| 15559 * The index of the work queue through which we are currently iterating. | 15579 * The index of the work queue through which we are currently iterating. |
| 15560 */ | 15580 */ |
| 15561 int _queueIndex = 0; | 15581 int _queueIndex = 0; |
| 15562 | 15582 |
| 15563 /** | 15583 /** |
| 15564 * The index of the next element of the work queue to be returned. | 15584 * The index of the next element of the work queue to be returned. |
| 15565 */ | 15585 */ |
| 15566 int _index = -1; | 15586 int _index = -1; |
| 15567 | 15587 |
| 15568 /** | 15588 /** |
| 15569 * Initialize a newly created iterator to be ready to return the first element in the iteration. | 15589 * Initialize a newly created iterator to be ready to return the first element in the iteration. |
| 15570 */ | 15590 */ |
| 15571 WorkManager_WorkIterator(this.WorkManager_this) { | 15591 WorkManager_WorkIterator(this._manager) { |
| 15572 _advance(); | 15592 _advance(); |
| 15573 } | 15593 } |
| 15574 | 15594 |
| 15575 /** | 15595 /** |
| 15576 * Return `true` if there is another [Source] available for processing. | 15596 * Return `true` if there is another [Source] available for processing. |
| 15577 * | 15597 * |
| 15578 * @return `true` if there is another [Source] available for processing | 15598 * @return `true` if there is another [Source] available for processing |
| 15579 */ | 15599 */ |
| 15580 bool get hasNext => _queueIndex < WorkManager_this._workQueues.length; | 15600 bool get hasNext => _queueIndex < _manager._workQueues.length; |
| 15581 | 15601 |
| 15582 /** | 15602 /** |
| 15583 * Return the next [Source] available for processing and advance so that the r eturned | 15603 * Return the next [Source] available for processing and advance so that the r eturned |
| 15584 * source will not be returned again. | 15604 * source will not be returned again. |
| 15585 * | 15605 * |
| 15586 * @return the next [Source] available for processing | 15606 * @return the next [Source] available for processing |
| 15587 */ | 15607 */ |
| 15588 Source next() { | 15608 Source next() { |
| 15589 if (!hasNext) { | 15609 if (!hasNext) { |
| 15590 throw new NoSuchElementException(); | 15610 throw new NoSuchElementException(); |
| 15591 } | 15611 } |
| 15592 Source source = WorkManager_this._workQueues[_queueIndex][_index]; | 15612 Source source = _manager._workQueues[_queueIndex][_index]; |
| 15593 _advance(); | 15613 _advance(); |
| 15594 return source; | 15614 return source; |
| 15595 } | 15615 } |
| 15596 | 15616 |
| 15597 /** | 15617 /** |
| 15598 * Increment the [index] and [queueIndex] so that they are either indicating t he | 15618 * Increment the [index] and [queueIndex] so that they are either indicating t he |
| 15599 * next source to be returned or are indicating that there are no more sources to be returned. | 15619 * next source to be returned or are indicating that there are no more sources to be returned. |
| 15600 */ | 15620 */ |
| 15601 void _advance() { | 15621 void _advance() { |
| 15602 _index++; | 15622 _index++; |
| 15603 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { | 15623 if (_index >= _manager._workQueues[_queueIndex].length) { |
| 15604 _index = 0; | 15624 _index = 0; |
| 15605 _queueIndex++; | 15625 _queueIndex++; |
| 15606 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th is._workQueues[_queueIndex].isEmpty) { | 15626 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { |
| 15607 _queueIndex++; | 15627 _queueIndex++; |
| 15608 } | 15628 } |
| 15609 } | 15629 } |
| 15610 } | 15630 } |
| 15611 } | 15631 } |
| OLD | NEW |