| 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 if (cachedNode != null) return cachedNode; | 1817 if (cachedNode != null) return cachedNode; |
| 1818 cachedNode = parse(listener, | 1818 cachedNode = parse(listener, |
| 1819 getCompilationUnit(), | 1819 getCompilationUnit(), |
| 1820 (p) => p.parseVariablesDeclaration(beginToken)); | 1820 (p) => p.parseVariablesDeclaration(beginToken)); |
| 1821 if (!cachedNode.modifiers.isVar() && | 1821 if (!cachedNode.modifiers.isVar() && |
| 1822 !cachedNode.modifiers.isFinal() && | 1822 !cachedNode.modifiers.isFinal() && |
| 1823 !cachedNode.modifiers.isConst() && | 1823 !cachedNode.modifiers.isConst() && |
| 1824 cachedNode.type === null) { | 1824 cachedNode.type === null) { |
| 1825 listener.cancel('A field declaration must start with var, final, ' | 1825 listener.cancel('A field declaration must start with var, final, ' |
| 1826 'const, or a type annotation.', | 1826 'const, or a type annotation.', |
| 1827 cachedNode); | 1827 node: cachedNode); |
| 1828 } | 1828 } |
| 1829 return cachedNode; | 1829 return cachedNode; |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 Token position() => beginToken; // findMyName doesn't work. I'm nameless. | 1832 Token position() => beginToken; // findMyName doesn't work. I'm nameless. |
| 1833 | 1833 |
| 1834 PartialFieldListElement cloneTo(Element enclosing, | 1834 PartialFieldListElement cloneTo(Element enclosing, |
| 1835 DiagnosticListener listener) { | 1835 DiagnosticListener listener) { |
| 1836 PartialFieldListElement result = new PartialFieldListElement( | 1836 PartialFieldListElement result = new PartialFieldListElement( |
| 1837 beginToken, endToken, modifiers, enclosing); | 1837 beginToken, endToken, modifiers, enclosing); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 | 1882 |
| 1883 Node parse(DiagnosticListener diagnosticListener, | 1883 Node parse(DiagnosticListener diagnosticListener, |
| 1884 CompilationUnitElement element, | 1884 CompilationUnitElement element, |
| 1885 doParse(Parser parser)) { | 1885 doParse(Parser parser)) { |
| 1886 NodeListener listener = new NodeListener(diagnosticListener, element); | 1886 NodeListener listener = new NodeListener(diagnosticListener, element); |
| 1887 doParse(new Parser(listener)); | 1887 doParse(new Parser(listener)); |
| 1888 Node node = listener.popNode(); | 1888 Node node = listener.popNode(); |
| 1889 assert(listener.nodes.isEmpty()); | 1889 assert(listener.nodes.isEmpty()); |
| 1890 return node; | 1890 return node; |
| 1891 } | 1891 } |
| OLD | NEW |