| 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 return null; | 1100 return null; |
| 1101 } | 1101 } |
| 1102 NodeLocator locator = new NodeLocator.con1(element.nameOffset); | 1102 NodeLocator locator = new NodeLocator.con1(element.nameOffset); |
| 1103 AstNode nameNode = locator.searchWithin(unit); | 1103 AstNode nameNode = locator.searchWithin(unit); |
| 1104 while (nameNode != null) { | 1104 while (nameNode != null) { |
| 1105 if (nameNode is AnnotatedNode) { | 1105 if (nameNode is AnnotatedNode) { |
| 1106 Comment comment = (nameNode as AnnotatedNode).documentationComment; | 1106 Comment comment = (nameNode as AnnotatedNode).documentationComment; |
| 1107 if (comment == null) { | 1107 if (comment == null) { |
| 1108 return null; | 1108 return null; |
| 1109 } | 1109 } |
| 1110 JavaStringBuilder builder = new JavaStringBuilder(); | 1110 StringBuffer buffer = new StringBuffer(); |
| 1111 List<Token> tokens = comment.tokens; | 1111 List<Token> tokens = comment.tokens; |
| 1112 for (int i = 0; i < tokens.length; i++) { | 1112 for (int i = 0; i < tokens.length; i++) { |
| 1113 if (i > 0) { | 1113 if (i > 0) { |
| 1114 builder.append("\n"); | 1114 buffer.write("\n"); |
| 1115 } | 1115 } |
| 1116 builder.append(tokens[i].lexeme); | 1116 buffer.write(tokens[i].lexeme); |
| 1117 } | 1117 } |
| 1118 return builder.toString(); | 1118 return buffer.toString(); |
| 1119 } | 1119 } |
| 1120 nameNode = nameNode.parent; | 1120 nameNode = nameNode.parent; |
| 1121 } | 1121 } |
| 1122 return null; | 1122 return null; |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 @override | 1125 @override |
| 1126 List<AnalysisError> computeErrors(Source source) { | 1126 List<AnalysisError> computeErrors(Source source) { |
| 1127 bool enableHints = _options.hint; | 1127 bool enableHints = _options.hint; |
| 1128 SourceEntry sourceEntry = _getReadableSourceEntry(source); | 1128 SourceEntry sourceEntry = _getReadableSourceEntry(source); |
| (...skipping 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5300 * | 5300 * |
| 5301 * @param source the source | 5301 * @param source the source |
| 5302 * @param level the level at which the given source should be analyzed | 5302 * @param level the level at which the given source should be analyzed |
| 5303 */ | 5303 */ |
| 5304 void setAnalysisLevel(Source source, AnalysisLevel level) { | 5304 void setAnalysisLevel(Source source, AnalysisLevel level) { |
| 5305 _analysisMap[source] = level; | 5305 _analysisMap[source] = level; |
| 5306 } | 5306 } |
| 5307 | 5307 |
| 5308 @override | 5308 @override |
| 5309 String toString() { | 5309 String toString() { |
| 5310 JavaStringBuilder builder = new JavaStringBuilder(); | 5310 StringBuffer buffer = new StringBuffer(); |
| 5311 bool needsSeparator = _appendSources(builder, false, AnalysisLevel.ALL); | 5311 bool needsSeparator = _appendSources(buffer, false, AnalysisLevel.ALL); |
| 5312 needsSeparator = _appendSources(builder, needsSeparator, AnalysisLevel.RESOL
VED); | 5312 needsSeparator = _appendSources(buffer, needsSeparator, AnalysisLevel.RESOLV
ED); |
| 5313 _appendSources(builder, needsSeparator, AnalysisLevel.NONE); | 5313 _appendSources(buffer, needsSeparator, AnalysisLevel.NONE); |
| 5314 return builder.toString(); | 5314 return buffer.toString(); |
| 5315 } | 5315 } |
| 5316 | 5316 |
| 5317 /** | 5317 /** |
| 5318 * Append sources with the given analysis level, prefixed with a label and pos
sibly a separator. | 5318 * Appendto the given [builder] all sources with the given analysis [level], |
| 5319 * | 5319 * prefixed with a label and a separator if [needsSeparator] is `true`. |
| 5320 * @param builder the builder to which the sources are to be appended | |
| 5321 * @param needsSeparator `true` if a separator is needed before the label | |
| 5322 * @param level the analysis level of the sources to be appended | |
| 5323 * @return `true` if future lists of sources will need a separator | |
| 5324 */ | 5320 */ |
| 5325 bool _appendSources(JavaStringBuilder builder, bool needsSeparator, AnalysisLe
vel level) { | 5321 bool _appendSources(StringBuffer buffer, bool needsSeparator, AnalysisLevel le
vel) { |
| 5326 bool first = true; | 5322 bool first = true; |
| 5327 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(_analysisMap))
{ | 5323 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(_analysisMap))
{ |
| 5328 if (entry.getValue() == level) { | 5324 if (entry.getValue() == level) { |
| 5329 if (first) { | 5325 if (first) { |
| 5330 first = false; | 5326 first = false; |
| 5331 if (needsSeparator) { | 5327 if (needsSeparator) { |
| 5332 builder.append("; "); | 5328 buffer.write("; "); |
| 5333 } | 5329 } |
| 5334 builder.append(level); | 5330 buffer.write(level); |
| 5335 builder.append(" "); | 5331 buffer.write(" "); |
| 5336 } else { | 5332 } else { |
| 5337 builder.append(", "); | 5333 buffer.write(", "); |
| 5338 } | 5334 } |
| 5339 builder.append(entry.getKey().fullName); | 5335 buffer.write(entry.getKey().fullName); |
| 5340 } | 5336 } |
| 5341 } | 5337 } |
| 5342 return needsSeparator || !first; | 5338 return needsSeparator || !first; |
| 5343 } | 5339 } |
| 5344 } | 5340 } |
| 5345 | 5341 |
| 5346 /** | 5342 /** |
| 5347 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the | 5343 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the |
| 5348 * functionality provided by the analysis engine. | 5344 * functionality provided by the analysis engine. |
| 5349 */ | 5345 */ |
| (...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7574 * @param source the source that was removed | 7570 * @param source the source that was removed |
| 7575 */ | 7571 */ |
| 7576 void removedSource(Source source) { | 7572 void removedSource(Source source) { |
| 7577 if (source != null) { | 7573 if (source != null) { |
| 7578 removedSources.add(source); | 7574 removedSources.add(source); |
| 7579 } | 7575 } |
| 7580 } | 7576 } |
| 7581 | 7577 |
| 7582 @override | 7578 @override |
| 7583 String toString() { | 7579 String toString() { |
| 7584 JavaStringBuilder builder = new JavaStringBuilder(); | 7580 StringBuffer buffer = new StringBuffer(); |
| 7585 bool needsSeparator = _appendSources(builder, addedSources, false, "addedSou
rces"); | 7581 bool needsSeparator = _appendSources(buffer, addedSources, false, "addedSour
ces"); |
| 7586 needsSeparator = _appendSources(builder, changedSources, needsSeparator, "ch
angedSources"); | 7582 needsSeparator = _appendSources(buffer, changedSources, needsSeparator, "cha
ngedSources"); |
| 7587 needsSeparator = _appendSources2(builder, _changedContent, needsSeparator, "
changedContent"); | 7583 needsSeparator = _appendSources2(buffer, _changedContent, needsSeparator, "c
hangedContent"); |
| 7588 needsSeparator = _appendSources2(builder, changedRanges, needsSeparator, "ch
angedRanges"); | 7584 needsSeparator = _appendSources2(buffer, changedRanges, needsSeparator, "cha
ngedRanges"); |
| 7589 needsSeparator = _appendSources(builder, deletedSources, needsSeparator, "de
letedSources"); | 7585 needsSeparator = _appendSources(buffer, deletedSources, needsSeparator, "del
etedSources"); |
| 7590 needsSeparator = _appendSources(builder, removedSources, needsSeparator, "re
movedSources"); | 7586 needsSeparator = _appendSources(buffer, removedSources, needsSeparator, "rem
ovedSources"); |
| 7591 int count = removedContainers.length; | 7587 int count = removedContainers.length; |
| 7592 if (count > 0) { | 7588 if (count > 0) { |
| 7593 if (removedSources.isEmpty) { | 7589 if (removedSources.isEmpty) { |
| 7594 if (needsSeparator) { | 7590 if (needsSeparator) { |
| 7595 builder.append("; "); | 7591 buffer.write("; "); |
| 7596 } | 7592 } |
| 7597 builder.append("removed: from "); | 7593 buffer.write("removed: from "); |
| 7598 builder.append(count); | 7594 buffer.write(count); |
| 7599 builder.append(" containers"); | 7595 buffer.write(" containers"); |
| 7600 } else { | 7596 } else { |
| 7601 builder.append(", and more from "); | 7597 buffer.write(", and more from "); |
| 7602 builder.append(count); | 7598 buffer.write(count); |
| 7603 builder.append(" containers"); | 7599 buffer.write(" containers"); |
| 7604 } | 7600 } |
| 7605 } | 7601 } |
| 7606 return builder.toString(); | 7602 return buffer.toString(); |
| 7607 } | 7603 } |
| 7608 | 7604 |
| 7609 /** | 7605 /** |
| 7610 * Append the given sources to the given builder, prefixed with the given labe
l and possibly a | 7606 * Append the given sources to the given builder, prefixed with the given labe
l and possibly a |
| 7611 * separator. | 7607 * separator. |
| 7612 * | 7608 * |
| 7613 * @param builder the builder to which the sources are to be appended | 7609 * @param builder the builder to which the sources are to be appended |
| 7614 * @param sources the sources to be appended | 7610 * @param sources the sources to be appended |
| 7615 * @param needsSeparator `true` if a separator is needed before the label | 7611 * @param needsSeparator `true` if a separator is needed before the label |
| 7616 * @param label the label used to prefix the sources | 7612 * @param label the label used to prefix the sources |
| 7617 * @return `true` if future lists of sources will need a separator | 7613 * @return `true` if future lists of sources will need a separator |
| 7618 */ | 7614 */ |
| 7619 bool _appendSources(JavaStringBuilder builder, List<Source> sources, bool need
sSeparator, String label) { | 7615 bool _appendSources(StringBuffer buffer, List<Source> sources, bool needsSepar
ator, String label) { |
| 7620 if (sources.isEmpty) { | 7616 if (sources.isEmpty) { |
| 7621 return needsSeparator; | 7617 return needsSeparator; |
| 7622 } | 7618 } |
| 7623 if (needsSeparator) { | 7619 if (needsSeparator) { |
| 7624 builder.append("; "); | 7620 buffer.write("; "); |
| 7625 } | 7621 } |
| 7626 builder.append(label); | 7622 buffer.write(label); |
| 7627 String prefix = " "; | 7623 String prefix = " "; |
| 7628 for (Source source in sources) { | 7624 for (Source source in sources) { |
| 7629 builder.append(prefix); | 7625 buffer.write(prefix); |
| 7630 builder.append(source.fullName); | 7626 buffer.write(source.fullName); |
| 7631 prefix = ", "; | 7627 prefix = ", "; |
| 7632 } | 7628 } |
| 7633 return true; | 7629 return true; |
| 7634 } | 7630 } |
| 7635 | 7631 |
| 7636 /** | 7632 /** |
| 7637 * Append the given sources to the given builder, prefixed with the given labe
l and possibly a | 7633 * Append the given sources to the given builder, prefixed with the given labe
l and possibly a |
| 7638 * separator. | 7634 * separator. |
| 7639 * | 7635 * |
| 7640 * @param builder the builder to which the sources are to be appended | 7636 * @param builder the builder to which the sources are to be appended |
| 7641 * @param sources the sources to be appended | 7637 * @param sources the sources to be appended |
| 7642 * @param needsSeparator `true` if a separator is needed before the label | 7638 * @param needsSeparator `true` if a separator is needed before the label |
| 7643 * @param label the label used to prefix the sources | 7639 * @param label the label used to prefix the sources |
| 7644 * @return `true` if future lists of sources will need a separator | 7640 * @return `true` if future lists of sources will need a separator |
| 7645 */ | 7641 */ |
| 7646 bool _appendSources2(JavaStringBuilder builder, HashMap<Source, dynamic> sourc
es, bool needsSeparator, String label) { | 7642 bool _appendSources2(StringBuffer buffer, HashMap<Source, dynamic> sources, bo
ol needsSeparator, String label) { |
| 7647 if (sources.isEmpty) { | 7643 if (sources.isEmpty) { |
| 7648 return needsSeparator; | 7644 return needsSeparator; |
| 7649 } | 7645 } |
| 7650 if (needsSeparator) { | 7646 if (needsSeparator) { |
| 7651 builder.append("; "); | 7647 buffer.write("; "); |
| 7652 } | 7648 } |
| 7653 builder.append(label); | 7649 buffer.write(label); |
| 7654 String prefix = " "; | 7650 String prefix = " "; |
| 7655 for (Source source in sources.keys.toSet()) { | 7651 for (Source source in sources.keys.toSet()) { |
| 7656 builder.append(prefix); | 7652 buffer.write(prefix); |
| 7657 builder.append(source.fullName); | 7653 buffer.write(source.fullName); |
| 7658 prefix = ", "; | 7654 prefix = ", "; |
| 7659 } | 7655 } |
| 7660 return true; | 7656 return true; |
| 7661 } | 7657 } |
| 7662 } | 7658 } |
| 7663 | 7659 |
| 7664 /** | 7660 /** |
| 7665 * Instances of the class `ContentChange` represent a change to the content of a
source. | 7661 * Instances of the class `ContentChange` represent a change to the content of a
source. |
| 7666 */ | 7662 */ |
| 7667 class ChangeSet_ContentChange { | 7663 class ChangeSet_ContentChange { |
| (...skipping 3639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11307 if (attributesText.trim().isEmpty) { | 11303 if (attributesText.trim().isEmpty) { |
| 11308 _reportErrorForAttribute(attributesAttribute, PolymerCode.EMPTY_ATTRIBUTES
, []); | 11304 _reportErrorForAttribute(attributesAttribute, PolymerCode.EMPTY_ATTRIBUTES
, []); |
| 11309 return; | 11305 return; |
| 11310 } | 11306 } |
| 11311 // prepare attribute name tokens | 11307 // prepare attribute name tokens |
| 11312 List<PolymerHtmlUnitBuilder_NameToken> nameTokens = []; | 11308 List<PolymerHtmlUnitBuilder_NameToken> nameTokens = []; |
| 11313 { | 11309 { |
| 11314 int index = 0; | 11310 int index = 0; |
| 11315 int textOffset = attributesAttribute.textOffset; | 11311 int textOffset = attributesAttribute.textOffset; |
| 11316 int nameOffset = -1; | 11312 int nameOffset = -1; |
| 11317 JavaStringBuilder nameBuilder = new JavaStringBuilder(); | 11313 StringBuffer nameBuffer = new StringBuffer(); |
| 11318 while (index < attributesText.length) { | 11314 while (index < attributesText.length) { |
| 11319 int c = attributesText.codeUnitAt(index++); | 11315 int c = attributesText.codeUnitAt(index++); |
| 11320 if (Character.isWhitespace(c)) { | 11316 if (Character.isWhitespace(c)) { |
| 11321 if (nameOffset != -1) { | 11317 if (nameOffset != -1) { |
| 11322 nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, name
Builder.toString())); | 11318 nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, name
Buffer.toString())); |
| 11323 nameBuilder = new JavaStringBuilder(); | 11319 nameBuffer = new StringBuffer(); |
| 11324 nameOffset = -1; | 11320 nameOffset = -1; |
| 11325 } | 11321 } |
| 11326 continue; | 11322 continue; |
| 11327 } | 11323 } |
| 11328 if (nameOffset == -1) { | 11324 if (nameOffset == -1) { |
| 11329 nameOffset = textOffset + index - 1; | 11325 nameOffset = textOffset + index - 1; |
| 11330 } | 11326 } |
| 11331 nameBuilder.appendChar(c); | 11327 nameBuffer.writeCharCode(c); |
| 11332 } | 11328 } |
| 11333 if (nameOffset != -1) { | 11329 if (nameOffset != -1) { |
| 11334 nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuil
der.toString())); | 11330 nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuff
er.toString())); |
| 11335 nameBuilder = new JavaStringBuilder(); | 11331 nameBuffer = new StringBuffer(); |
| 11336 } | 11332 } |
| 11337 } | 11333 } |
| 11338 // create attributes for name tokens | 11334 // create attributes for name tokens |
| 11339 List<PolymerAttributeElement> attributes = []; | 11335 List<PolymerAttributeElement> attributes = []; |
| 11340 Set<String> definedNames = new Set(); | 11336 Set<String> definedNames = new Set(); |
| 11341 ClassElement classElement = _dartElement.classElement; | 11337 ClassElement classElement = _dartElement.classElement; |
| 11342 for (PolymerHtmlUnitBuilder_NameToken nameToken in nameTokens) { | 11338 for (PolymerHtmlUnitBuilder_NameToken nameToken in nameTokens) { |
| 11343 int offset = nameToken._offset; | 11339 int offset = nameToken._offset; |
| 11344 // prepare name | 11340 // prepare name |
| 11345 String name = nameToken._value; | 11341 String name = nameToken._value; |
| (...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13392 */ | 13388 */ |
| 13393 void remove(Source source) { | 13389 void remove(Source source) { |
| 13394 int queueCount = _workQueues.length; | 13390 int queueCount = _workQueues.length; |
| 13395 for (int i = 0; i < queueCount; i++) { | 13391 for (int i = 0; i < queueCount; i++) { |
| 13396 _workQueues[i].remove(source); | 13392 _workQueues[i].remove(source); |
| 13397 } | 13393 } |
| 13398 } | 13394 } |
| 13399 | 13395 |
| 13400 @override | 13396 @override |
| 13401 String toString() { | 13397 String toString() { |
| 13402 JavaStringBuilder builder = new JavaStringBuilder(); | 13398 StringBuffer buffer = new StringBuffer(); |
| 13403 List<SourcePriority> priorities = SourcePriority.values; | 13399 List<SourcePriority> priorities = SourcePriority.values; |
| 13404 bool needsSeparator = false; | 13400 bool needsSeparator = false; |
| 13405 int queueCount = _workQueues.length; | 13401 int queueCount = _workQueues.length; |
| 13406 for (int i = 0; i < queueCount; i++) { | 13402 for (int i = 0; i < queueCount; i++) { |
| 13407 List<Source> queue = _workQueues[i]; | 13403 List<Source> queue = _workQueues[i]; |
| 13408 if (!queue.isEmpty) { | 13404 if (!queue.isEmpty) { |
| 13409 if (needsSeparator) { | 13405 if (needsSeparator) { |
| 13410 builder.append("; "); | 13406 buffer.write("; "); |
| 13411 } | 13407 } |
| 13412 builder.append(priorities[i]); | 13408 buffer.write(priorities[i]); |
| 13413 builder.append(": "); | 13409 buffer.write(": "); |
| 13414 int queueSize = queue.length; | 13410 int queueSize = queue.length; |
| 13415 for (int j = 0; j < queueSize; j++) { | 13411 for (int j = 0; j < queueSize; j++) { |
| 13416 if (j > 0) { | 13412 if (j > 0) { |
| 13417 builder.append(", "); | 13413 buffer.write(", "); |
| 13418 } | 13414 } |
| 13419 builder.append(queue[j].fullName); | 13415 buffer.write(queue[j].fullName); |
| 13420 } | 13416 } |
| 13421 needsSeparator = true; | 13417 needsSeparator = true; |
| 13422 } | 13418 } |
| 13423 } | 13419 } |
| 13424 return builder.toString(); | 13420 return buffer.toString(); |
| 13425 } | 13421 } |
| 13426 } | 13422 } |
| 13427 | 13423 |
| 13428 /** | 13424 /** |
| 13429 * Instances of the class `WorkIterator` implement an iterator that returns the
sources in a | 13425 * Instances of the class `WorkIterator` implement an iterator that returns the
sources in a |
| 13430 * work manager in the order in which they are to be analyzed. | 13426 * work manager in the order in which they are to be analyzed. |
| 13431 */ | 13427 */ |
| 13432 class WorkManager_WorkIterator { | 13428 class WorkManager_WorkIterator { |
| 13433 final WorkManager _manager; | 13429 final WorkManager _manager; |
| 13434 | 13430 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13479 _index++; | 13475 _index++; |
| 13480 if (_index >= _manager._workQueues[_queueIndex].length) { | 13476 if (_index >= _manager._workQueues[_queueIndex].length) { |
| 13481 _index = 0; | 13477 _index = 0; |
| 13482 _queueIndex++; | 13478 _queueIndex++; |
| 13483 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { | 13479 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { |
| 13484 _queueIndex++; | 13480 _queueIndex++; |
| 13485 } | 13481 } |
| 13486 } | 13482 } |
| 13487 } | 13483 } |
| 13488 } | 13484 } |
| OLD | NEW |