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

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: Merged with r37359. 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
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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 MessageKind.GENERIC, 1213 MessageKind.GENERIC,
1214 {'text': "Could not find '$MAIN'."}); 1214 {'text': "Could not find '$MAIN'."});
1215 } else if (!analyzeAll) { 1215 } else if (!analyzeAll) {
1216 reportFatalError(mainApp, MessageKind.GENERIC, 1216 reportFatalError(mainApp, MessageKind.GENERIC,
1217 {'text': "Could not find '$MAIN'. " 1217 {'text': "Could not find '$MAIN'. "
1218 "No source will be analyzed. " 1218 "No source will be analyzed. "
1219 "Use '--analyze-all' to analyze all code in the " 1219 "Use '--analyze-all' to analyze all code in the "
1220 "library."}); 1220 "library."});
1221 } 1221 }
1222 } else { 1222 } else {
1223 if (main.isErroneous) { 1223 if (main.isErroneous && main.isSynthesized) {
1224 reportFatalError(main, MessageKind.GENERIC, 1224 reportFatalError(main, MessageKind.GENERIC,
1225 {'text': "Cannot determine which '$MAIN' to use."}); 1225 {'text': "Cannot determine which '$MAIN' to use."});
1226 } else if (!main.isFunction) { 1226 } else if (!main.isFunction) {
1227 reportFatalError(main, MessageKind.GENERIC, 1227 reportFatalError(main, MessageKind.GENERIC,
1228 {'text': "'$MAIN' is not a function."}); 1228 {'text': "'$MAIN' is not a function."});
1229 } 1229 }
1230 mainFunction = main; 1230 mainFunction = main;
1231 FunctionSignature parameters = mainFunction.computeSignature(this); 1231 FunctionSignature parameters = mainFunction.computeSignature(this);
1232 if (parameters.parameterCount > 2) { 1232 if (parameters.parameterCount > 2) {
1233 int index = 0; 1233 int index = 0;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 } 1601 }
1602 return SourceSpan.withCharacterOffsets(begin, end, 1602 return SourceSpan.withCharacterOffsets(begin, end,
1603 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset)); 1603 (beginOffset, endOffset) => new SourceSpan(uri, beginOffset, endOffset));
1604 } 1604 }
1605 1605
1606 SourceSpan spanFromNode(Node node) { 1606 SourceSpan spanFromNode(Node node) {
1607 return spanFromTokens(node.getBeginToken(), node.getEndToken()); 1607 return spanFromTokens(node.getBeginToken(), node.getEndToken());
1608 } 1608 }
1609 1609
1610 SourceSpan spanFromElement(Element element) { 1610 SourceSpan spanFromElement(Element element) {
1611 if (Elements.isErroneousElement(element)) { 1611 while (element != null && element.isSynthesized) {
1612 element = element.enclosingElement; 1612 element = element.enclosingElement;
1613 } 1613 }
1614 if (element.position == null && 1614 if (element != null &&
1615 element.position == null &&
1615 !element.isLibrary && 1616 !element.isLibrary &&
1616 !element.isCompilationUnit) { 1617 !element.isCompilationUnit) {
1617 // Sometimes, the backend fakes up elements that have no 1618 // Sometimes, the backend fakes up elements that have no
1618 // position. So we use the enclosing element instead. It is 1619 // position. So we use the enclosing element instead. It is
1619 // not a good error location, but cancel really is "internal 1620 // not a good error location, but cancel really is "internal
1620 // error" or "not implemented yet", so the vicinity is good 1621 // error" or "not implemented yet", so the vicinity is good
1621 // enough for now. 1622 // enough for now.
1622 element = element.enclosingElement; 1623 element = element.enclosingElement;
1623 // TODO(ahe): I plan to overhaul this infrastructure anyways. 1624 // TODO(ahe): I plan to overhaul this infrastructure anyways.
1624 } 1625 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 static NullSink outputProvider(String name, String extension) { 1953 static NullSink outputProvider(String name, String extension) {
1953 return new NullSink('$name.$extension'); 1954 return new NullSink('$name.$extension');
1954 } 1955 }
1955 } 1956 }
1956 1957
1957 /// Information about suppressed warnings and hints for a given library. 1958 /// Information about suppressed warnings and hints for a given library.
1958 class SuppressionInfo { 1959 class SuppressionInfo {
1959 int warnings = 0; 1960 int warnings = 0;
1960 int hints = 0; 1961 int hints = 0;
1961 } 1962 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698