| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine; | 4 library engine; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'java_engine.dart'; | 7 import 'java_engine.dart'; |
| 8 import 'utilities_collection.dart'; | 8 import 'utilities_collection.dart'; |
| 9 import 'utilities_general.dart'; | 9 import 'utilities_general.dart'; |
| 10 import 'instrumentation.dart'; | 10 import 'instrumentation.dart'; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 * | 456 * |
| 457 * @param unitSource the source of the compilation unit | 457 * @param unitSource the source of the compilation unit |
| 458 * @param librarySource the source of the defining compilation unit of the lib
rary containing the | 458 * @param librarySource the source of the defining compilation unit of the lib
rary containing the |
| 459 * compilation unit | 459 * compilation unit |
| 460 * @return a fully resolved AST for the compilation unit | 460 * @return a fully resolved AST for the compilation unit |
| 461 * @see #resolveCompilationUnit(Source, Source) | 461 * @see #resolveCompilationUnit(Source, Source) |
| 462 */ | 462 */ |
| 463 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource); | 463 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource); |
| 464 | 464 |
| 465 /** | 465 /** |
| 466 * Return a fully resolved HTML unit, or `null` if the resolved unit is not al
ready |
| 467 * computed. |
| 468 * |
| 469 * @param htmlSource the source of the HTML unit |
| 470 * @return a fully resolved HTML unit |
| 471 * @see #resolveHtmlUnit(Source) |
| 472 */ |
| 473 HtmlUnit getResolvedHtmlUnit(Source htmlSource); |
| 474 |
| 475 /** |
| 466 * Return the source factory used to create the sources that can be analyzed i
n this context. | 476 * Return the source factory used to create the sources that can be analyzed i
n this context. |
| 467 * | 477 * |
| 468 * @return the source factory used to create the sources that can be analyzed
in this context | 478 * @return the source factory used to create the sources that can be analyzed
in this context |
| 469 */ | 479 */ |
| 470 SourceFactory get sourceFactory; | 480 SourceFactory get sourceFactory; |
| 471 | 481 |
| 472 /** | 482 /** |
| 473 * Return `true` if the given source is known to be the defining compilation u
nit of a | 483 * Return `true` if the given source is known to be the defining compilation u
nit of a |
| 474 * library that can be run on a client (references 'dart:html', either directl
y or indirectly). | 484 * library that can be run on a client (references 'dart:html', either directl
y or indirectly). |
| 475 * | 485 * |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 abstract class ChangeNotice implements AnalysisErrorInfo { | 806 abstract class ChangeNotice implements AnalysisErrorInfo { |
| 797 /** | 807 /** |
| 798 * Return the fully resolved AST that changed as a result of the analysis, or
`null` if the | 808 * Return the fully resolved AST that changed as a result of the analysis, or
`null` if the |
| 799 * AST was not changed. | 809 * AST was not changed. |
| 800 * | 810 * |
| 801 * @return the fully resolved AST that changed as a result of the analysis | 811 * @return the fully resolved AST that changed as a result of the analysis |
| 802 */ | 812 */ |
| 803 CompilationUnit get compilationUnit; | 813 CompilationUnit get compilationUnit; |
| 804 | 814 |
| 805 /** | 815 /** |
| 816 * Return the fully resolved HTML that changed as a result of the analysis, or
`null` if the |
| 817 * HTML was not changed. |
| 818 * |
| 819 * @return the fully resolved HTML that changed as a result of the analysis |
| 820 */ |
| 821 HtmlUnit get htmlUnit; |
| 822 |
| 823 /** |
| 806 * Return the source for which the result is being reported. | 824 * Return the source for which the result is being reported. |
| 807 * | 825 * |
| 808 * @return the source for which the result is being reported | 826 * @return the source for which the result is being reported |
| 809 */ | 827 */ |
| 810 Source get source; | 828 Source get source; |
| 811 } | 829 } |
| 812 | 830 |
| 813 /** | 831 /** |
| 814 * Instances of the class `ChangeSet` indicate what sources have been added, cha
nged, or | 832 * Instances of the class `ChangeSet` indicate what sources have been added, cha
nged, or |
| 815 * removed. | 833 * removed. |
| (...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3511 } | 3529 } |
| 3512 | 3530 |
| 3513 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { | 3531 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 3514 SourceEntry sourceEntry = getReadableSourceEntry(unitSource); | 3532 SourceEntry sourceEntry = getReadableSourceEntry(unitSource); |
| 3515 if (sourceEntry is DartEntry) { | 3533 if (sourceEntry is DartEntry) { |
| 3516 return (sourceEntry as DartEntry).getValue2(DartEntry.RESOLVED_UNIT, libra
rySource); | 3534 return (sourceEntry as DartEntry).getValue2(DartEntry.RESOLVED_UNIT, libra
rySource); |
| 3517 } | 3535 } |
| 3518 return null; | 3536 return null; |
| 3519 } | 3537 } |
| 3520 | 3538 |
| 3539 HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 3540 SourceEntry sourceEntry = getReadableSourceEntry(htmlSource); |
| 3541 if (sourceEntry is HtmlEntry) { |
| 3542 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; |
| 3543 if (htmlEntry.getValue(HtmlEntry.ELEMENT) != null) { |
| 3544 return htmlEntry.getValue(HtmlEntry.PARSED_UNIT); |
| 3545 } |
| 3546 } |
| 3547 return null; |
| 3548 } |
| 3549 |
| 3521 SourceFactory get sourceFactory => _sourceFactory; | 3550 SourceFactory get sourceFactory => _sourceFactory; |
| 3522 | 3551 |
| 3523 /** | 3552 /** |
| 3524 * Return a list of the sources that would be processed by [performAnalysisTas
k]. This | 3553 * Return a list of the sources that would be processed by [performAnalysisTas
k]. This |
| 3525 * method duplicates, and must therefore be kept in sync with, [getNextTaskAna
lysisTask]. | 3554 * method duplicates, and must therefore be kept in sync with, [getNextTaskAna
lysisTask]. |
| 3526 * This method is intended to be used for testing purposes only. | 3555 * This method is intended to be used for testing purposes only. |
| 3527 * | 3556 * |
| 3528 * @return a list of the sources that would be processed by [performAnalysisTa
sk] | 3557 * @return a list of the sources that would be processed by [performAnalysisTa
sk] |
| 3529 */ | 3558 */ |
| 3530 List<Source> get sourcesNeedingProcessing { | 3559 List<Source> get sourcesNeedingProcessing { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3668 | 3697 |
| 3669 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { | 3698 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 3670 if (library == null) { | 3699 if (library == null) { |
| 3671 return null; | 3700 return null; |
| 3672 } | 3701 } |
| 3673 return resolveCompilationUnit2(unitSource, library.source); | 3702 return resolveCompilationUnit2(unitSource, library.source); |
| 3674 } | 3703 } |
| 3675 | 3704 |
| 3676 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) => getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT,
null); | 3705 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) => getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT,
null); |
| 3677 | 3706 |
| 3678 HtmlUnit resolveHtmlUnit(Source htmlSource) => parseHtmlUnit(htmlSource); | 3707 HtmlUnit resolveHtmlUnit(Source htmlSource) { |
| 3708 computeHtmlElement(htmlSource); |
| 3709 return parseHtmlUnit(htmlSource); |
| 3710 } |
| 3679 | 3711 |
| 3680 void set analysisOptions(AnalysisOptions options) { | 3712 void set analysisOptions(AnalysisOptions options) { |
| 3681 { | 3713 { |
| 3682 bool needsRecompute = this._options.analyzeFunctionBodies != options.analy
zeFunctionBodies || this._options.dart2jsHint != options.dart2jsHint || (this._o
ptions.hint && !options.hint) || this._options.preserveComments != options.prese
rveComments; | 3714 bool needsRecompute = this._options.analyzeFunctionBodies != options.analy
zeFunctionBodies || this._options.dart2jsHint != options.dart2jsHint || (this._o
ptions.hint && !options.hint) || this._options.preserveComments != options.prese
rveComments; |
| 3683 int cacheSize = options.cacheSize; | 3715 int cacheSize = options.cacheSize; |
| 3684 if (this._options.cacheSize != cacheSize) { | 3716 if (this._options.cacheSize != cacheSize) { |
| 3685 this._options.cacheSize = cacheSize; | 3717 this._options.cacheSize = cacheSize; |
| 3686 _cache.maxCacheSize = cacheSize; | 3718 _cache.maxCacheSize = cacheSize; |
| 3687 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; | 3719 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; |
| 3688 if (_priorityOrder.length > maxPriorityOrderSize) { | 3720 if (_priorityOrder.length > maxPriorityOrderSize) { |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5129 htmlEntry = getReadableHtmlEntry(source); | 5161 htmlEntry = getReadableHtmlEntry(source); |
| 5130 if (htmlEntry == null) { | 5162 if (htmlEntry == null) { |
| 5131 throw new AnalysisException.con1("An HTML file became a non-HTML fil
e: ${source.fullName}"); | 5163 throw new AnalysisException.con1("An HTML file became a non-HTML fil
e: ${source.fullName}"); |
| 5132 } | 5164 } |
| 5133 } | 5165 } |
| 5134 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 5166 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 5135 if (thrownException == null) { | 5167 if (thrownException == null) { |
| 5136 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); | 5168 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); |
| 5137 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); | 5169 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); |
| 5138 ChangeNoticeImpl notice = getNotice(source); | 5170 ChangeNoticeImpl notice = getNotice(source); |
| 5171 notice.htmlUnit = task.resolvedUnit; |
| 5139 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LIN
E_INFO)); | 5172 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LIN
E_INFO)); |
| 5140 } else { | 5173 } else { |
| 5141 htmlCopy.recordResolutionError(); | 5174 htmlCopy.recordResolutionError(); |
| 5142 } | 5175 } |
| 5143 htmlCopy.exception = thrownException; | 5176 htmlCopy.exception = thrownException; |
| 5144 _cache.put(source, htmlCopy); | 5177 _cache.put(source, htmlCopy); |
| 5145 htmlEntry = htmlCopy; | 5178 htmlEntry = htmlCopy; |
| 5146 } else { | 5179 } else { |
| 5147 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 5180 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 5148 if (thrownException == null || resultTime >= 0) { | 5181 if (thrownException == null || resultTime >= 0) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5389 */ | 5422 */ |
| 5390 final Source source; | 5423 final Source source; |
| 5391 | 5424 |
| 5392 /** | 5425 /** |
| 5393 * The fully resolved AST that changed as a result of the analysis, or `null`
if the AST was | 5426 * The fully resolved AST that changed as a result of the analysis, or `null`
if the AST was |
| 5394 * not changed. | 5427 * not changed. |
| 5395 */ | 5428 */ |
| 5396 CompilationUnit compilationUnit; | 5429 CompilationUnit compilationUnit; |
| 5397 | 5430 |
| 5398 /** | 5431 /** |
| 5432 * The fully resolved HTML that changed as a result of the analysis, or `null`
if the HTML |
| 5433 * was not changed. |
| 5434 */ |
| 5435 HtmlUnit htmlUnit; |
| 5436 |
| 5437 /** |
| 5399 * The errors that changed as a result of the analysis, or `null` if errors we
re not | 5438 * The errors that changed as a result of the analysis, or `null` if errors we
re not |
| 5400 * changed. | 5439 * changed. |
| 5401 */ | 5440 */ |
| 5402 List<AnalysisError> _errors; | 5441 List<AnalysisError> _errors; |
| 5403 | 5442 |
| 5404 /** | 5443 /** |
| 5405 * The line information associated with the source, or `null` if errors were n
ot changed. | 5444 * The line information associated with the source, or `null` if errors were n
ot changed. |
| 5406 */ | 5445 */ |
| 5407 LineInfo _lineInfo; | 5446 LineInfo _lineInfo; |
| 5408 | 5447 |
| 5409 /** | 5448 /** |
| 5410 * An empty array of change notices. | 5449 * An empty array of change notices. |
| 5411 */ | 5450 */ |
| 5412 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); | 5451 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); |
| 5413 | 5452 |
| 5414 /** | 5453 /** |
| 5415 * Initialize a newly created notice associated with the given source. | 5454 * Initialize a newly created notice associated with the given source. |
| 5416 * | 5455 * |
| 5417 * @param source the source for which the change is being reported | 5456 * @param source the source for which the change is being reported |
| 5418 */ | 5457 */ |
| 5419 ChangeNoticeImpl(this.source); | 5458 ChangeNoticeImpl(this.source); |
| 5420 | 5459 |
| 5421 /** | |
| 5422 * Return the errors that changed as a result of the analysis, or `null` if er
rors were not | |
| 5423 * changed. | |
| 5424 * | |
| 5425 * @return the errors that changed as a result of the analysis | |
| 5426 */ | |
| 5427 List<AnalysisError> get errors => _errors; | 5460 List<AnalysisError> get errors => _errors; |
| 5428 | 5461 |
| 5429 /** | |
| 5430 * Return the line information associated with the source, or `null` if errors
were not | |
| 5431 * changed. | |
| 5432 * | |
| 5433 * @return the line information associated with the source | |
| 5434 */ | |
| 5435 LineInfo get lineInfo => _lineInfo; | 5462 LineInfo get lineInfo => _lineInfo; |
| 5436 | 5463 |
| 5437 /** | 5464 /** |
| 5438 * Set the errors that changed as a result of the analysis to the given errors
and set the line | 5465 * Set the errors that changed as a result of the analysis to the given errors
and set the line |
| 5439 * information to the given line information. | 5466 * information to the given line information. |
| 5440 * | 5467 * |
| 5441 * @param errors the errors that changed as a result of the analysis | 5468 * @param errors the errors that changed as a result of the analysis |
| 5442 * @param lineInfo the line information associated with the source | 5469 * @param lineInfo the line information associated with the source |
| 5443 */ | 5470 */ |
| 5444 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { | 5471 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6270 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { | 6297 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 6271 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedCompilationUnit"); | 6298 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedCompilationUnit"); |
| 6272 try { | 6299 try { |
| 6273 instrumentation.metric3("contextId", _contextId); | 6300 instrumentation.metric3("contextId", _contextId); |
| 6274 return _basis.getResolvedCompilationUnit2(unitSource, librarySource); | 6301 return _basis.getResolvedCompilationUnit2(unitSource, librarySource); |
| 6275 } finally { | 6302 } finally { |
| 6276 instrumentation.log2(2); | 6303 instrumentation.log2(2); |
| 6277 } | 6304 } |
| 6278 } | 6305 } |
| 6279 | 6306 |
| 6307 HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 6308 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedHtmlUnit"); |
| 6309 try { |
| 6310 instrumentation.metric3("contextId", _contextId); |
| 6311 return _basis.getResolvedHtmlUnit(htmlSource); |
| 6312 } finally { |
| 6313 instrumentation.log2(2); |
| 6314 } |
| 6315 } |
| 6316 |
| 6280 SourceFactory get sourceFactory { | 6317 SourceFactory get sourceFactory { |
| 6281 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getSourceFactory"); | 6318 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getSourceFactory"); |
| 6282 try { | 6319 try { |
| 6283 instrumentation.metric3("contextId", _contextId); | 6320 instrumentation.metric3("contextId", _contextId); |
| 6284 return _basis.sourceFactory; | 6321 return _basis.sourceFactory; |
| 6285 } finally { | 6322 } finally { |
| 6286 instrumentation.log2(2); | 6323 instrumentation.log2(2); |
| 6287 } | 6324 } |
| 6288 } | 6325 } |
| 6289 | 6326 |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7411 return "parse as dart null source"; | 7448 return "parse as dart null source"; |
| 7412 } | 7449 } |
| 7413 return "parse as dart ${source.fullName}"; | 7450 return "parse as dart ${source.fullName}"; |
| 7414 } | 7451 } |
| 7415 | 7452 |
| 7416 void internalPerform() { | 7453 void internalPerform() { |
| 7417 RecordingErrorListener errorListener = new RecordingErrorListener(); | 7454 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 7418 List<Token> token = [null]; | 7455 List<Token> token = [null]; |
| 7419 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 7456 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 7420 try { | 7457 try { |
| 7421 Source_ContentReceiver receiver = new Source_ContentReceiver_11(this, erro
rListener, token); | 7458 Source_ContentReceiver receiver = new Source_ContentReceiver_12(this, erro
rListener, token); |
| 7422 try { | 7459 try { |
| 7423 source.getContents(receiver); | 7460 source.getContents(receiver); |
| 7424 } on JavaException catch (exception) { | 7461 } on JavaException catch (exception) { |
| 7425 _modificationTime = source.modificationStamp; | 7462 _modificationTime = source.modificationStamp; |
| 7426 throw new AnalysisException.con3(exception); | 7463 throw new AnalysisException.con3(exception); |
| 7427 } | 7464 } |
| 7428 } finally { | 7465 } finally { |
| 7429 timeCounterScan.stop(); | 7466 timeCounterScan.stop(); |
| 7430 } | 7467 } |
| 7468 if (token[0] == null) { |
| 7469 throw new AnalysisException.con1("Could not get contents for '${source.ful
lName}'"); |
| 7470 } |
| 7431 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 7471 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 7432 try { | 7472 try { |
| 7433 Parser parser = new Parser(source, errorListener); | 7473 Parser parser = new Parser(source, errorListener); |
| 7434 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; | 7474 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; |
| 7435 _unit = parser.parseCompilationUnit(token[0]); | 7475 _unit = parser.parseCompilationUnit(token[0]); |
| 7436 _errors = errorListener.getErrors2(source); | 7476 _errors = errorListener.getErrors2(source); |
| 7437 for (Directive directive in _unit.directives) { | 7477 for (Directive directive in _unit.directives) { |
| 7438 if (directive is ExportDirective) { | 7478 if (directive is ExportDirective) { |
| 7439 Source exportSource = resolveSource(source, directive as ExportDirecti
ve); | 7479 Source exportSource = resolveSource(source, directive as ExportDirecti
ve); |
| 7440 if (exportSource != null) { | 7480 if (exportSource != null) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7496 */ | 7536 */ |
| 7497 List<Source> toArray(Set<Source> sources) { | 7537 List<Source> toArray(Set<Source> sources) { |
| 7498 int size = sources.length; | 7538 int size = sources.length; |
| 7499 if (size == 0) { | 7539 if (size == 0) { |
| 7500 return Source.EMPTY_ARRAY; | 7540 return Source.EMPTY_ARRAY; |
| 7501 } | 7541 } |
| 7502 return new List.from(sources); | 7542 return new List.from(sources); |
| 7503 } | 7543 } |
| 7504 } | 7544 } |
| 7505 | 7545 |
| 7506 class Source_ContentReceiver_11 implements Source_ContentReceiver { | 7546 class Source_ContentReceiver_12 implements Source_ContentReceiver { |
| 7507 final ParseDartTask ParseDartTask_this; | 7547 final ParseDartTask ParseDartTask_this; |
| 7508 | 7548 |
| 7509 RecordingErrorListener errorListener; | 7549 RecordingErrorListener errorListener; |
| 7510 | 7550 |
| 7511 List<Token> token; | 7551 List<Token> token; |
| 7512 | 7552 |
| 7513 Source_ContentReceiver_11(this.ParseDartTask_this, this.errorListener, this.to
ken); | 7553 Source_ContentReceiver_12(this.ParseDartTask_this, this.errorListener, this.to
ken); |
| 7514 | 7554 |
| 7515 void accept(CharBuffer contents, int modificationTime) { | 7555 void accept(CharBuffer contents, int modificationTime) { |
| 7516 doScan(contents, modificationTime); | 7556 doScan(contents, modificationTime); |
| 7517 } | 7557 } |
| 7518 | 7558 |
| 7519 void accept2(String contents, int modificationTime) { | 7559 void accept2(String contents, int modificationTime) { |
| 7520 doScan(new CharSequence(contents), modificationTime); | 7560 doScan(new CharSequence(contents), modificationTime); |
| 7521 } | 7561 } |
| 7522 | 7562 |
| 7523 void doScan(CharSequence contents, int modificationTime) { | 7563 void doScan(CharSequence contents, int modificationTime) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7656 _referencedLibraries = librarySources; | 7696 _referencedLibraries = librarySources; |
| 7657 } | 7697 } |
| 7658 | 7698 |
| 7659 /** | 7699 /** |
| 7660 * Return the sources of libraries that are referenced in the specified HTML f
ile. | 7700 * Return the sources of libraries that are referenced in the specified HTML f
ile. |
| 7661 * | 7701 * |
| 7662 * @return the sources of libraries that are referenced in the HTML file | 7702 * @return the sources of libraries that are referenced in the HTML file |
| 7663 */ | 7703 */ |
| 7664 List<Source> get librarySources { | 7704 List<Source> get librarySources { |
| 7665 List<Source> libraries = new List<Source>(); | 7705 List<Source> libraries = new List<Source>(); |
| 7666 _unit.accept(new RecursiveXmlVisitor_12(this, libraries)); | 7706 _unit.accept(new RecursiveXmlVisitor_13(this, libraries)); |
| 7667 if (libraries.isEmpty) { | 7707 if (libraries.isEmpty) { |
| 7668 return Source.EMPTY_ARRAY; | 7708 return Source.EMPTY_ARRAY; |
| 7669 } | 7709 } |
| 7670 return new List.from(libraries); | 7710 return new List.from(libraries); |
| 7671 } | 7711 } |
| 7672 } | 7712 } |
| 7673 | 7713 |
| 7674 class RecursiveXmlVisitor_12 extends RecursiveXmlVisitor<Object> { | 7714 class RecursiveXmlVisitor_13 extends RecursiveXmlVisitor<Object> { |
| 7675 final ParseHtmlTask ParseHtmlTask_this; | 7715 final ParseHtmlTask ParseHtmlTask_this; |
| 7676 | 7716 |
| 7677 List<Source> libraries; | 7717 List<Source> libraries; |
| 7678 | 7718 |
| 7679 RecursiveXmlVisitor_12(this.ParseHtmlTask_this, this.libraries) : super(); | 7719 RecursiveXmlVisitor_13(this.ParseHtmlTask_this, this.libraries) : super(); |
| 7680 | 7720 |
| 7681 Object visitHtmlScriptTagNode(HtmlScriptTagNode node) { | 7721 Object visitHtmlScriptTagNode(HtmlScriptTagNode node) { |
| 7682 XmlAttributeNode scriptAttribute = null; | 7722 XmlAttributeNode scriptAttribute = null; |
| 7683 for (XmlAttributeNode attribute in node.attributes) { | 7723 for (XmlAttributeNode attribute in node.attributes) { |
| 7684 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATTRI
BUTE_SRC)) { | 7724 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATTRI
BUTE_SRC)) { |
| 7685 scriptAttribute = attribute; | 7725 scriptAttribute = attribute; |
| 7686 } | 7726 } |
| 7687 } | 7727 } |
| 7688 if (scriptAttribute != null) { | 7728 if (scriptAttribute != null) { |
| 7689 try { | 7729 try { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7882 * The source to be resolved. | 7922 * The source to be resolved. |
| 7883 */ | 7923 */ |
| 7884 final Source source; | 7924 final Source source; |
| 7885 | 7925 |
| 7886 /** | 7926 /** |
| 7887 * The time at which the contents of the source were last modified. | 7927 * The time at which the contents of the source were last modified. |
| 7888 */ | 7928 */ |
| 7889 int _modificationTime = -1; | 7929 int _modificationTime = -1; |
| 7890 | 7930 |
| 7891 /** | 7931 /** |
| 7932 * The [HtmlUnit] that was resolved by this task. |
| 7933 */ |
| 7934 HtmlUnit _resolvedUnit; |
| 7935 |
| 7936 /** |
| 7892 * The element produced by resolving the source. | 7937 * The element produced by resolving the source. |
| 7893 */ | 7938 */ |
| 7894 HtmlElement _element = null; | 7939 HtmlElement _element = null; |
| 7895 | 7940 |
| 7896 /** | 7941 /** |
| 7897 * The resolution errors that were discovered while resolving the source. | 7942 * The resolution errors that were discovered while resolving the source. |
| 7898 */ | 7943 */ |
| 7899 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 7944 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 7900 | 7945 |
| 7901 /** | 7946 /** |
| (...skipping 11 matching lines...) Expand all Loading... |
| 7913 /** | 7958 /** |
| 7914 * Return the time at which the contents of the source that was parsed were la
st modified, or a | 7959 * Return the time at which the contents of the source that was parsed were la
st modified, or a |
| 7915 * negative value if the task has not yet been performed or if an exception oc
curred. | 7960 * negative value if the task has not yet been performed or if an exception oc
curred. |
| 7916 * | 7961 * |
| 7917 * @return the time at which the contents of the source that was parsed were l
ast modified | 7962 * @return the time at which the contents of the source that was parsed were l
ast modified |
| 7918 */ | 7963 */ |
| 7919 int get modificationTime => _modificationTime; | 7964 int get modificationTime => _modificationTime; |
| 7920 | 7965 |
| 7921 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 7966 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 7922 | 7967 |
| 7968 /** |
| 7969 * Return the [HtmlUnit] that was resolved by this task. |
| 7970 * |
| 7971 * @return the [HtmlUnit] that was resolved by this task |
| 7972 */ |
| 7973 HtmlUnit get resolvedUnit => _resolvedUnit; |
| 7974 |
| 7923 String get taskDescription { | 7975 String get taskDescription { |
| 7924 if (source == null) { | 7976 if (source == null) { |
| 7925 return "resolve as html null source"; | 7977 return "resolve as html null source"; |
| 7926 } | 7978 } |
| 7927 return "resolve as html ${source.fullName}"; | 7979 return "resolve as html ${source.fullName}"; |
| 7928 } | 7980 } |
| 7929 | 7981 |
| 7930 void internalPerform() { | 7982 void internalPerform() { |
| 7931 ResolvableHtmlUnit resolvableHtmlUnit = context.computeResolvableHtmlUnit(so
urce); | 7983 ResolvableHtmlUnit resolvableHtmlUnit = context.computeResolvableHtmlUnit(so
urce); |
| 7932 HtmlUnit unit = resolvableHtmlUnit.compilationUnit; | 7984 HtmlUnit unit = resolvableHtmlUnit.compilationUnit; |
| 7933 if (unit == null) { | 7985 if (unit == null) { |
| 7934 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni
t returned a value without a parsed HTML unit"); | 7986 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni
t returned a value without a parsed HTML unit"); |
| 7935 } | 7987 } |
| 7936 _modificationTime = resolvableHtmlUnit.modificationTime; | 7988 _modificationTime = resolvableHtmlUnit.modificationTime; |
| 7937 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); | 7989 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); |
| 7938 _element = builder.buildHtmlElement2(source, _modificationTime, unit); | 7990 _element = builder.buildHtmlElement2(source, _modificationTime, unit); |
| 7991 LineInfo lineInfo = context.getLineInfo(source); |
| 7992 // new AngularHtmlUnitResolver(context, builder.errorListener, source, lineIn
fo).resolve(unit); |
| 7939 _resolutionErrors = builder.errorListener.getErrors2(source); | 7993 _resolutionErrors = builder.errorListener.getErrors2(source); |
| 7994 _resolvedUnit = unit; |
| 7940 } | 7995 } |
| 7941 } | 7996 } |
| 7942 | 7997 |
| 7943 /** | 7998 /** |
| 7944 * The interface `Logger` defines the behavior of objects that can be used to re
ceive | 7999 * The interface `Logger` defines the behavior of objects that can be used to re
ceive |
| 7945 * information about errors within the analysis engine. Implementations usually
write this | 8000 * information about errors within the analysis engine. Implementations usually
write this |
| 7946 * information to a file, but can also record the information for later use (suc
h as during testing) | 8001 * information to a file, but can also record the information for later use (suc
h as during testing) |
| 7947 * or even ignore the information. | 8002 * or even ignore the information. |
| 7948 * | 8003 * |
| 7949 * @coverage dart.engine.utilities | 8004 * @coverage dart.engine.utilities |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8002 | 8057 |
| 8003 void logError3(Exception exception) { | 8058 void logError3(Exception exception) { |
| 8004 } | 8059 } |
| 8005 | 8060 |
| 8006 void logInformation(String message) { | 8061 void logInformation(String message) { |
| 8007 } | 8062 } |
| 8008 | 8063 |
| 8009 void logInformation2(String message, Exception exception) { | 8064 void logInformation2(String message, Exception exception) { |
| 8010 } | 8065 } |
| 8011 } | 8066 } |
| OLD | NEW |