Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/compiler.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart |
| index 0c0569ad4d6c499cbdb8cb189471f29d618137e4..291fabd9a83b0093ba80f635639014a7d8849269 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/compiler.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/compiler.dart |
| @@ -492,33 +492,48 @@ abstract class Compiler implements DiagnosticListener { |
| LibraryElement scanBuiltinLibrary(String filename); |
| void initializeSpecialClasses() { |
| - final List missingClasses = []; |
| - ClassElement lookupSpecialClass(SourceString name) { |
| + final List missingCoreClasses = []; |
| + ClassElement lookupCoreClass(SourceString name) { |
| ClassElement result = coreLibrary.find(name); |
| if (result == null) { |
| - missingClasses.add(name.slowToString()); |
| + missingCoreClasses.add(name.slowToString()); |
| + } |
| + return result; |
| + } |
| + objectClass = lookupCoreClass(const SourceString('Object')); |
| + boolClass = lookupCoreClass(const SourceString('bool')); |
| + numClass = lookupCoreClass(const SourceString('num')); |
| + intClass = lookupCoreClass(const SourceString('int')); |
| + doubleClass = lookupCoreClass(const SourceString('double')); |
| + stringClass = lookupCoreClass(const SourceString('String')); |
| + functionClass = lookupCoreClass(const SourceString('Function')); |
| + listClass = lookupCoreClass(const SourceString('List')); |
| + typeClass = lookupCoreClass(const SourceString('Type')); |
| + mapClass = lookupCoreClass(const SourceString('Map')); |
| + if (!missingCoreClasses.isEmpty) { |
| + cancel('core library does not contain required classes: ' |
|
ahe
2013/01/16 18:13:41
core -> dart:core.
ahe
2013/01/16 18:13:41
internalErrorOnElement(coreLibrary, ...
Then the
Johnni Winther
2013/01/22 13:35:53
Done.
Johnni Winther
2013/01/22 13:35:53
Done.
|
| + '$missingCoreClasses'); |
| + } |
| + |
| + final List missingHelperClasses = []; |
| + ClassElement lookupHelperClass(SourceString name) { |
| + ClassElement result = jsHelperLibrary.find(name); |
| + if (result == null) { |
| + missingHelperClasses.add(name.slowToString()); |
| } |
| return result; |
| } |
| - objectClass = lookupSpecialClass(const SourceString('Object')); |
| - boolClass = lookupSpecialClass(const SourceString('bool')); |
| - numClass = lookupSpecialClass(const SourceString('num')); |
| - intClass = lookupSpecialClass(const SourceString('int')); |
| - doubleClass = lookupSpecialClass(const SourceString('double')); |
| - stringClass = lookupSpecialClass(const SourceString('String')); |
| - functionClass = lookupSpecialClass(const SourceString('Function')); |
| - listClass = lookupSpecialClass(const SourceString('List')); |
| - typeClass = lookupSpecialClass(const SourceString('Type')); |
| - mapClass = lookupSpecialClass(const SourceString('Map')); |
| jsInvocationMirrorClass = |
| - lookupSpecialClass(const SourceString('JSInvocationMirror')); |
| - closureClass = lookupSpecialClass(const SourceString('Closure')); |
| - dynamicClass = lookupSpecialClass(const SourceString('Dynamic_')); |
| - nullClass = lookupSpecialClass(const SourceString('Null')); |
| - types = new Types(this, dynamicClass); |
| - if (!missingClasses.isEmpty) { |
| - cancel('core library does not contain required classes: $missingClasses'); |
| + lookupHelperClass(const SourceString('JSInvocationMirror')); |
| + closureClass = lookupHelperClass(const SourceString('Closure')); |
| + dynamicClass = lookupHelperClass(const SourceString('Dynamic_')); |
| + nullClass = lookupHelperClass(const SourceString('Null')); |
| + if (!missingHelperClasses.isEmpty) { |
| + cancel('js helper library does not contain required classes: ' |
|
ahe
2013/01/16 18:13:41
js helper -> dart:_whatever_its_name_is
ahe
2013/01/16 18:13:41
Also, internalErrorOnElement. Even more important
Johnni Winther
2013/01/22 13:35:53
Done.
Johnni Winther
2013/01/22 13:35:53
Done.
|
| + '$missingHelperClasses'); |
| } |
| + |
| + types = new Types(this, dynamicClass); |
| } |
| void scanBuiltinLibraries() { |
| @@ -533,18 +548,6 @@ abstract class Compiler implements DiagnosticListener { |
| isolateHelperLibrary.find(const SourceString('_WorkerStub')); |
| cls.setNative('"*Worker"'); |
| - // The core library was loaded and patched before jsHelperLibrary was |
| - // initialized, so it wasn't imported into those two libraries during |
| - // patching. |
| - importHelperLibrary(coreLibrary); |
| - importHelperLibrary(interceptorsLibrary); |
| - |
| - importForeignLibrary(jsHelperLibrary); |
| - importForeignLibrary(interceptorsLibrary); |
| - |
| - importForeignLibrary(isolateHelperLibrary); |
| - importHelperLibrary(isolateHelperLibrary); |
| - |
| assertMethod = jsHelperLibrary.find(const SourceString('assertHelper')); |
| identicalFunction = coreLibrary.find(const SourceString('identical')); |
| @@ -577,65 +580,6 @@ abstract class Compiler implements DiagnosticListener { |
| */ |
| Uri resolvePatchUri(String dartLibraryPath); |
| - /** Define the JS helper functions in the given library. */ |
| - void importForeignLibrary(LibraryElement library) { |
| - if (foreignLibrary != null) { |
| - libraryLoader.importLibrary(library, foreignLibrary, null); |
| - } |
| - } |
| - |
| - void importIsolateHelperLibrary(LibraryElement library) { |
| - if (isolateHelperLibrary != null) { |
| - libraryLoader.importLibrary(library, isolateHelperLibrary, null); |
| - } |
| - } |
| - |
| - // TODO(karlklose,floitsch): move this to the javascript backend. |
| - /** Enable the 'JS' helper for a library if needed. */ |
| - void maybeEnableJSHelper(LibraryElement library) { |
| - String libraryName = library.uri.toString(); |
| - bool nativeTest = library.entryCompilationUnit.script.name.contains( |
| - 'dart/tests/compiler/dart2js_native'); |
| - if (nativeTest |
| - || libraryName == 'dart:async' |
| - || libraryName == 'dart:mirrors' |
| - || libraryName == 'dart:math' |
| - || libraryName == 'dart:html' |
| - || libraryName == 'dart:html_common' |
| - || libraryName == 'dart:indexed_db' |
| - || libraryName == 'dart:svg' |
| - || libraryName == 'dart:web_audio') { |
| - if (nativeTest |
| - || libraryName == 'dart:html' |
| - || libraryName == 'dart:html_common' |
| - || libraryName == 'dart:indexed_db' |
| - || libraryName == 'dart:svg') { |
| - // dart:html and dart:svg need access to convertDartClosureToJS and |
| - // annotation classes. |
| - // dart:mirrors needs access to the Primitives class. |
| - importHelperLibrary(library); |
| - } |
| - library.addToScope( |
| - foreignLibrary.findLocal(const SourceString('JS')), this); |
| - Element jsIndexingBehaviorInterface = |
| - findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| - if (jsIndexingBehaviorInterface != null) { |
| - library.addToScope(jsIndexingBehaviorInterface, this); |
| - } |
| - } |
| - } |
| - |
| - void maybeEnableIsolateHelper(LibraryElement library) { |
| - String libraryName = library.uri.toString(); |
| - if (libraryName == 'dart:isolate' |
| - || libraryName == 'dart:html' |
| - // TODO(floitsch): create a separate async-helper library instead of |
| - // importing the isolate-library just for TimerImpl. |
| - || libraryName == 'dart:async') { |
| - importIsolateHelperLibrary(library); |
| - } |
| - } |
| - |
| void runCompiler(Uri uri) { |
| assert(uri != null || analyzeOnly); |
| scanBuiltinLibraries(); |
| @@ -649,10 +593,6 @@ abstract class Compiler implements DiagnosticListener { |
| log('compiling $uri ($BUILD_ID)'); |
| mainApp = libraryLoader.loadLibrary(uri, null, uri); |
| } |
| - libraries.forEach((_, library) { |
| - maybeEnableJSHelper(library); |
| - maybeEnableIsolateHelper(library); |
| - }); |
| Element main = null; |
| if (!analyzeOnly) { |
| main = mainApp.find(MAIN); |