| 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 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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 /// The method returns a [Future] allowing for the loading of additional | 1193 /// The method returns a [Future] allowing for the loading of additional |
| 1194 /// libraries. | 1194 /// libraries. |
| 1195 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { | 1195 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
| 1196 return new Future.sync(() { | 1196 return new Future.sync(() { |
| 1197 if (!loadedLibraries.containsKey(DART_CORE)) return new Future.value(); | 1197 if (!loadedLibraries.containsKey(DART_CORE)) return new Future.value(); |
| 1198 | 1198 |
| 1199 functionClass.ensureResolved(this); | 1199 functionClass.ensureResolved(this); |
| 1200 functionApplyMethod = functionClass.lookupLocalMember('apply'); | 1200 functionApplyMethod = functionClass.lookupLocalMember('apply'); |
| 1201 | 1201 |
| 1202 proxyConstant = | 1202 proxyConstant = |
| 1203 resolver.constantCompiler.compileConstant(coreLibrary.find('proxy')); | 1203 resolver.constantCompiler.compileConstant( |
| 1204 coreLibrary.find('proxy')).value; |
| 1204 | 1205 |
| 1205 // TODO(johnniwinther): Move this to the JavaScript backend. | 1206 // TODO(johnniwinther): Move this to the JavaScript backend. |
| 1206 LibraryElement jsHelperLibrary = | 1207 LibraryElement jsHelperLibrary = |
| 1207 loadedLibraries[js_backend.JavaScriptBackend.DART_JS_HELPER]; | 1208 loadedLibraries[js_backend.JavaScriptBackend.DART_JS_HELPER]; |
| 1208 if (jsHelperLibrary != null) { | 1209 if (jsHelperLibrary != null) { |
| 1209 patchConstant = resolver.constantCompiler.compileConstant( | 1210 patchConstant = resolver.constantCompiler.compileConstant( |
| 1210 jsHelperLibrary.find('patch')); | 1211 jsHelperLibrary.find('patch')).value; |
| 1211 } | 1212 } |
| 1212 | 1213 |
| 1213 if (preserveComments) { | 1214 if (preserveComments) { |
| 1214 return libraryLoader.loadLibrary(DART_MIRRORS) | 1215 return libraryLoader.loadLibrary(DART_MIRRORS) |
| 1215 .then((LibraryElement libraryElement) { | 1216 .then((LibraryElement libraryElement) { |
| 1216 documentClass = libraryElement.find('Comment'); | 1217 documentClass = libraryElement.find('Comment'); |
| 1217 }); | 1218 }); |
| 1218 } | 1219 } |
| 1219 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); | 1220 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); |
| 1220 } | 1221 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 numClass = lookupCoreClass('num'); | 1265 numClass = lookupCoreClass('num'); |
| 1265 intClass = lookupCoreClass('int'); | 1266 intClass = lookupCoreClass('int'); |
| 1266 doubleClass = lookupCoreClass('double'); | 1267 doubleClass = lookupCoreClass('double'); |
| 1267 stringClass = lookupCoreClass('String'); | 1268 stringClass = lookupCoreClass('String'); |
| 1268 functionClass = lookupCoreClass('Function'); | 1269 functionClass = lookupCoreClass('Function'); |
| 1269 listClass = lookupCoreClass('List'); | 1270 listClass = lookupCoreClass('List'); |
| 1270 typeClass = lookupCoreClass('Type'); | 1271 typeClass = lookupCoreClass('Type'); |
| 1271 mapClass = lookupCoreClass('Map'); | 1272 mapClass = lookupCoreClass('Map'); |
| 1272 nullClass = lookupCoreClass('Null'); | 1273 nullClass = lookupCoreClass('Null'); |
| 1273 stackTraceClass = lookupCoreClass('StackTrace'); | 1274 stackTraceClass = lookupCoreClass('StackTrace'); |
| 1275 symbolClass = lookupCoreClass('Symbol'); |
| 1274 if (!missingCoreClasses.isEmpty) { | 1276 if (!missingCoreClasses.isEmpty) { |
| 1275 internalError(coreLibrary, | 1277 internalError(coreLibrary, |
| 1276 'dart:core library does not contain required classes: ' | 1278 'dart:core library does not contain required classes: ' |
| 1277 '$missingCoreClasses'); | 1279 '$missingCoreClasses'); |
| 1278 } | 1280 } |
| 1279 | |
| 1280 // The Symbol class may not exist during unit testing. | |
| 1281 // TODO(ahe): It is possible that we have to require the presence | |
| 1282 // of Symbol as we change how we implement noSuchMethod. | |
| 1283 symbolClass = lookupCoreClass('Symbol'); | |
| 1284 } | 1281 } |
| 1285 | 1282 |
| 1286 Element _unnamedListConstructor; | 1283 Element _unnamedListConstructor; |
| 1287 Element get unnamedListConstructor { | 1284 Element get unnamedListConstructor { |
| 1288 if (_unnamedListConstructor != null) return _unnamedListConstructor; | 1285 if (_unnamedListConstructor != null) return _unnamedListConstructor; |
| 1289 Selector callConstructor = new Selector.callConstructor( | 1286 Selector callConstructor = new Selector.callConstructor( |
| 1290 "", listClass.library); | 1287 "", listClass.library); |
| 1291 return _unnamedListConstructor = | 1288 return _unnamedListConstructor = |
| 1292 listClass.lookupConstructor(callConstructor); | 1289 listClass.lookupConstructor(callConstructor); |
| 1293 } | 1290 } |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 int warnings = 0; | 2123 int warnings = 0; |
| 2127 int hints = 0; | 2124 int hints = 0; |
| 2128 } | 2125 } |
| 2129 | 2126 |
| 2130 class GenericTask extends CompilerTask { | 2127 class GenericTask extends CompilerTask { |
| 2131 final String name; | 2128 final String name; |
| 2132 | 2129 |
| 2133 GenericTask(this.name, Compiler compiler) | 2130 GenericTask(this.name, Compiler compiler) |
| 2134 : super(compiler); | 2131 : super(compiler); |
| 2135 } | 2132 } |
| OLD | NEW |