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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 324293002: Improve parser error recovery. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Johnni's comments Created 6 years, 6 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 | dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart » ('j') | no next file with comments »
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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 MessageKind.GENERIC, 1257 MessageKind.GENERIC,
1258 {'text': "Could not find '$MAIN'."}); 1258 {'text': "Could not find '$MAIN'."});
1259 } else if (!analyzeAll) { 1259 } else if (!analyzeAll) {
1260 reportFatalError(mainApp, MessageKind.GENERIC, 1260 reportFatalError(mainApp, MessageKind.GENERIC,
1261 {'text': "Could not find '$MAIN'. " 1261 {'text': "Could not find '$MAIN'. "
1262 "No source will be analyzed. " 1262 "No source will be analyzed. "
1263 "Use '--analyze-all' to analyze all code in the " 1263 "Use '--analyze-all' to analyze all code in the "
1264 "library."}); 1264 "library."});
1265 } 1265 }
1266 } else { 1266 } else {
1267 if (main.isErroneous) { 1267 if (main.isErroneous && main.isSynthesized) {
1268 reportFatalError(main, MessageKind.GENERIC, 1268 reportFatalError(main, MessageKind.GENERIC,
1269 {'text': "Cannot determine which '$MAIN' to use."}); 1269 {'text': "Cannot determine which '$MAIN' to use."});
1270 } else if (!main.isFunction) { 1270 } else if (!main.isFunction) {
1271 reportFatalError(main, MessageKind.GENERIC, 1271 reportFatalError(main, MessageKind.GENERIC,
1272 {'text': "'$MAIN' is not a function."}); 1272 {'text': "'$MAIN' is not a function."});
1273 } 1273 }
1274 mainFunction = main; 1274 mainFunction = main;
1275 FunctionSignature parameters = mainFunction.computeSignature(this); 1275 FunctionSignature parameters = mainFunction.computeSignature(this);
1276 if (parameters.parameterCount > 2) { 1276 if (parameters.parameterCount > 2) {
1277 int index = 0; 1277 int index = 0;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 } 1645 }
1646 return SourceSpan.withCharacterOffsets(begin, end, 1646 return SourceSpan.withCharacterOffsets(begin, end,
1647 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset)); 1647 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset));
1648 } 1648 }
1649 1649
1650 SourceSpan spanFromNode(Node node) { 1650 SourceSpan spanFromNode(Node node) {
1651 return spanFromTokens(node.getBeginToken(), node.getEndToken()); 1651 return spanFromTokens(node.getBeginToken(), node.getEndToken());
1652 } 1652 }
1653 1653
1654 SourceSpan spanFromElement(Element element) { 1654 SourceSpan spanFromElement(Element element) {
1655 if (Elements.isErroneousElement(element)) { 1655 while (element != null && element.isSynthesized) {
1656 element = element.enclosingElement; 1656 element = element.enclosingElement;
1657 } 1657 }
1658 if (element.position == null && 1658 if (element != null &&
1659 element.position == null &&
1659 !element.isLibrary && 1660 !element.isLibrary &&
1660 !element.isCompilationUnit) { 1661 !element.isCompilationUnit) {
1661 // Sometimes, the backend fakes up elements that have no 1662 // Sometimes, the backend fakes up elements that have no
1662 // position. So we use the enclosing element instead. It is 1663 // position. So we use the enclosing element instead. It is
1663 // not a good error location, but cancel really is "internal 1664 // not a good error location, but cancel really is "internal
1664 // error" or "not implemented yet", so the vicinity is good 1665 // error" or "not implemented yet", so the vicinity is good
1665 // enough for now. 1666 // enough for now.
1666 element = element.enclosingElement; 1667 element = element.enclosingElement;
1667 // TODO(ahe): I plan to overhaul this infrastructure anyways. 1668 // TODO(ahe): I plan to overhaul this infrastructure anyways.
1668 } 1669 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 static NullSink outputProvider(String name, String extension) { 1997 static NullSink outputProvider(String name, String extension) {
1997 return new NullSink('$name.$extension'); 1998 return new NullSink('$name.$extension');
1998 } 1999 }
1999 } 2000 }
2000 2001
2001 /// Information about suppressed warnings and hints for a given library. 2002 /// Information about suppressed warnings and hints for a given library.
2002 class SuppressionInfo { 2003 class SuppressionInfo {
2003 int warnings = 0; 2004 int warnings = 0;
2004 int hints = 0; 2005 int hints = 0;
2005 } 2006 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698