| OLD | NEW | 
 | (Empty) | 
|   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 |  | 
|   3 // BSD-style license that can be found in the LICENSE file. |  | 
|   4  |  | 
|   5 // TODO(ahe): Long term, it would probably be better if we do not use |  | 
|   6 // executable code to define the locations of libraries. |  | 
|   7  |  | 
|   8 #library('library_map'); |  | 
|   9 #import('../../../lib/_internal/libraries.dart', prefix: "libs"); |  | 
|  10  |  | 
|  11 /** |  | 
|  12  * Simple structure providing the path to a library and an optional path |  | 
|  13  * to a patch file for the library. |  | 
|  14  */ |  | 
|  15 class LibraryInfo { |  | 
|  16   final libs.LibraryInfo info; |  | 
|  17   const LibraryInfo(this.info); |  | 
|  18  |  | 
|  19   String get libraryPath() { |  | 
|  20     String libPath = info.dart2jsPath; |  | 
|  21     if (libPath === null) libPath = info.path; |  | 
|  22     return "lib/$libPath"; |  | 
|  23   } |  | 
|  24  |  | 
|  25   String get patchPath() { |  | 
|  26     if (info.dart2jsPatchPath === null) return null; |  | 
|  27     return "lib/${info.dart2jsPatchPath}"; |  | 
|  28   } |  | 
|  29  |  | 
|  30   bool get isInternal => info.category === "Internal"; |  | 
|  31 } |  | 
|  32  |  | 
|  33 class Dart2JSLibraryMap { |  | 
|  34   const Dart2JSLibraryMap(); |  | 
|  35  |  | 
|  36   LibraryInfo operator[](String dartName) { |  | 
|  37     libs.LibraryInfo info = libs.LIBRARIES[dartName]; |  | 
|  38     if (info === null) return null; |  | 
|  39     if (!info.isDart2JsLibrary()) { |  | 
|  40       // Dart2js can't handle internal libraries for other backends. |  | 
|  41       return null; |  | 
|  42     } |  | 
|  43     return new LibraryInfo(info); |  | 
|  44   } |  | 
|  45 } |  | 
|  46  |  | 
|  47 final Dart2JSLibraryMap DART2JS_LIBRARY_MAP = const Dart2JSLibraryMap(); |  | 
| OLD | NEW |