OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart._js_mirrors; | 5 library dart._js_mirrors; |
6 | 6 |
7 import 'shared/runtime_data.dart' as encoding; | 7 import 'shared/runtime_data.dart' as encoding; |
8 import 'shared/embedded_names.dart' show | 8 import 'shared/embedded_names.dart' show |
9 ALL_CLASSES, | 9 ALL_CLASSES, |
10 LAZIES, | 10 LAZIES, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return librariesByName[n(libraryName)].single; | 134 return librariesByName[n(libraryName)].single; |
135 } | 135 } |
136 | 136 |
137 static Map<String, List<LibraryMirror>> computeLibrariesByName() { | 137 static Map<String, List<LibraryMirror>> computeLibrariesByName() { |
138 disableTreeShaking(); | 138 disableTreeShaking(); |
139 var result = new Map<String, List<LibraryMirror>>(); | 139 var result = new Map<String, List<LibraryMirror>>(); |
140 var jsLibraries = JS_EMBEDDED_GLOBAL('JSExtendableArray|Null', LIBRARIES); | 140 var jsLibraries = JS_EMBEDDED_GLOBAL('JSExtendableArray|Null', LIBRARIES); |
141 if (jsLibraries == null) return result; | 141 if (jsLibraries == null) return result; |
142 for (List data in jsLibraries) { | 142 for (List data in jsLibraries) { |
143 String name = data[0]; | 143 String name = data[0]; |
144 Uri uri = Uri.parse(data[1]); | 144 String uriString = data[1]; |
| 145 Uri uri; |
| 146 // The Uri has been compiled out. Create a URI from the simple name. |
| 147 if (uriString != "") { |
| 148 uri = Uri.parse(uriString); |
| 149 } else { |
| 150 uri = new Uri(scheme: 'https', |
| 151 host: 'dartlang.org', |
| 152 path: 'dart2js-stripped-uri', |
| 153 queryParameters: { 'lib': name }); |
| 154 } |
145 List<String> classes = data[2]; | 155 List<String> classes = data[2]; |
146 List<String> functions = data[3]; | 156 List<String> functions = data[3]; |
147 var metadataFunction = data[4]; | 157 var metadataFunction = data[4]; |
148 var fields = data[5]; | 158 var fields = data[5]; |
149 bool isRoot = data[6]; | 159 bool isRoot = data[6]; |
150 var globalObject = data[7]; | 160 var globalObject = data[7]; |
151 List metadata = (metadataFunction == null) | 161 List metadata = (metadataFunction == null) |
152 ? const [] : JS('List', '#()', metadataFunction); | 162 ? const [] : JS('List', '#()', metadataFunction); |
153 var libraries = result.putIfAbsent(name, () => <LibraryMirror>[]); | 163 var libraries = result.putIfAbsent(name, () => <LibraryMirror>[]); |
154 libraries.add( | 164 libraries.add( |
(...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 // have a part (following a '.') that starts with '_'. | 2968 // have a part (following a '.') that starts with '_'. |
2959 const int UNDERSCORE = 0x5f; | 2969 const int UNDERSCORE = 0x5f; |
2960 if (name.isEmpty) return true; | 2970 if (name.isEmpty) return true; |
2961 int index = -1; | 2971 int index = -1; |
2962 do { | 2972 do { |
2963 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; | 2973 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; |
2964 index = name.indexOf('.', index + 1); | 2974 index = name.indexOf('.', index + 1); |
2965 } while (index >= 0 && index + 1 < name.length); | 2975 } while (index >= 0 && index + 1 < name.length); |
2966 return true; | 2976 return true; |
2967 } | 2977 } |
OLD | NEW |