| 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 | 5 |
| 6 /** | 6 /** |
| 7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not |
| 8 * compiled. | 8 * compiled. |
| 9 */ | 9 */ |
| 10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 691 |
| 692 reportDiagnostic(span, 'Warning: $message', api.Diagnostic.WARNING); | 692 reportDiagnostic(span, 'Warning: $message', api.Diagnostic.WARNING); |
| 693 } | 693 } |
| 694 | 694 |
| 695 reportError(Node node, var message) { | 695 reportError(Node node, var message) { |
| 696 SourceSpan span = spanFromNode(node); | 696 SourceSpan span = spanFromNode(node); |
| 697 reportDiagnostic(span, 'Error: $message', api.Diagnostic.ERROR); | 697 reportDiagnostic(span, 'Error: $message', api.Diagnostic.ERROR); |
| 698 throw new CompilerCancelledException(message.toString()); | 698 throw new CompilerCancelledException(message.toString()); |
| 699 } | 699 } |
| 700 | 700 |
| 701 void reportMessage(SourceSpan span, | 701 void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) { |
| 702 Diagnostic message, | |
| 703 api.Diagnostic kind) { | |
| 704 // TODO(ahe): The names Diagnostic and api.Diagnostic are in | 702 // TODO(ahe): The names Diagnostic and api.Diagnostic are in |
| 705 // conflict. Fix it. | 703 // conflict. Fix it. |
| 706 reportDiagnostic(span, "$message", kind); | 704 reportDiagnostic(span, "$message", kind); |
| 707 } | 705 } |
| 708 | 706 |
| 709 abstract void reportDiagnostic(SourceSpan span, String message, | 707 abstract void reportDiagnostic(SourceSpan span, String message, |
| 710 api.Diagnostic kind); | 708 api.Diagnostic kind); |
| 711 | 709 |
| 712 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { | 710 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { |
| 713 if (begin === null || end === null) { | 711 if (begin === null || end === null) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 743 if (element === null) { | 741 if (element === null) { |
| 744 element = currentElement; | 742 element = currentElement; |
| 745 } | 743 } |
| 746 Token position = element.position(); | 744 Token position = element.position(); |
| 747 Uri uri = element.getCompilationUnit().script.uri; | 745 Uri uri = element.getCompilationUnit().script.uri; |
| 748 return (position === null) | 746 return (position === null) |
| 749 ? new SourceSpan(uri, 0, 0) | 747 ? new SourceSpan(uri, 0, 0) |
| 750 : spanFromTokens(position, position, uri); | 748 : spanFromTokens(position, position, uri); |
| 751 } | 749 } |
| 752 | 750 |
| 753 Script readScript(Uri uri, [ScriptTag node]) { | 751 Script readScript(Uri uri, [LibraryTag node]) { |
| 754 unimplemented('Compiler.readScript'); | 752 unimplemented('Compiler.readScript'); |
| 755 } | 753 } |
| 756 | 754 |
| 757 String get legDirectory { | 755 String get legDirectory { |
| 758 unimplemented('Compiler.legDirectory'); | 756 unimplemented('Compiler.legDirectory'); |
| 759 } | 757 } |
| 760 | 758 |
| 761 // TODO(karlklose): split into findHelperFunction and findHelperClass and | 759 // TODO(karlklose): split into findHelperFunction and findHelperClass and |
| 762 // add a check that the element has the expected kind. | 760 // add a check that the element has the expected kind. |
| 763 Element findHelper(SourceString name) | 761 Element findHelper(SourceString name) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 * information in the generated error message. | 848 * information in the generated error message. |
| 851 */ | 849 */ |
| 852 bool invariant(Spannable spannable, var condition, {String message: null}) { | 850 bool invariant(Spannable spannable, var condition, {String message: null}) { |
| 853 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 851 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 854 // information on assertion errors. | 852 // information on assertion errors. |
| 855 if (condition is Function){ | 853 if (condition is Function){ |
| 856 condition = condition(); | 854 condition = condition(); |
| 857 } | 855 } |
| 858 return spannable != null && condition; | 856 return spannable != null && condition; |
| 859 } | 857 } |
| OLD | NEW |