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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 14079003: Implement Symbol correctly in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
index 93fd69cce8f4b4cf7a0478ec2b4480eb127528be..f2f887a13bb7107187d15272df8a09d704c1e4a8 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -306,6 +306,11 @@ abstract class Compiler implements DiagnosticListener {
ClassElement listClass;
ClassElement typeClass;
ClassElement mapClass;
+ ClassElement symbolClass;
+ FunctionElement symbolConstructor;
+ ClassElement mirrorSystemClass;
+ FunctionElement mirrorSystemGetNameFunction;
+
ClassElement jsInvocationMirrorClass;
/// Document class from dart:mirrors.
ClassElement documentClass;
@@ -616,6 +621,19 @@ abstract class Compiler implements DiagnosticListener {
library.addToScope(dynamicClass, this);
});
}
+ if (uri == Uri.parse('dart:mirrors')) {
+ mirrorSystemClass = library.find(const SourceString('MirrorSystem'));
+ print(mirrorSystemClass);
+ }
+ }
+
+ void onClassResolved(ClassElement cls) {
+ if (mirrorSystemClass == cls) {
+ mirrorSystemGetNameFunction =
+ cls.lookupLocalMember(const SourceString('getName'));
+ } else if (symbolClass == cls) {
+ symbolConstructor = cls.constructors.head;
+ }
}
LibraryElement scanBuiltinLibrary(String filename);
@@ -645,6 +663,11 @@ abstract class Compiler implements DiagnosticListener {
'$missingCoreClasses');
}
+ // The following classes may not exist.
+ // TODO(ahe): It is possible that we have to require the presence
+ // of Symbol as we change how we implement noSuchMethod.
+ symbolClass = lookupCoreClass('Symbol');
+
final List missingHelperClasses = [];
ClassElement lookupHelperClass(String name) {
ClassElement result = jsHelperLibrary.find(new SourceString(name));
@@ -1013,6 +1036,14 @@ abstract class Compiler implements DiagnosticListener {
api.Diagnostic.ERROR);
}
+ // TODO(ahe): Rename to reportWarning when that method has been removed.
+ void reportWarningCode(Spannable node, MessageKind errorCode,
+ [Map arguments = const {}]) {
+ reportMessage(spanFromSpannable(node),
+ errorCode.error(arguments),
+ api.Diagnostic.WARNING);
+ }
+
void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) {
// TODO(ahe): The names Diagnostic and api.Diagnostic are in
// conflict. Fix it.

Powered by Google App Engine
This is Rietveld 408576698