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 String uriString = data[1]; | 144 Uri uri = Uri.parse(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 } | |
155 List<String> classes = data[2]; | 145 List<String> classes = data[2]; |
156 List<String> functions = data[3]; | 146 List<String> functions = data[3]; |
157 var metadataFunction = data[4]; | 147 var metadataFunction = data[4]; |
158 var fields = data[5]; | 148 var fields = data[5]; |
159 bool isRoot = data[6]; | 149 bool isRoot = data[6]; |
160 var globalObject = data[7]; | 150 var globalObject = data[7]; |
161 List metadata = (metadataFunction == null) | 151 List metadata = (metadataFunction == null) |
162 ? const [] : JS('List', '#()', metadataFunction); | 152 ? const [] : JS('List', '#()', metadataFunction); |
163 var libraries = result.putIfAbsent(name, () => <LibraryMirror>[]); | 153 var libraries = result.putIfAbsent(name, () => <LibraryMirror>[]); |
164 libraries.add( | 154 libraries.add( |
(...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 // have a part (following a '.') that starts with '_'. | 2958 // have a part (following a '.') that starts with '_'. |
2969 const int UNDERSCORE = 0x5f; | 2959 const int UNDERSCORE = 0x5f; |
2970 if (name.isEmpty) return true; | 2960 if (name.isEmpty) return true; |
2971 int index = -1; | 2961 int index = -1; |
2972 do { | 2962 do { |
2973 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; | 2963 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; |
2974 index = name.indexOf('.', index + 1); | 2964 index = name.indexOf('.', index + 1); |
2975 } while (index >= 0 && index + 1 < name.length); | 2965 } while (index >= 0 && index + 1 < name.length); |
2976 return true; | 2966 return true; |
2977 } | 2967 } |
OLD | NEW |