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

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

Issue 677303002: Remove unnecessary List creation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 ListUtilities.addAll(errors, _getDartHintData(source, librarySourc e, dartEntry, DartEntry.HINTS)); 1153 ListUtilities.addAll(errors, _getDartHintData(source, librarySourc e, dartEntry, DartEntry.HINTS));
1154 } 1154 }
1155 } 1155 }
1156 } 1156 }
1157 } on ObsoleteSourceAnalysisException catch (exception) { 1157 } on ObsoleteSourceAnalysisException catch (exception) {
1158 AnalysisEngine.instance.logger.logInformation2("Could not compute errors ", exception); 1158 AnalysisEngine.instance.logger.logInformation2("Could not compute errors ", exception);
1159 } 1159 }
1160 if (errors.isEmpty) { 1160 if (errors.isEmpty) {
1161 return AnalysisError.NO_ERRORS; 1161 return AnalysisError.NO_ERRORS;
1162 } 1162 }
1163 return new List.from(errors); 1163 return errors;
1164 } else if (sourceEntry is HtmlEntry) { 1164 } else if (sourceEntry is HtmlEntry) {
1165 HtmlEntry htmlEntry = sourceEntry; 1165 HtmlEntry htmlEntry = sourceEntry;
1166 try { 1166 try {
1167 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E RRORS); 1167 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E RRORS);
1168 } on ObsoleteSourceAnalysisException catch (exception) { 1168 } on ObsoleteSourceAnalysisException catch (exception) {
1169 AnalysisEngine.instance.logger.logInformation2("Could not compute errors ", exception); 1169 AnalysisEngine.instance.logger.logInformation2("Could not compute errors ", exception);
1170 } 1170 }
1171 } 1171 }
1172 return AnalysisError.NO_ERRORS; 1172 return AnalysisError.NO_ERRORS;
1173 } 1173 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 htmlSources.add(iterator.key); 1375 htmlSources.add(iterator.key);
1376 } 1376 }
1377 } 1377 }
1378 } 1378 }
1379 } 1379 }
1380 break; 1380 break;
1381 } 1381 }
1382 if (htmlSources.isEmpty) { 1382 if (htmlSources.isEmpty) {
1383 return Source.EMPTY_ARRAY; 1383 return Source.EMPTY_ARRAY;
1384 } 1384 }
1385 return new List.from(htmlSources); 1385 return htmlSources;
1386 } 1386 }
1387 1387
1388 @override 1388 @override
1389 List<Source> get htmlSources => _getSources(SourceKind.HTML); 1389 List<Source> get htmlSources => _getSources(SourceKind.HTML);
1390 1390
1391 @override 1391 @override
1392 SourceKind getKindOf(Source source) { 1392 SourceKind getKindOf(Source source) {
1393 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); 1393 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source);
1394 if (sourceEntry == null) { 1394 if (sourceEntry == null) {
1395 return SourceKind.UNKNOWN; 1395 return SourceKind.UNKNOWN;
(...skipping 10 matching lines...) Expand all
1406 while (iterator.moveNext()) { 1406 while (iterator.moveNext()) {
1407 Source source = iterator.key; 1407 Source source = iterator.key;
1408 SourceEntry sourceEntry = iterator.value; 1408 SourceEntry sourceEntry = iterator.value;
1409 if (sourceEntry.kind == SourceKind.LIBRARY && !source.isInSystemLibrary) { 1409 if (sourceEntry.kind == SourceKind.LIBRARY && !source.isInSystemLibrary) {
1410 // DartEntry dartEntry = (DartEntry) sourceEntry; 1410 // DartEntry dartEntry = (DartEntry) sourceEntry;
1411 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && dartEntry .getValue(DartEntry.IS_CLIENT)) { 1411 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && dartEntry .getValue(DartEntry.IS_CLIENT)) {
1412 sources.add(source); 1412 sources.add(source);
1413 // } 1413 // }
1414 } 1414 }
1415 } 1415 }
1416 return new List.from(sources); 1416 return sources;
1417 } 1417 }
1418 1418
1419 @override 1419 @override
1420 List<Source> get launchableServerLibrarySources { 1420 List<Source> get launchableServerLibrarySources {
1421 // TODO(brianwilkerson) This needs to filter out libraries that reference da rt:html, either 1421 // TODO(brianwilkerson) This needs to filter out libraries that reference da rt:html, either
1422 // directly or indirectly. 1422 // directly or indirectly.
1423 List<Source> sources = new List<Source>(); 1423 List<Source> sources = new List<Source>();
1424 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); 1424 MapIterator<Source, SourceEntry> iterator = _cache.iterator();
1425 while (iterator.moveNext()) { 1425 while (iterator.moveNext()) {
1426 Source source = iterator.key; 1426 Source source = iterator.key;
1427 SourceEntry sourceEntry = iterator.value; 1427 SourceEntry sourceEntry = iterator.value;
1428 if (sourceEntry.kind == SourceKind.LIBRARY && !source.isInSystemLibrary) { 1428 if (sourceEntry.kind == SourceKind.LIBRARY && !source.isInSystemLibrary) {
1429 // DartEntry dartEntry = (DartEntry) sourceEntry; 1429 // DartEntry dartEntry = (DartEntry) sourceEntry;
1430 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && !dartEntr y.getValue(DartEntry.IS_CLIENT)) { 1430 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && !dartEntr y.getValue(DartEntry.IS_CLIENT)) {
1431 sources.add(source); 1431 sources.add(source);
1432 // } 1432 // }
1433 } 1433 }
1434 } 1434 }
1435 return new List.from(sources); 1435 return sources;
1436 } 1436 }
1437 1437
1438 @override 1438 @override
1439 List<Source> getLibrariesContaining(Source source) { 1439 List<Source> getLibrariesContaining(Source source) {
1440 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); 1440 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source);
1441 if (sourceEntry is DartEntry) { 1441 if (sourceEntry is DartEntry) {
1442 return sourceEntry.containingLibraries; 1442 return sourceEntry.containingLibraries;
1443 } 1443 }
1444 return Source.EMPTY_ARRAY; 1444 return Source.EMPTY_ARRAY;
1445 } 1445 }
1446 1446
1447 @override 1447 @override
1448 List<Source> getLibrariesDependingOn(Source librarySource) { 1448 List<Source> getLibrariesDependingOn(Source librarySource) {
1449 List<Source> dependentLibraries = new List<Source>(); 1449 List<Source> dependentLibraries = new List<Source>();
1450 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); 1450 MapIterator<Source, SourceEntry> iterator = _cache.iterator();
1451 while (iterator.moveNext()) { 1451 while (iterator.moveNext()) {
1452 SourceEntry sourceEntry = iterator.value; 1452 SourceEntry sourceEntry = iterator.value;
1453 if (sourceEntry.kind == SourceKind.LIBRARY) { 1453 if (sourceEntry.kind == SourceKind.LIBRARY) {
1454 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.EXPORTED_LIB RARIES), librarySource)) { 1454 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.EXPORTED_LIB RARIES), librarySource)) {
1455 dependentLibraries.add(iterator.key); 1455 dependentLibraries.add(iterator.key);
1456 } 1456 }
1457 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.IMPORTED_LIB RARIES), librarySource)) { 1457 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.IMPORTED_LIB RARIES), librarySource)) {
1458 dependentLibraries.add(iterator.key); 1458 dependentLibraries.add(iterator.key);
1459 } 1459 }
1460 } 1460 }
1461 } 1461 }
1462 if (dependentLibraries.isEmpty) { 1462 if (dependentLibraries.isEmpty) {
1463 return Source.EMPTY_ARRAY; 1463 return Source.EMPTY_ARRAY;
1464 } 1464 }
1465 return new List.from(dependentLibraries); 1465 return dependentLibraries;
1466 } 1466 }
1467 1467
1468 @override 1468 @override
1469 List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { 1469 List<Source> getLibrariesReferencedFromHtml(Source htmlSource) {
1470 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(htmlSource); 1470 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(htmlSource);
1471 if (sourceEntry is HtmlEntry) { 1471 if (sourceEntry is HtmlEntry) {
1472 HtmlEntry htmlEntry = sourceEntry; 1472 HtmlEntry htmlEntry = sourceEntry;
1473 return htmlEntry.getValue(HtmlEntry.REFERENCED_LIBRARIES); 1473 return htmlEntry.getValue(HtmlEntry.REFERENCED_LIBRARIES);
1474 } 1474 }
1475 return Source.EMPTY_ARRAY; 1475 return Source.EMPTY_ARRAY;
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 * @return all of the sources known to this context that have the given kind 3371 * @return all of the sources known to this context that have the given kind
3372 */ 3372 */
3373 List<Source> _getSources(SourceKind kind) { 3373 List<Source> _getSources(SourceKind kind) {
3374 List<Source> sources = new List<Source>(); 3374 List<Source> sources = new List<Source>();
3375 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); 3375 MapIterator<Source, SourceEntry> iterator = _cache.iterator();
3376 while (iterator.moveNext()) { 3376 while (iterator.moveNext()) {
3377 if (iterator.value.kind == kind) { 3377 if (iterator.value.kind == kind) {
3378 sources.add(iterator.key); 3378 sources.add(iterator.key);
3379 } 3379 }
3380 } 3380 }
3381 return new List.from(sources); 3381 return sources;
3382 } 3382 }
3383 3383
3384 /** 3384 /**
3385 * Look at the given source to see whether a task needs to be performed relate d to it. If so, add 3385 * Look at the given source to see whether a task needs to be performed relate d to it. If so, add
3386 * the source to the set of sources that need to be processed. This method dup licates, and must 3386 * the source to the set of sources that need to be processed. This method dup licates, and must
3387 * therefore be kept in sync with, 3387 * therefore be kept in sync with,
3388 * [getNextAnalysisTask]. This method is intended to 3388 * [getNextAnalysisTask]. This method is intended to
3389 * be used for testing purposes only. 3389 * be used for testing purposes only.
3390 * 3390 *
3391 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 3391 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4700 if (_taskData != null) { 4700 if (_taskData != null) {
4701 return; 4701 return;
4702 } 4702 }
4703 } 4703 }
4704 } 4704 }
4705 if (importedLibrary != null) { 4705 if (importedLibrary != null) {
4706 importedLibraries.add(importedLibrary); 4706 importedLibraries.add(importedLibrary);
4707 _dependencyGraph.addEdge(library, importedLibrary); 4707 _dependencyGraph.addEdge(library, importedLibrary);
4708 } 4708 }
4709 } 4709 }
4710 library.importedLibraries = new List.from(importedLibraries); 4710 library.importedLibraries = importedLibraries;
4711 } else { 4711 } else {
4712 library.explicitlyImportsCore = false; 4712 library.explicitlyImportsCore = false;
4713 ResolvableLibrary importedLibrary = _libraryMap[AnalysisContextImpl_this._ coreLibrarySource]; 4713 ResolvableLibrary importedLibrary = _libraryMap[AnalysisContextImpl_this._ coreLibrarySource];
4714 if (importedLibrary == null) { 4714 if (importedLibrary == null) {
4715 importedLibrary = _createLibraryOrNull(AnalysisContextImpl_this._coreLib rarySource); 4715 importedLibrary = _createLibraryOrNull(AnalysisContextImpl_this._coreLib rarySource);
4716 if (importedLibrary != null) { 4716 if (importedLibrary != null) {
4717 _computeLibraryDependencies(importedLibrary); 4717 _computeLibraryDependencies(importedLibrary);
4718 if (_taskData != null) { 4718 if (_taskData != null) {
4719 return; 4719 return;
4720 } 4720 }
(...skipping 17 matching lines...) Expand all
4738 if (_taskData != null) { 4738 if (_taskData != null) {
4739 return; 4739 return;
4740 } 4740 }
4741 } 4741 }
4742 } 4742 }
4743 if (exportedLibrary != null) { 4743 if (exportedLibrary != null) {
4744 exportedLibraries.add(exportedLibrary); 4744 exportedLibraries.add(exportedLibrary);
4745 _dependencyGraph.addEdge(library, exportedLibrary); 4745 _dependencyGraph.addEdge(library, exportedLibrary);
4746 } 4746 }
4747 } 4747 }
4748 library.exportedLibraries = new List.from(exportedLibraries); 4748 library.exportedLibraries = exportedLibraries;
4749 } 4749 }
4750 } 4750 }
4751 4751
4752 /** 4752 /**
4753 * Gather the resolvable AST structures for each of the compilation units in e ach of the 4753 * Gather the resolvable AST structures for each of the compilation units in e ach of the
4754 * libraries in the cycle. This is done in two phases: first we ensure that we have cached an 4754 * libraries in the cycle. This is done in two phases: first we ensure that we have cached an
4755 * AST structure for each compilation unit, then we gather them. We split the work this way 4755 * AST structure for each compilation unit, then we gather them. We split the work this way
4756 * because getting the AST structures can change the state of the cache in suc h a way that we 4756 * because getting the AST structures can change the state of the cache in suc h a way that we
4757 * would have more work to do if any compilation unit didn't have a resolvable AST structure. 4757 * would have more work to do if any compilation unit didn't have a resolvable AST structure.
4758 */ 4758 */
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
5094 5094
5095 HashSet<CaughtException> _exceptions = new HashSet<CaughtException>(); 5095 HashSet<CaughtException> _exceptions = new HashSet<CaughtException>();
5096 5096
5097 List<AnalysisContextStatistics_PartitionData> _partitionData; 5097 List<AnalysisContextStatistics_PartitionData> _partitionData;
5098 5098
5099 void addSource(Source source) { 5099 void addSource(Source source) {
5100 _sources.add(source); 5100 _sources.add(source);
5101 } 5101 }
5102 5102
5103 @override 5103 @override
5104 List<AnalysisContextStatistics_CacheRow> get cacheRows { 5104 List<AnalysisContextStatistics_CacheRow> get cacheRows
5105 Iterable<AnalysisContextStatistics_CacheRow> items = _dataMap.values; 5105 => new List.from(_dataMap.values);
scheglov 2014/10/26 04:52:42 Or just _dataMap.values.toList()
sra1 2014/10/26 06:31:39 It is often better to use .toList() since it carri
Brian Wilkerson 2014/10/26 15:15:46 Thanks! I was wondering whether there was a reason
5106 return new List.from(items);
5107 }
5108 5106
5109 @override 5107 @override
5110 List<CaughtException> get exceptions => new List.from(_exceptions); 5108 List<CaughtException> get exceptions => new List.from(_exceptions);
5111 5109
5112 @override 5110 @override
5113 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD ata; 5111 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD ata;
5114 5112
5115 @override 5113 @override
5116 List<Source> get sources => new List.from(_sources); 5114 List<Source> get sources => _sources;
5117 5115
5118 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { 5116 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) {
5119 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor)) ; 5117 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor)) ;
5120 } 5118 }
5121 5119
5122 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc riptor descriptor) { 5120 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc riptor descriptor) {
5123 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des criptor, librarySource)); 5121 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des criptor, librarySource));
5124 } 5122 }
5125 5123
5126 /** 5124 /**
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
6733 } else if (startIndex + AngularMoustacheXmlExpression.OPENING_DELIMITER_LE NGTH < endIndex) { 6731 } else if (startIndex + AngularMoustacheXmlExpression.OPENING_DELIMITER_LE NGTH < endIndex) {
6734 startIndex += AngularMoustacheXmlExpression.OPENING_DELIMITER_LENGTH; 6732 startIndex += AngularMoustacheXmlExpression.OPENING_DELIMITER_LENGTH;
6735 AngularExpression expression = _parseAngularExpression(lexeme, startInde x, endIndex, offset); 6733 AngularExpression expression = _parseAngularExpression(lexeme, startInde x, endIndex, offset);
6736 expressions.add(new AngularMoustacheXmlExpression(startIndex, endIndex, expression)); 6734 expressions.add(new AngularMoustacheXmlExpression(startIndex, endIndex, expression));
6737 } 6735 }
6738 startIndex = StringUtilities.indexOf2(lexeme, endIndex + AngularMoustacheX mlExpression.CLOSING_DELIMITER_LENGTH, AngularMoustacheXmlExpression.OPENING_DEL IMITER_CHAR, AngularMoustacheXmlExpression.OPENING_DELIMITER_CHAR); 6736 startIndex = StringUtilities.indexOf2(lexeme, endIndex + AngularMoustacheX mlExpression.CLOSING_DELIMITER_LENGTH, AngularMoustacheXmlExpression.OPENING_DEL IMITER_CHAR, AngularMoustacheXmlExpression.OPENING_DELIMITER_CHAR);
6739 } 6737 }
6740 } 6738 }
6741 6739
6742 void _parseEmbeddedExpressionsInAttribute(ht.XmlAttributeNode node) { 6740 void _parseEmbeddedExpressionsInAttribute(ht.XmlAttributeNode node) {
6743 List<AngularMoustacheXmlExpression> expressions = []; 6741 List<AngularMoustacheXmlExpression> expressions = <AngularMoustacheXmlExpres sion>[];
6744 _parseEmbeddedExpressions(expressions, node.valueToken); 6742 _parseEmbeddedExpressions(expressions, node.valueToken);
6745 if (!expressions.isEmpty) { 6743 if (!expressions.isEmpty) {
6746 node.expressions = new List.from(expressions); 6744 node.expressions = expressions;
6747 } 6745 }
6748 } 6746 }
6749 6747
6750 void _parseEmbeddedExpressionsInTag(ht.XmlTagNode node) { 6748 void _parseEmbeddedExpressionsInTag(ht.XmlTagNode node) {
6751 List<AngularMoustacheXmlExpression> expressions = []; 6749 List<AngularMoustacheXmlExpression> expressions = <AngularMoustacheXmlExpres sion>[];
6752 ht.Token token = node.attributeEnd; 6750 ht.Token token = node.attributeEnd;
6753 ht.Token endToken = node.endToken; 6751 ht.Token endToken = node.endToken;
6754 bool inChild = false; 6752 bool inChild = false;
6755 while (!identical(token, endToken)) { 6753 while (!identical(token, endToken)) {
6756 for (ht.XmlTagNode child in node.tagNodes) { 6754 for (ht.XmlTagNode child in node.tagNodes) {
6757 if (identical(token, child.beginToken)) { 6755 if (identical(token, child.beginToken)) {
6758 inChild = true; 6756 inChild = true;
6759 break; 6757 break;
6760 } 6758 }
6761 if (identical(token, child.endToken)) { 6759 if (identical(token, child.endToken)) {
6762 inChild = false; 6760 inChild = false;
6763 break; 6761 break;
6764 } 6762 }
6765 } 6763 }
6766 if (!inChild && token.type == ht.TokenType.TEXT) { 6764 if (!inChild && token.type == ht.TokenType.TEXT) {
6767 _parseEmbeddedExpressions(expressions, token); 6765 _parseEmbeddedExpressions(expressions, token);
6768 } 6766 }
6769 token = token.next; 6767 token = token.next;
6770 } 6768 }
6771 node.expressions = new List.from(expressions); 6769 node.expressions = expressions;
6772 } 6770 }
6773 6771
6774 void _recordDefinedVariable(LocalVariableElementImpl variable) { 6772 void _recordDefinedVariable(LocalVariableElementImpl variable) {
6775 _definedVariables.add(variable); 6773 _definedVariables.add(variable);
6776 _functionElement.localVariables = new List.from(_definedVariables); 6774 _functionElement.localVariables = new List.from(_definedVariables);
6777 } 6775 }
6778 6776
6779 /** 6777 /**
6780 * When we inject variable, we give access to the library of its type. 6778 * When we inject variable, we give access to the library of its type.
6781 */ 6779 */
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
6832 // define formatters 6830 // define formatters
6833 for (AngularElement angularElement in angularElements) { 6831 for (AngularElement angularElement in angularElements) {
6834 if (angularElement is AngularFormatterElement) { 6832 if (angularElement is AngularFormatterElement) {
6835 _defineTopVariable_forClassElement(angularElement); 6833 _defineTopVariable_forClassElement(angularElement);
6836 } 6834 }
6837 } 6835 }
6838 // run this HTML visitor 6836 // run this HTML visitor
6839 _unit.accept(this); 6837 _unit.accept(this);
6840 // simulate imports for injects 6838 // simulate imports for injects
6841 { 6839 {
6842 List<ImportElement> imports = []; 6840 List<ImportElement> imports = <ImportElement>[];
6843 for (LibraryElement injectedLibrary in _injectedLibraries) { 6841 for (LibraryElement injectedLibrary in _injectedLibraries) {
6844 ImportElementImpl importElement = new ImportElementImpl(-1); 6842 ImportElementImpl importElement = new ImportElementImpl(-1);
6845 importElement.importedLibrary = injectedLibrary; 6843 importElement.importedLibrary = injectedLibrary;
6846 imports.add(importElement); 6844 imports.add(importElement);
6847 } 6845 }
6848 _libraryElement.imports = new List.from(imports); 6846 _libraryElement.imports = imports;
6849 } 6847 }
6850 } 6848 }
6851 6849
6852 void _resolveXmlExpression(AngularXmlExpression angularXmlExpression) { 6850 void _resolveXmlExpression(AngularXmlExpression angularXmlExpression) {
6853 AngularExpression angularExpression = angularXmlExpression.expression; 6851 AngularExpression angularExpression = angularXmlExpression.expression;
6854 _resolveExpression(angularExpression); 6852 _resolveExpression(angularExpression);
6855 } 6853 }
6856 6854
6857 List<Token> _splitAtBar(Token token) { 6855 List<Token> _splitAtBar(Token token) {
6858 List<Token> tokens = []; 6856 List<Token> tokens = [];
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
7945 while (state != null) { 7943 while (state != null) {
7946 errors.addAll(state.getValue(RESOLUTION_ERRORS)); 7944 errors.addAll(state.getValue(RESOLUTION_ERRORS));
7947 errors.addAll(state.getValue(VERIFICATION_ERRORS)); 7945 errors.addAll(state.getValue(VERIFICATION_ERRORS));
7948 errors.addAll(state.getValue(HINTS)); 7946 errors.addAll(state.getValue(HINTS));
7949 state = state._nextState; 7947 state = state._nextState;
7950 } 7948 }
7951 errors.addAll(getValue(ANGULAR_ERRORS)); 7949 errors.addAll(getValue(ANGULAR_ERRORS));
7952 if (errors.length == 0) { 7950 if (errors.length == 0) {
7953 return AnalysisError.NO_ERRORS; 7951 return AnalysisError.NO_ERRORS;
7954 } 7952 }
7955 return new List.from(errors); 7953 return errors;
7956 } 7954 }
7957 7955
7958 /** 7956 /**
7959 * Return a valid parsed compilation unit, either an unresolved AST structure 7957 * Return a valid parsed compilation unit, either an unresolved AST structure
7960 * or the result of resolving the AST structure in the context of some library , 7958 * or the result of resolving the AST structure in the context of some library ,
7961 * or `null` if there is no parsed compilation unit available. 7959 * or `null` if there is no parsed compilation unit available.
7962 */ 7960 */
7963 CompilationUnit get anyParsedCompilationUnit { 7961 CompilationUnit get anyParsedCompilationUnit {
7964 if (getState(PARSED_UNIT) == CacheState.VALID) { 7962 if (getState(PARSED_UNIT) == CacheState.VALID) {
7965 return getValue(PARSED_UNIT); 7963 return getValue(PARSED_UNIT);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
8003 */ 8001 */
8004 List<Source> get librariesContaining { 8002 List<Source> get librariesContaining {
8005 ResolutionState state = _resolutionState; 8003 ResolutionState state = _resolutionState;
8006 List<Source> result = new List<Source>(); 8004 List<Source> result = new List<Source>();
8007 while (state != null) { 8005 while (state != null) {
8008 if (state._librarySource != null) { 8006 if (state._librarySource != null) {
8009 result.add(state._librarySource); 8007 result.add(state._librarySource);
8010 } 8008 }
8011 state = state._nextState; 8009 state = state._nextState;
8012 } 8010 }
8013 return new List.from(result); 8011 return result;
8014 } 8012 }
8015 8013
8016 /** 8014 /**
8017 * A compilation unit that has not been accessed by any other client and can 8015 * A compilation unit that has not been accessed by any other client and can
8018 * therefore safely be modified by the reconciler, or `null` if the source has 8016 * therefore safely be modified by the reconciler, or `null` if the source has
8019 * not been parsed. 8017 * not been parsed.
8020 */ 8018 */
8021 CompilationUnit get resolvableCompilationUnit { 8019 CompilationUnit get resolvableCompilationUnit {
8022 if (getState(PARSED_UNIT) == CacheState.VALID) { 8020 if (getState(PARSED_UNIT) == CacheState.VALID) {
8023 CompilationUnit unit = getValue(PARSED_UNIT); 8021 CompilationUnit unit = getValue(PARSED_UNIT);
(...skipping 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after
11329 nameOffset = textOffset + index - 1; 11327 nameOffset = textOffset + index - 1;
11330 } 11328 }
11331 nameBuilder.appendChar(c); 11329 nameBuilder.appendChar(c);
11332 } 11330 }
11333 if (nameOffset != -1) { 11331 if (nameOffset != -1) {
11334 nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuil der.toString())); 11332 nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuil der.toString()));
11335 nameBuilder = new JavaStringBuilder(); 11333 nameBuilder = new JavaStringBuilder();
11336 } 11334 }
11337 } 11335 }
11338 // create attributes for name tokens 11336 // create attributes for name tokens
11339 List<PolymerAttributeElement> attributes = []; 11337 List<PolymerAttributeElement> attributes = <PolymerAttributeElement>[];
11340 Set<String> definedNames = new Set(); 11338 Set<String> definedNames = new Set();
11341 ClassElement classElement = _dartElement.classElement; 11339 ClassElement classElement = _dartElement.classElement;
11342 for (PolymerHtmlUnitBuilder_NameToken nameToken in nameTokens) { 11340 for (PolymerHtmlUnitBuilder_NameToken nameToken in nameTokens) {
11343 int offset = nameToken._offset; 11341 int offset = nameToken._offset;
11344 // prepare name 11342 // prepare name
11345 String name = nameToken._value; 11343 String name = nameToken._value;
11346 if (!isValidAttributeName(name)) { 11344 if (!isValidAttributeName(name)) {
11347 _reportErrorForNameToken(nameToken, PolymerCode.INVALID_ATTRIBUTE_NAME, [name]); 11345 _reportErrorForNameToken(nameToken, PolymerCode.INVALID_ATTRIBUTE_NAME, [name]);
11348 continue; 11346 continue;
11349 } 11347 }
11350 if (!definedNames.add(name)) { 11348 if (!definedNames.add(name)) {
11351 _reportErrorForNameToken(nameToken, PolymerCode.DUPLICATE_ATTRIBUTE_DEFI NITION, [name]); 11349 _reportErrorForNameToken(nameToken, PolymerCode.DUPLICATE_ATTRIBUTE_DEFI NITION, [name]);
11352 continue; 11350 continue;
11353 } 11351 }
11354 // create attribute 11352 // create attribute
11355 PolymerAttributeElementImpl attribute = new PolymerAttributeElementImpl(na me, offset); 11353 PolymerAttributeElementImpl attribute = new PolymerAttributeElementImpl(na me, offset);
11356 attributes.add(attribute); 11354 attributes.add(attribute);
11357 // resolve field 11355 // resolve field
11358 FieldElement field = classElement.getField(name); 11356 FieldElement field = classElement.getField(name);
11359 if (field == null) { 11357 if (field == null) {
11360 _reportErrorForNameToken(nameToken, PolymerCode.UNDEFINED_ATTRIBUTE_FIEL D, [name, classElement.displayName]); 11358 _reportErrorForNameToken(nameToken, PolymerCode.UNDEFINED_ATTRIBUTE_FIEL D, [name, classElement.displayName]);
11361 continue; 11359 continue;
11362 } 11360 }
11363 if (!_isPublishedField(field)) { 11361 if (!_isPublishedField(field)) {
11364 _reportErrorForNameToken(nameToken, PolymerCode.ATTRIBUTE_FIELD_NOT_PUBL ISHED, [name, classElement.displayName]); 11362 _reportErrorForNameToken(nameToken, PolymerCode.ATTRIBUTE_FIELD_NOT_PUBL ISHED, [name, classElement.displayName]);
11365 } 11363 }
11366 attribute.field = field; 11364 attribute.field = field;
11367 } 11365 }
11368 _htmlElement.attributes = new List.from(attributes); 11366 _htmlElement.attributes = attributes;
11369 } 11367 }
11370 11368
11371 void _createTagHtmlElement(ht.XmlTagNode node) { 11369 void _createTagHtmlElement(ht.XmlTagNode node) {
11372 this._elementNode = node; 11370 this._elementNode = node;
11373 this._elementName = null; 11371 this._elementName = null;
11374 this._htmlElement = null; 11372 this._htmlElement = null;
11375 this._dartElement = null; 11373 this._dartElement = null;
11376 // prepare 'name' attribute 11374 // prepare 'name' attribute
11377 ht.XmlAttributeNode nameAttribute = node.getAttribute("name"); 11375 ht.XmlAttributeNode nameAttribute = node.getAttribute("name");
11378 if (nameAttribute == null) { 11376 if (nameAttribute == null) {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
11636 List<AnalysisError> get errors { 11634 List<AnalysisError> get errors {
11637 Iterable<MapEntry<Source, HashSet<AnalysisError>>> entrySet = getMapEntrySet (_errors); 11635 Iterable<MapEntry<Source, HashSet<AnalysisError>>> entrySet = getMapEntrySet (_errors);
11638 int numEntries = entrySet.length; 11636 int numEntries = entrySet.length;
11639 if (numEntries == 0) { 11637 if (numEntries == 0) {
11640 return AnalysisError.NO_ERRORS; 11638 return AnalysisError.NO_ERRORS;
11641 } 11639 }
11642 List<AnalysisError> resultList = new List<AnalysisError>(); 11640 List<AnalysisError> resultList = new List<AnalysisError>();
11643 for (MapEntry<Source, HashSet<AnalysisError>> entry in entrySet) { 11641 for (MapEntry<Source, HashSet<AnalysisError>> entry in entrySet) {
11644 resultList.addAll(entry.getValue()); 11642 resultList.addAll(entry.getValue());
11645 } 11643 }
11646 return new List.from(resultList); 11644 return resultList;
11647 } 11645 }
11648 11646
11649 /** 11647 /**
11650 * Answer the errors collected by the listener for some passed [Source]. 11648 * Answer the errors collected by the listener for some passed [Source].
11651 * 11649 *
11652 * @param source some [Source] for which the caller wants the set of [Analysis Error]s 11650 * @param source some [Source] for which the caller wants the set of [Analysis Error]s
11653 * collected by this listener 11651 * collected by this listener
11654 * @return the errors collected by the listener for the passed [Source] 11652 * @return the errors collected by the listener for the passed [Source]
11655 */ 11653 */
11656 List<AnalysisError> getErrorsForSource(Source source) { 11654 List<AnalysisError> getErrorsForSource(Source source) {
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
13479 _index++; 13477 _index++;
13480 if (_index >= _manager._workQueues[_queueIndex].length) { 13478 if (_index >= _manager._workQueues[_queueIndex].length) {
13481 _index = 0; 13479 _index = 0;
13482 _queueIndex++; 13480 _queueIndex++;
13483 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { 13481 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) {
13484 _queueIndex++; 13482 _queueIndex++;
13485 } 13483 }
13486 } 13484 }
13487 } 13485 }
13488 } 13486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698