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 6579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6590 Expression mainExpression = _parseDartExpressionInToken(tokens[0]); | 6590 Expression mainExpression = _parseDartExpressionInToken(tokens[0]); |
6591 // parse formatters | 6591 // parse formatters |
6592 List<AngularFormatterNode> formatters = <AngularFormatterNode>[]; | 6592 List<AngularFormatterNode> formatters = <AngularFormatterNode>[]; |
6593 for (int i = 1; i < tokens.length; i++) { | 6593 for (int i = 1; i < tokens.length; i++) { |
6594 Token formatterToken = tokens[i]; | 6594 Token formatterToken = tokens[i]; |
6595 Token barToken = formatterToken; | 6595 Token barToken = formatterToken; |
6596 formatterToken = formatterToken.next; | 6596 formatterToken = formatterToken.next; |
6597 // parse name | 6597 // parse name |
6598 Expression nameExpression = _parseDartExpressionInToken(formatterToken); | 6598 Expression nameExpression = _parseDartExpressionInToken(formatterToken); |
6599 if (nameExpression is! SimpleIdentifier) { | 6599 if (nameExpression is! SimpleIdentifier) { |
6600 _reportErrorForNode(AngularCode.INVALID_FORMATTER_NAME, nameExpression,
[]); | 6600 _reportErrorForNode(AngularCode.INVALID_FORMATTER_NAME, nameExpression); |
6601 continue; | 6601 continue; |
6602 } | 6602 } |
6603 SimpleIdentifier name = nameExpression as SimpleIdentifier; | 6603 SimpleIdentifier name = nameExpression as SimpleIdentifier; |
6604 formatterToken = name.endToken.next; | 6604 formatterToken = name.endToken.next; |
6605 // parse arguments | 6605 // parse arguments |
6606 List<AngularFormatterArgument> arguments = <AngularFormatterArgument>[]; | 6606 List<AngularFormatterArgument> arguments = <AngularFormatterArgument>[]; |
6607 while (formatterToken.type != TokenType.EOF) { | 6607 while (formatterToken.type != TokenType.EOF) { |
6608 // skip ":" | 6608 // skip ":" |
6609 Token colonToken = formatterToken; | 6609 Token colonToken = formatterToken; |
6610 if (colonToken.type == TokenType.COLON) { | 6610 if (colonToken.type == TokenType.COLON) { |
6611 formatterToken = formatterToken.next; | 6611 formatterToken = formatterToken.next; |
6612 } else { | 6612 } else { |
6613 _reportErrorForToken(AngularCode.MISSING_FORMATTER_COLON, colonToken,
[]); | 6613 _reportErrorForToken(AngularCode.MISSING_FORMATTER_COLON, colonToken); |
6614 } | 6614 } |
6615 // parse argument | 6615 // parse argument |
6616 Expression argument = _parseDartExpressionInToken(formatterToken); | 6616 Expression argument = _parseDartExpressionInToken(formatterToken); |
6617 arguments.add(new AngularFormatterArgument(colonToken, argument)); | 6617 arguments.add(new AngularFormatterArgument(colonToken, argument)); |
6618 // next token | 6618 // next token |
6619 formatterToken = argument.endToken.next; | 6619 formatterToken = argument.endToken.next; |
6620 } | 6620 } |
6621 formatters.add(new AngularFormatterNode(barToken, name, arguments)); | 6621 formatters.add(new AngularFormatterNode(barToken, name, arguments)); |
6622 } | 6622 } |
6623 // done | 6623 // done |
(...skipping 17 matching lines...) Expand all Loading... |
6641 _nameScope = _resolver.popNameScope(); | 6641 _nameScope = _resolver.popNameScope(); |
6642 } | 6642 } |
6643 | 6643 |
6644 void _pushNameScope() { | 6644 void _pushNameScope() { |
6645 _nameScope = _resolver.pushNameScope(); | 6645 _nameScope = _resolver.pushNameScope(); |
6646 } | 6646 } |
6647 | 6647 |
6648 /** | 6648 /** |
6649 * Reports given [ErrorCode] at the given [AstNode]. | 6649 * Reports given [ErrorCode] at the given [AstNode]. |
6650 */ | 6650 */ |
6651 void _reportErrorForNode(ErrorCode errorCode, AstNode node, List<Object> argum
ents) { | 6651 void _reportErrorForNode(ErrorCode errorCode, AstNode node, [List<Object> argu
ments]) { |
6652 _reportErrorForOffset(errorCode, node.offset, node.length, arguments); | 6652 _reportErrorForOffset(errorCode, node.offset, node.length, arguments); |
6653 } | 6653 } |
6654 | 6654 |
6655 /** | 6655 /** |
6656 * Reports given [ErrorCode] at the given position. | 6656 * Reports given [ErrorCode] at the given position. |
6657 */ | 6657 */ |
6658 void _reportErrorForOffset(ErrorCode errorCode, int offset, int length, List<O
bject> arguments) { | 6658 void _reportErrorForOffset(ErrorCode errorCode, int offset, int length, [List<
Object> arguments]) { |
6659 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error
Code, arguments)); | 6659 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error
Code, arguments)); |
6660 } | 6660 } |
6661 | 6661 |
6662 /** | 6662 /** |
6663 * Reports given [ErrorCode] at the given [Token]. | 6663 * Reports given [ErrorCode] at the given [Token]. |
6664 */ | 6664 */ |
6665 void _reportErrorForToken(ErrorCode errorCode, Token token, List<Object> argum
ents) { | 6665 void _reportErrorForToken(ErrorCode errorCode, Token token, [List<Object> argu
ments]) { |
6666 _reportErrorForOffset(errorCode, token.offset, token.length, arguments); | 6666 _reportErrorForOffset(errorCode, token.offset, token.length, arguments); |
6667 } | 6667 } |
6668 | 6668 |
6669 void _resolveExpression(AngularExpression angularExpression) { | 6669 void _resolveExpression(AngularExpression angularExpression) { |
6670 List<Expression> dartExpressions = angularExpression.expressions; | 6670 List<Expression> dartExpressions = angularExpression.expressions; |
6671 for (Expression dartExpression in dartExpressions) { | 6671 for (Expression dartExpression in dartExpressions) { |
6672 _resolveNode(dartExpression); | 6672 _resolveNode(dartExpression); |
6673 } | 6673 } |
6674 } | 6674 } |
6675 | 6675 |
(...skipping 4070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10746 if (code == null) { | 10746 if (code == null) { |
10747 String encodedUriContent = Uri.encodeFull(uriContent); | 10747 String encodedUriContent = Uri.encodeFull(uriContent); |
10748 Source source = context.sourceFactory.resolveUri(librarySource, encodedUri
Content); | 10748 Source source = context.sourceFactory.resolveUri(librarySource, encodedUri
Content); |
10749 directive.source = source; | 10749 directive.source = source; |
10750 return source; | 10750 return source; |
10751 } | 10751 } |
10752 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { | 10752 if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { |
10753 return null; | 10753 return null; |
10754 } | 10754 } |
10755 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { | 10755 if (code == UriValidationCode.URI_WITH_INTERPOLATION) { |
10756 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); | 10756 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION)); |
10757 return null; | 10757 return null; |
10758 } | 10758 } |
10759 if (code == UriValidationCode.INVALID_URI) { | 10759 if (code == UriValidationCode.INVALID_URI) { |
10760 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); | 10760 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
10761 return null; | 10761 return null; |
10762 } | 10762 } |
10763 throw new RuntimeException(message: "Failed to handle validation code: $code
"); | 10763 throw new RuntimeException(message: "Failed to handle validation code: $code
"); |
10764 } | 10764 } |
10765 | 10765 |
10766 /** | 10766 /** |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11370 return; | 11370 return; |
11371 } | 11371 } |
11372 // check if there is a Dart part to resolve against it | 11372 // check if there is a Dart part to resolve against it |
11373 if (_dartElement == null) { | 11373 if (_dartElement == null) { |
11374 // TODO(scheglov) maybe report error (if it is allowed at all to have elem
ent without Dart part) | 11374 // TODO(scheglov) maybe report error (if it is allowed at all to have elem
ent without Dart part) |
11375 return; | 11375 return; |
11376 } | 11376 } |
11377 // prepare value of the "attributes" attribute | 11377 // prepare value of the "attributes" attribute |
11378 String attributesText = attributesAttribute.text; | 11378 String attributesText = attributesAttribute.text; |
11379 if (attributesText.trim().isEmpty) { | 11379 if (attributesText.trim().isEmpty) { |
11380 _reportErrorForAttribute(attributesAttribute, PolymerCode.EMPTY_ATTRIBUTES
, []); | 11380 _reportErrorForAttribute(attributesAttribute, PolymerCode.EMPTY_ATTRIBUTES
); |
11381 return; | 11381 return; |
11382 } | 11382 } |
11383 // prepare attribute name tokens | 11383 // prepare attribute name tokens |
11384 List<PolymerHtmlUnitBuilder_NameToken> nameTokens = <PolymerHtmlUnitBuilder_
NameToken>[]; | 11384 List<PolymerHtmlUnitBuilder_NameToken> nameTokens = <PolymerHtmlUnitBuilder_
NameToken>[]; |
11385 { | 11385 { |
11386 int index = 0; | 11386 int index = 0; |
11387 int textOffset = attributesAttribute.textOffset; | 11387 int textOffset = attributesAttribute.textOffset; |
11388 int nameOffset = -1; | 11388 int nameOffset = -1; |
11389 StringBuffer nameBuffer = new StringBuffer(); | 11389 StringBuffer nameBuffer = new StringBuffer(); |
11390 while (index < attributesText.length) { | 11390 while (index < attributesText.length) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11441 } | 11441 } |
11442 | 11442 |
11443 void _createTagHtmlElement(ht.XmlTagNode node) { | 11443 void _createTagHtmlElement(ht.XmlTagNode node) { |
11444 this._elementNode = node; | 11444 this._elementNode = node; |
11445 this._elementName = null; | 11445 this._elementName = null; |
11446 this._htmlElement = null; | 11446 this._htmlElement = null; |
11447 this._dartElement = null; | 11447 this._dartElement = null; |
11448 // prepare 'name' attribute | 11448 // prepare 'name' attribute |
11449 ht.XmlAttributeNode nameAttribute = node.getAttribute("name"); | 11449 ht.XmlAttributeNode nameAttribute = node.getAttribute("name"); |
11450 if (nameAttribute == null) { | 11450 if (nameAttribute == null) { |
11451 _reportErrorForToken(node.tagToken, PolymerCode.MISSING_TAG_NAME, []); | 11451 _reportErrorForToken(node.tagToken, PolymerCode.MISSING_TAG_NAME); |
11452 return; | 11452 return; |
11453 } | 11453 } |
11454 // prepare name | 11454 // prepare name |
11455 _elementName = nameAttribute.text; | 11455 _elementName = nameAttribute.text; |
11456 if (!isValidTagName(_elementName)) { | 11456 if (!isValidTagName(_elementName)) { |
11457 _reportErrorForAttributeValue(nameAttribute, PolymerCode.INVALID_TAG_NAME,
[_elementName]); | 11457 _reportErrorForAttributeValue(nameAttribute, PolymerCode.INVALID_TAG_NAME,
[_elementName]); |
11458 return; | 11458 return; |
11459 } | 11459 } |
11460 // TODO(scheglov) Maybe check that at least one of "template" or "script" ch
ildren. | 11460 // TODO(scheglov) Maybe check that at least one of "template" or "script" ch
ildren. |
11461 // TODO(scheglov) Maybe check if more than one top-level "template". | 11461 // TODO(scheglov) Maybe check if more than one top-level "template". |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11533 if (_isPublishedAnnotation(annotation)) { | 11533 if (_isPublishedAnnotation(annotation)) { |
11534 return true; | 11534 return true; |
11535 } | 11535 } |
11536 } | 11536 } |
11537 return false; | 11537 return false; |
11538 } | 11538 } |
11539 | 11539 |
11540 /** | 11540 /** |
11541 * Reports an error on the attribute's value, or (if absent) on the attribute'
s name. | 11541 * Reports an error on the attribute's value, or (if absent) on the attribute'
s name. |
11542 */ | 11542 */ |
11543 void _reportErrorForAttribute(ht.XmlAttributeNode node, ErrorCode errorCode, L
ist<Object> arguments) { | 11543 void _reportErrorForAttribute(ht.XmlAttributeNode node, ErrorCode errorCode, [
List<Object> arguments]) { |
11544 _reportErrorForOffset(node.offset, node.length, errorCode, arguments); | 11544 _reportErrorForOffset(node.offset, node.length, errorCode, arguments); |
11545 } | 11545 } |
11546 | 11546 |
11547 /** | 11547 /** |
11548 * Reports an error on the attribute's value, or (if absent) on the attribute'
s name. | 11548 * Reports an error on the attribute's value, or (if absent) on the attribute'
s name. |
11549 */ | 11549 */ |
11550 void _reportErrorForAttributeValue(ht.XmlAttributeNode node, ErrorCode errorCo
de, List<Object> arguments) { | 11550 void _reportErrorForAttributeValue(ht.XmlAttributeNode node, ErrorCode errorCo
de, [List<Object> arguments]) { |
11551 ht.Token valueToken = node.valueToken; | 11551 ht.Token valueToken = node.valueToken; |
11552 if (valueToken == null || valueToken.isSynthetic) { | 11552 if (valueToken == null || valueToken.isSynthetic) { |
11553 _reportErrorForAttribute(node, errorCode, arguments); | 11553 _reportErrorForAttribute(node, errorCode, arguments); |
11554 } else { | 11554 } else { |
11555 _reportErrorForToken(valueToken, errorCode, arguments); | 11555 _reportErrorForToken(valueToken, errorCode, arguments); |
11556 } | 11556 } |
11557 } | 11557 } |
11558 | 11558 |
11559 void _reportErrorForNameToken(PolymerHtmlUnitBuilder_NameToken token, ErrorCod
e errorCode, List<Object> arguments) { | 11559 void _reportErrorForNameToken(PolymerHtmlUnitBuilder_NameToken token, ErrorCod
e errorCode, [List<Object> arguments]) { |
11560 int offset = token._offset; | 11560 int offset = token._offset; |
11561 int length = token._value.length; | 11561 int length = token._value.length; |
11562 _reportErrorForOffset(offset, length, errorCode, arguments); | 11562 _reportErrorForOffset(offset, length, errorCode, arguments); |
11563 } | 11563 } |
11564 | 11564 |
11565 void _reportErrorForOffset(int offset, int length, ErrorCode errorCode, List<O
bject> arguments) { | 11565 void _reportErrorForOffset(int offset, int length, ErrorCode errorCode, [List<
Object> arguments]) { |
11566 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error
Code, arguments)); | 11566 _errorListener.onError(new AnalysisError.con2(_source, offset, length, error
Code, arguments)); |
11567 } | 11567 } |
11568 | 11568 |
11569 void _reportErrorForToken(ht.Token token, ErrorCode errorCode, List<Object> ar
guments) { | 11569 void _reportErrorForToken(ht.Token token, ErrorCode errorCode, [List<Object> a
rguments]) { |
11570 int offset = token.offset; | 11570 int offset = token.offset; |
11571 int length = token.length; | 11571 int length = token.length; |
11572 _reportErrorForOffset(offset, length, errorCode, arguments); | 11572 _reportErrorForOffset(offset, length, errorCode, arguments); |
11573 } | 11573 } |
11574 } | 11574 } |
11575 | 11575 |
11576 class PolymerHtmlUnitBuilder_FoundTagDartElementError extends Error { | 11576 class PolymerHtmlUnitBuilder_FoundTagDartElementError extends Error { |
11577 final PolymerTagDartElementImpl _result; | 11577 final PolymerTagDartElementImpl _result; |
11578 | 11578 |
11579 PolymerHtmlUnitBuilder_FoundTagDartElementError(this._result); | 11579 PolymerHtmlUnitBuilder_FoundTagDartElementError(this._result); |
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13560 _index++; | 13560 _index++; |
13561 if (_index >= _manager._workQueues[_queueIndex].length) { | 13561 if (_index >= _manager._workQueues[_queueIndex].length) { |
13562 _index = 0; | 13562 _index = 0; |
13563 _queueIndex++; | 13563 _queueIndex++; |
13564 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { | 13564 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_
queueIndex].isEmpty) { |
13565 _queueIndex++; | 13565 _queueIndex++; |
13566 } | 13566 } |
13567 } | 13567 } |
13568 } | 13568 } |
13569 } | 13569 } |
OLD | NEW |