Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 2321973002: Make dart2js not consider dart:io there if the library is unsupported. (Closed)
Patch Set: Address comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/conditional_import_string_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library leg_apiimpl; 5 library leg_apiimpl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:package_config/packages.dart'; 9 import 'package:package_config/packages.dart';
10 import 'package:package_config/packages_file.dart' as pkgs; 10 import 'package:package_config/packages_file.dart' as pkgs;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 var result = definitions[name]; 375 var result = definitions[name];
376 if (result != null || definitions.containsKey(name)) return result; 376 if (result != null || definitions.containsKey(name)) return result;
377 if (!name.startsWith(_dartLibraryEnvironmentPrefix)) return null; 377 if (!name.startsWith(_dartLibraryEnvironmentPrefix)) return null;
378 378
379 String libraryName = name.substring(_dartLibraryEnvironmentPrefix.length); 379 String libraryName = name.substring(_dartLibraryEnvironmentPrefix.length);
380 380
381 // Private libraries are not exposed to the users. 381 // Private libraries are not exposed to the users.
382 if (libraryName.startsWith("_")) return null; 382 if (libraryName.startsWith("_")) return null;
383 383
384 if (compiler.resolvedUriTranslator.sdkLibraries.containsKey(libraryName)) { 384 Uri libraryUri =
385 compiler.resolvedUriTranslator.sdkLibraries[libraryName];
386 if (libraryUri != null && libraryUri.scheme != "unsupported") {
385 // Dart2js always "supports" importing 'dart:mirrors' but will abort 387 // Dart2js always "supports" importing 'dart:mirrors' but will abort
386 // the compilation at a later point if the backend doesn't support 388 // the compilation at a later point if the backend doesn't support
387 // mirrors. In this case 'mirrors' should not be in the environment. 389 // mirrors. In this case 'mirrors' should not be in the environment.
388 if (libraryName == 'mirrors') { 390 if (libraryName == 'mirrors') {
389 return compiler.backend.supportsReflection ? "true" : null; 391 return compiler.backend.supportsReflection ? "true" : null;
390 } 392 }
391 return "true"; 393 return "true";
392 } 394 }
393 return null; 395 return null;
394 } 396 }
395 } 397 }
396 398
397 /// For every 'dart:' library, a corresponding environment variable is set 399 /// For every 'dart:' library, a corresponding environment variable is set
398 /// to "true". The environment variable's name is the concatenation of 400 /// to "true". The environment variable's name is the concatenation of
399 /// this prefix and the name (without the 'dart:'. 401 /// this prefix and the name (without the 'dart:'.
400 /// 402 ///
401 /// For example 'dart:html' has the environment variable 'dart.library.html' set 403 /// For example 'dart:html' has the environment variable 'dart.library.html' set
402 /// to "true". 404 /// to "true".
403 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; 405 const String _dartLibraryEnvironmentPrefix = 'dart.library.';
OLDNEW
« no previous file with comments | « no previous file | tests/language/conditional_import_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698