Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Side by Side Diff: lib/compiler/implementation/scanner/listener.dart

Issue 10690106: Error produced for missing var, final, const or type on field declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | tests/co19/co19-leg.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 final bool VERBOSE = false; 5 final 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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 Token this.endToken, 1520 Token this.endToken,
1521 Modifiers modifiers, 1521 Modifiers modifiers,
1522 Element enclosing) 1522 Element enclosing)
1523 : super(ElementKind.VARIABLE_LIST, modifiers, enclosing); 1523 : super(ElementKind.VARIABLE_LIST, modifiers, enclosing);
1524 1524
1525 VariableDefinitions parseNode(DiagnosticListener listener) { 1525 VariableDefinitions parseNode(DiagnosticListener listener) {
1526 if (cachedNode != null) return cachedNode; 1526 if (cachedNode != null) return cachedNode;
1527 cachedNode = parse(listener, 1527 cachedNode = parse(listener,
1528 getCompilationUnit(), 1528 getCompilationUnit(),
1529 (p) => p.parseVariablesDeclaration(beginToken)); 1529 (p) => p.parseVariablesDeclaration(beginToken));
1530 if (!cachedNode.modifiers.isVar() &&
1531 !cachedNode.modifiers.isFinal() &&
1532 !cachedNode.modifiers.isConst() &&
1533 cachedNode.type === null) {
1534 listener.cancel('A field declaration must start with var, final, '
1535 'const, or a type annotation.',
1536 cachedNode);
1537 }
1530 return cachedNode; 1538 return cachedNode;
1531 } 1539 }
1532 1540
1533 Token position() => beginToken; // findMyName doesn't work. I'm nameless. 1541 Token position() => beginToken; // findMyName doesn't work. I'm nameless.
1534 } 1542 }
1535 1543
1536 class PartialTypedefElement extends TypedefElement { 1544 class PartialTypedefElement extends TypedefElement {
1537 final Token token; 1545 final Token token;
1538 1546
1539 PartialTypedefElement(SourceString name, Element enclosing, this.token) 1547 PartialTypedefElement(SourceString name, Element enclosing, this.token)
(...skipping 12 matching lines...) Expand all
1552 1560
1553 Node parse(DiagnosticListener diagnosticListener, 1561 Node parse(DiagnosticListener diagnosticListener,
1554 CompilationUnitElement element, 1562 CompilationUnitElement element,
1555 doParse(Parser parser)) { 1563 doParse(Parser parser)) {
1556 NodeListener listener = new NodeListener(diagnosticListener, element); 1564 NodeListener listener = new NodeListener(diagnosticListener, element);
1557 doParse(new Parser(listener)); 1565 doParse(new Parser(listener));
1558 Node node = listener.popNode(); 1566 Node node = listener.popNode();
1559 assert(listener.nodes.isEmpty()); 1567 assert(listener.nodes.isEmpty());
1560 return node; 1568 return node;
1561 } 1569 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-leg.status » ('j') | tests/co19/co19-leg.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698