OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of scanner; | 5 part of scanner; |
6 | 6 |
7 const bool VERBOSE = false; | 7 const bool VERBOSE = false; |
8 | 8 |
9 /** | 9 /** |
10 * A parser event listener that does nothing except throw exceptions | 10 * A parser event listener that does nothing except throw exceptions |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 if (periodBeforeName != null) { | 740 if (periodBeforeName != null) { |
741 popNode(); // Discard name. | 741 popNode(); // Discard name. |
742 } | 742 } |
743 popNode(); // Discard node (Send or Identifier). | 743 popNode(); // Discard node (Send or Identifier). |
744 pushMetadata(new PartialMetadataAnnotation(beginToken)); | 744 pushMetadata(new PartialMetadataAnnotation(beginToken)); |
745 } | 745 } |
746 | 746 |
747 void endClassDeclaration(int interfacesCount, Token beginToken, | 747 void endClassDeclaration(int interfacesCount, Token beginToken, |
748 Token extendsKeyword, Token implementsKeyword, | 748 Token extendsKeyword, Token implementsKeyword, |
749 Token endToken) { | 749 Token endToken) { |
750 SourceString nativeTagInfo = native.checkForNativeClass(this); | 750 SourceString nativeName = native.checkForNativeClass(this); |
751 NodeList interfaces = | 751 NodeList interfaces = |
752 makeNodeList(interfacesCount, implementsKeyword, null, ","); | 752 makeNodeList(interfacesCount, implementsKeyword, null, ","); |
753 TypeAnnotation supertype = popNode(); | 753 TypeAnnotation supertype = popNode(); |
754 NodeList typeParameters = popNode(); | 754 NodeList typeParameters = popNode(); |
755 Identifier name = popNode(); | 755 Identifier name = popNode(); |
756 int id = idGenerator(); | 756 int id = idGenerator(); |
757 ClassElement element = new PartialClassElement( | 757 ClassElement element = new PartialClassElement( |
758 name.source, beginToken, endToken, compilationUnitElement, id); | 758 name.source, beginToken, endToken, compilationUnitElement, id); |
759 element.nativeTagInfo = nativeTagInfo; | 759 element.nativeName = nativeName; |
760 pushElement(element); | 760 pushElement(element); |
761 rejectBuiltInIdentifier(name); | 761 rejectBuiltInIdentifier(name); |
762 } | 762 } |
763 | 763 |
764 void rejectBuiltInIdentifier(Identifier name) { | 764 void rejectBuiltInIdentifier(Identifier name) { |
765 if (name.source is Keyword) { | 765 if (name.source is Keyword) { |
766 Keyword keyword = name.source; | 766 Keyword keyword = name.source; |
767 if (!keyword.isPseudo) { | 767 if (!keyword.isPseudo) { |
768 recoverableError('illegal name ${keyword.syntax}', node: name); | 768 recoverableError('illegal name ${keyword.syntax}', node: name); |
769 } | 769 } |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 | 1949 |
1950 Node parse(DiagnosticListener diagnosticListener, | 1950 Node parse(DiagnosticListener diagnosticListener, |
1951 CompilationUnitElement element, | 1951 CompilationUnitElement element, |
1952 doParse(Parser parser)) { | 1952 doParse(Parser parser)) { |
1953 NodeListener listener = new NodeListener(diagnosticListener, element); | 1953 NodeListener listener = new NodeListener(diagnosticListener, element); |
1954 doParse(new Parser(listener)); | 1954 doParse(new Parser(listener)); |
1955 Node node = listener.popNode(); | 1955 Node node = listener.popNode(); |
1956 assert(listener.nodes.isEmpty); | 1956 assert(listener.nodes.isEmpty); |
1957 return node; | 1957 return node; |
1958 } | 1958 } |
OLD | NEW |