[web] Fix dart:mirrors and include it with the dart2js SDK so we ensure it doesn't break accidentally

Change-Id: I047136bb5d09680be38408de9581cf6931e516d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152406
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Sigmund Cherem 2020-07-01 23:31:04 +00:00 committed by commit-bot@chromium.org
parent b83d06e4f8
commit a114b165e5
5 changed files with 42 additions and 8 deletions

View file

@ -20,17 +20,11 @@ InstanceMirror reflect(dynamic reflectee) =>
ClassMirror reflectClass(Type key) => throw new UnsupportedError(_message);
@patch
TypeMirror reflectType(Type key, [List<Type> typeArguments]) =>
TypeMirror reflectType(Type key, [List<Type>? typeArguments]) =>
throw new UnsupportedError(_message);
@patch
abstract class MirrorSystem {
Map<Uri, LibraryMirror> get libraries;
IsolateMirror get isolate;
TypeMirror get dynamicType;
TypeMirror get voidType;
TypeMirror get neverType;
@patch
LibraryMirror findLibrary(Symbol libraryName) =>
throw new UnsupportedError(_message);
@ -39,6 +33,6 @@ abstract class MirrorSystem {
static String getName(Symbol symbol) => throw new UnsupportedError(_message);
@patch
static Symbol getSymbol(String name, [LibraryMirror library]) =>
static Symbol getSymbol(String name, [LibraryMirror? library]) =>
throw new UnsupportedError(_message);
}

View file

@ -38,6 +38,9 @@ isolate/deferred_in_isolate2_test: Skip # Issue 16898. Deferred loading does not
js/instanceof_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/parameters_test: SkipByDesign # Issue 42085.
[ $compiler != dart2js && $compiler != dartdevk ]
web/*: SkipByDesign
[ $runtime == chrome && $system == linux ]
mirrors/native_class_test: Slow, Pass

View file

@ -0,0 +1,17 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// 'dart:mirrors' provides no functionality in dart-web, but can be imported and
// all APIs throw.
import 'dart:mirrors';
import 'package:expect/expect.dart';
main() {
Expect.throws<UnsupportedError>(() => currentMirrorSystem());
Expect.throws<UnsupportedError>(() => reflect(main));
Expect.throws<UnsupportedError>(() => reflectClass(Object));
Expect.throws<UnsupportedError>(() => reflectType(Object));
Expect.throws<UnsupportedError>(() => MirrorSystem.getName(#core));
Expect.throws<UnsupportedError>(() => MirrorSystem.getSymbol("core"));
}

View file

@ -38,6 +38,9 @@ isolate/deferred_in_isolate2_test: Skip # Issue 16898. Deferred loading does not
js/instanceof_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/parameters_test: SkipByDesign # Issue 42085.
[ $compiler != dart2js && $compiler != dartdevk ]
web/*: SkipByDesign
[ $runtime == chrome && $system == linux ]
mirrors/native_class_test: Slow, Pass

View file

@ -0,0 +1,17 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// 'dart:mirrors' provides no functionality in dart-web, but can be imported and
// all APIs throw.
import 'dart:mirrors';
import 'package:expect/expect.dart';
main() {
Expect.throws<UnsupportedError>(() => currentMirrorSystem());
Expect.throws<UnsupportedError>(() => reflect(main));
Expect.throws<UnsupportedError>(() => reflectClass(Object));
Expect.throws<UnsupportedError>(() => reflectType(Object));
Expect.throws<UnsupportedError>(() => MirrorSystem.getName(#core));
Expect.throws<UnsupportedError>(() => MirrorSystem.getSymbol("core"));
}