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 const bool VERBOSE = false; | 5 const bool VERBOSE = false; |
6 | 6 |
7 /** | 7 /** |
8 * A parser event listener that does nothing except throw exceptions | 8 * A parser event listener that does nothing except throw exceptions |
9 * on parser errors. | 9 * on parser errors. |
10 */ | 10 */ |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1801 if (cachedNode != null) return cachedNode; | 1801 if (cachedNode != null) return cachedNode; |
1802 cachedNode = parse(listener, | 1802 cachedNode = parse(listener, |
1803 getCompilationUnit(), | 1803 getCompilationUnit(), |
1804 (p) => p.parseVariablesDeclaration(beginToken)); | 1804 (p) => p.parseVariablesDeclaration(beginToken)); |
1805 if (!cachedNode.modifiers.isVar() && | 1805 if (!cachedNode.modifiers.isVar() && |
1806 !cachedNode.modifiers.isFinal() && | 1806 !cachedNode.modifiers.isFinal() && |
1807 !cachedNode.modifiers.isConst() && | 1807 !cachedNode.modifiers.isConst() && |
1808 cachedNode.type === null) { | 1808 cachedNode.type === null) { |
1809 listener.cancel('A field declaration must start with var, final, ' | 1809 listener.cancel('A field declaration must start with var, final, ' |
1810 'const, or a type annotation.', | 1810 'const, or a type annotation.', |
1811 cachedNode); | 1811 node: cachedNode); |
1812 } | 1812 } |
1813 return cachedNode; | 1813 return cachedNode; |
1814 } | 1814 } |
1815 | 1815 |
1816 Token position() => beginToken; // findMyName doesn't work. I'm nameless. | 1816 Token position() => beginToken; // findMyName doesn't work. I'm nameless. |
1817 | 1817 |
1818 PartialFieldListElement cloneTo(Element enclosing, | 1818 PartialFieldListElement cloneTo(Element enclosing, |
1819 DiagnosticListener listener) { | 1819 DiagnosticListener listener) { |
1820 PartialFieldListElement result = new PartialFieldListElement( | 1820 PartialFieldListElement result = new PartialFieldListElement( |
1821 beginToken, endToken, modifiers, enclosing); | 1821 beginToken, endToken, modifiers, enclosing); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 | 1866 |
1867 Node parse(DiagnosticListener diagnosticListener, | 1867 Node parse(DiagnosticListener diagnosticListener, |
1868 CompilationUnitElement element, | 1868 CompilationUnitElement element, |
1869 doParse(Parser parser)) { | 1869 doParse(Parser parser)) { |
1870 NodeListener listener = new NodeListener(diagnosticListener, element); | 1870 NodeListener listener = new NodeListener(diagnosticListener, element); |
1871 doParse(new Parser(listener)); | 1871 doParse(new Parser(listener)); |
1872 Node node = listener.popNode(); | 1872 Node node = listener.popNode(); |
1873 assert(listener.nodes.isEmpty()); | 1873 assert(listener.nodes.isEmpty()); |
1874 return node; | 1874 return node; |
1875 } | 1875 } |
OLD | NEW |