mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
re-add web libraries as part of the sdk
This undoes what we did to get the sdk building earlier. Most tests in lib_2 had runtime failures because native elements were not tagged as such. Besides re-adding dart:html et al to the list of compiled libraries, this ensures we handle native/extension types properly. (See #39698) Change-Id: Ib8516c6d92d12d0f5dccdb5a6cf66e0990b52aff Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133869 Commit-Queue: Sigmund Cherem <sigmund@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
162d6c5634
commit
13e3189a2c
3 changed files with 21 additions and 30 deletions
|
@ -232,8 +232,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
coreTypes ??= CoreTypes(component);
|
||||
var types = TypeEnvironment(coreTypes, hierarchy);
|
||||
var constants = DevCompilerConstants();
|
||||
var nativeTypes = NativeTypeSet(coreTypes, constants,
|
||||
enableNullSafety: options.enableNullSafety);
|
||||
var nativeTypes = NativeTypeSet(coreTypes, constants);
|
||||
var jsTypeRep = JSTypeRep(types, hierarchy);
|
||||
var staticTypeContext = StatefulStaticTypeContext.stacked(types);
|
||||
return ProgramCompiler._(
|
||||
|
|
|
@ -37,8 +37,7 @@ class NativeTypeSet {
|
|||
final _nativeTypes = HashSet<Class>.identity();
|
||||
final _pendingLibraries = HashSet<Library>.identity();
|
||||
|
||||
NativeTypeSet(this.coreTypes, this.constants,
|
||||
{bool enableNullSafety = false}) {
|
||||
NativeTypeSet(this.coreTypes, this.constants) {
|
||||
// First, core types:
|
||||
// TODO(vsm): If we're analyzing against the main SDK, those
|
||||
// types are not explicitly annotated.
|
||||
|
@ -62,16 +61,12 @@ class NativeTypeSet {
|
|||
// listed below).
|
||||
|
||||
// Second, html types - these are only searched if we use dart:html, etc.:
|
||||
// TODO(39698) Remove this check and the named parameter once we don't have
|
||||
// to exclude libraries from the forked NNBD sdk.
|
||||
if (!enableNullSafety) {
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:html'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:indexed_db'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:svg'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:web_audio'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:web_gl'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:web_sql'));
|
||||
}
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:html'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:indexed_db'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:svg'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:web_audio'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:web_gl'));
|
||||
_addPendingExtensionTypes(sdk.getLibrary('dart:web_sql'));
|
||||
}
|
||||
|
||||
void _addExtensionType(Class c, [bool mustBeNative = false]) {
|
||||
|
|
|
@ -49,27 +49,24 @@ class DevCompilerTarget extends Target {
|
|||
'dart:math',
|
||||
'dart:mirrors',
|
||||
'dart:typed_data',
|
||||
if (!flags.enableNullSafety) ...[
|
||||
'dart:indexed_db',
|
||||
'dart:html',
|
||||
'dart:html_common',
|
||||
'dart:svg',
|
||||
'dart:web_audio',
|
||||
'dart:web_gl',
|
||||
'dart:web_sql'
|
||||
]
|
||||
'dart:indexed_db',
|
||||
'dart:html',
|
||||
'dart:html_common',
|
||||
'dart:svg',
|
||||
'dart:web_audio',
|
||||
'dart:web_gl',
|
||||
'dart:web_sql'
|
||||
],
|
||||
_extraIndexedLibraries = [
|
||||
'dart:async',
|
||||
'dart:collection',
|
||||
if (!flags.enableNullSafety) ...['dart:html', 'dart:indexed_db'],
|
||||
'dart:html',
|
||||
'dart:indexed_db',
|
||||
'dart:math',
|
||||
if (!flags.enableNullSafety) ...[
|
||||
'dart:svg',
|
||||
'dart:web_audio',
|
||||
'dart:web_gl',
|
||||
'dart:web_sql'
|
||||
],
|
||||
'dart:svg',
|
||||
'dart:web_audio',
|
||||
'dart:web_gl',
|
||||
'dart:web_sql',
|
||||
'dart:_interceptors',
|
||||
'dart:_js_helper',
|
||||
'dart:_native_typed_data',
|
||||
|
|
Loading…
Reference in a new issue