OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library fasta.body_builder; | 5 library fasta.body_builder; |
6 | 6 |
7 import '../parser/parser.dart' show FormalParameterType, optional; | 7 import '../parser/parser.dart' show FormalParameterType, optional; |
8 | 8 |
9 import '../parser/error_kind.dart' show ErrorKind; | 9 import '../parser/error_kind.dart' show ErrorKind; |
10 | 10 |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 arguments.types.clear(); | 1650 arguments.types.clear(); |
1651 for (int i = 0; i < typeParameters.length; i++) { | 1651 for (int i = 0; i < typeParameters.length; i++) { |
1652 arguments.types.add(const DynamicType()); | 1652 arguments.types.add(const DynamicType()); |
1653 } | 1653 } |
1654 } | 1654 } |
1655 | 1655 |
1656 return true; | 1656 return true; |
1657 } | 1657 } |
1658 | 1658 |
1659 @override | 1659 @override |
1660 void handleNewExpression(Token token) { | 1660 void endNewExpression(Token token) { |
1661 debugEvent("NewExpression"); | 1661 debugEvent("NewExpression"); |
1662 Arguments arguments = pop(); | 1662 Arguments arguments = pop(); |
1663 String name = pop(); | 1663 String name = pop(); |
1664 List<DartType> typeArguments = pop(); | 1664 List<DartType> typeArguments = pop(); |
1665 var type = pop(); | 1665 var type = pop(); |
1666 | 1666 |
1667 if (arguments == null) { | 1667 if (arguments == null) { |
1668 push(buildCompileTimeError("No arguments.", token.charOffset)); | 1668 push(buildCompileTimeError("No arguments.", token.charOffset)); |
1669 return; | 1669 return; |
1670 } | 1670 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 errorName = debugName(type.name, name); | 1703 errorName = debugName(type.name, name); |
1704 } | 1704 } |
1705 } else { | 1705 } else { |
1706 errorName = debugName(getNodeName(type), name); | 1706 errorName = debugName(getNodeName(type), name); |
1707 } | 1707 } |
1708 errorName ??= name; | 1708 errorName ??= name; |
1709 push(throwNoSuchMethodError(errorName, arguments, token.charOffset)); | 1709 push(throwNoSuchMethodError(errorName, arguments, token.charOffset)); |
1710 } | 1710 } |
1711 | 1711 |
1712 @override | 1712 @override |
1713 void handleConstExpression(Token token) { | 1713 void endConstExpression(Token token) { |
1714 debugEvent("ConstExpression"); | 1714 debugEvent("endConstExpression"); |
1715 handleNewExpression(token); | 1715 endNewExpression(token); |
1716 } | 1716 } |
1717 | 1717 |
1718 @override | 1718 @override |
1719 void endTypeArguments(int count, Token beginToken, Token endToken) { | 1719 void endTypeArguments(int count, Token beginToken, Token endToken) { |
1720 debugEvent("TypeArguments"); | 1720 debugEvent("TypeArguments"); |
1721 push(popList(count)); | 1721 push(popList(count)); |
1722 } | 1722 } |
1723 | 1723 |
1724 @override | 1724 @override |
1725 void handleThisExpression(Token token, IdentifierContext context) { | 1725 void handleThisExpression(Token token, IdentifierContext context) { |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2739 } else if (node is PrefixBuilder) { | 2739 } else if (node is PrefixBuilder) { |
2740 return node.name; | 2740 return node.name; |
2741 } else if (node is ThisAccessor) { | 2741 } else if (node is ThisAccessor) { |
2742 return node.isSuper ? "super" : "this"; | 2742 return node.isSuper ? "super" : "this"; |
2743 } else if (node is BuilderAccessor) { | 2743 } else if (node is BuilderAccessor) { |
2744 return node.plainNameForRead; | 2744 return node.plainNameForRead; |
2745 } else { | 2745 } else { |
2746 return internalError("Unhandled: ${node.runtimeType}"); | 2746 return internalError("Unhandled: ${node.runtimeType}"); |
2747 } | 2747 } |
2748 } | 2748 } |
OLD | NEW |