Reorganize imports to decouple dart2js_target.dart from dart2js
Change-Id: Ie958dbbf75f5cac20074b2a64a4eefb9de636116
Reviewed-on: https://dart-review.googlesource.com/c/85290
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index 9d1a90b..4922314 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -13,7 +13,7 @@
import 'elements/types.dart';
import 'js_backend/constant_system_javascript.dart';
import 'js_backend/native_data.dart' show NativeBasicData;
-import 'native/native.dart';
+import 'kernel/dart2js_target.dart';
import 'types/abstract_value_domain.dart';
import 'universe/selector.dart' show Selector;
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
index 835c405..896f862 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
@@ -19,7 +19,7 @@
import '../js_model/element_map.dart';
import '../js_model/js_world.dart';
import '../js_model/locals.dart';
-import '../native/behavior.dart' as native;
+import '../native/behavior.dart';
import '../options.dart';
import '../serialization/serialization.dart';
import '../types/abstract_value_domain.dart';
@@ -216,8 +216,8 @@
TypeInformation typeOfParameter(Local element);
/// Returns the type for [nativeBehavior]. See documentation on
- /// [native.NativeBehavior].
- TypeInformation typeOfNativeBehavior(native.NativeBehavior nativeBehavior);
+ /// [NativeBehavior].
+ TypeInformation typeOfNativeBehavior(NativeBehavior nativeBehavior);
bool returnsListElementType(Selector selector, AbstractValue mask);
@@ -346,14 +346,14 @@
}
}
- TypeInformation typeOfNativeBehavior(native.NativeBehavior nativeBehavior) {
+ TypeInformation typeOfNativeBehavior(NativeBehavior nativeBehavior) {
if (nativeBehavior == null) return types.dynamicType;
List typesReturned = nativeBehavior.typesReturned;
if (typesReturned.isEmpty) return types.dynamicType;
TypeInformation returnType;
for (var type in typesReturned) {
TypeInformation mappedType;
- if (type == native.SpecialType.JsObject) {
+ if (type == SpecialType.JsObject) {
mappedType = types.nonNullExact(commonElements.objectClass);
} else if (type == commonElements.stringType) {
mappedType = types.stringType;
diff --git a/pkg/compiler/lib/src/js_backend/annotations.dart b/pkg/compiler/lib/src/js_backend/annotations.dart
index 025f6d8..bd195e7 100644
--- a/pkg/compiler/lib/src/js_backend/annotations.dart
+++ b/pkg/compiler/lib/src/js_backend/annotations.dart
@@ -9,7 +9,7 @@
import '../diagnostics/diagnostic_listener.dart';
import '../diagnostics/messages.dart';
import '../elements/entities.dart';
-import '../native/native.dart' as native;
+import '../kernel/dart2js_target.dart';
import '../serialization/serialization.dart';
/// Returns `true` if parameter and returns types should be trusted for
@@ -69,7 +69,7 @@
FunctionEntity method = element;
LibraryEntity library = element.library;
bool platformAnnotationsAllowed = library.canonicalUri.scheme == 'dart' ||
- native.maybeEnableNative(library.canonicalUri);
+ maybeEnableNative(library.canonicalUri);
bool hasNoThrows = false;
bool hasNoSideEffects = false;
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index bb4e6b2..360666b 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -26,7 +26,8 @@
import '../js/rewrite_async.dart';
import '../js_emitter/js_emitter.dart' show CodeEmitterTask;
import '../js_emitter/sorter.dart' show Sorter;
-import '../native/native.dart' as native;
+import '../kernel/dart2js_target.dart';
+import '../native/enqueue.dart';
import '../ssa/ssa.dart' show SsaFunctionCompiler;
import '../tracer.dart';
import '../types/types.dart';
@@ -379,8 +380,8 @@
final SuperMemberData superMemberData = new SuperMemberData();
- native.NativeResolutionEnqueuer _nativeResolutionEnqueuer;
- native.NativeCodegenEnqueuer _nativeCodegenEnqueuer;
+ NativeResolutionEnqueuer _nativeResolutionEnqueuer;
+ NativeCodegenEnqueuer _nativeCodegenEnqueuer;
Tracer tracer;
@@ -541,7 +542,7 @@
compiler.frontendStrategy.createRuntimeTypesNeedBuilder();
BackendImpacts impacts =
new BackendImpacts(compiler.options, commonElements);
- _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer(
+ _nativeResolutionEnqueuer = new NativeResolutionEnqueuer(
compiler.options,
elementEnvironment,
commonElements,
@@ -624,7 +625,7 @@
commonElements,
elementEnvironment,
closedWorld.nativeData);
- _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer(
+ _nativeCodegenEnqueuer = new NativeCodegenEnqueuer(
compiler.options,
elementEnvironment,
commonElements,
@@ -694,10 +695,10 @@
return worldImpact;
}
- native.NativeResolutionEnqueuer get nativeResolutionEnqueuerForTesting =>
+ NativeResolutionEnqueuer get nativeResolutionEnqueuerForTesting =>
_nativeResolutionEnqueuer;
- native.NativeEnqueuer get nativeCodegenEnqueuer => _nativeCodegenEnqueuer;
+ NativeEnqueuer get nativeCodegenEnqueuer => _nativeCodegenEnqueuer;
/**
* Unit test hook that returns code of an element as a String.
@@ -741,7 +742,7 @@
void setAnnotations(LibraryEntity library) {
AnnotationProcessor processor =
compiler.frontendStrategy.annotationProcesser;
- if (native.maybeEnableNative(library.canonicalUri)) {
+ if (maybeEnableNative(library.canonicalUri)) {
processor.extractNativeAnnotations(library);
}
processor.extractJsInteropAnnotations(library);
diff --git a/pkg/compiler/lib/src/js_backend/impact_transformer.dart b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
index 282086e..73b9075 100644
--- a/pkg/compiler/lib/src/js_backend/impact_transformer.dart
+++ b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
@@ -16,7 +16,7 @@
import '../elements/entities.dart';
import '../elements/types.dart';
import '../native/enqueue.dart';
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../options.dart';
import '../universe/feature.dart';
import '../universe/use.dart'
@@ -286,7 +286,7 @@
}
}
- for (native.NativeBehavior behavior in worldImpact.nativeData) {
+ for (NativeBehavior behavior in worldImpact.nativeData) {
_nativeResolutionEnqueuer.registerNativeBehavior(
transformed, behavior, worldImpact);
}
diff --git a/pkg/compiler/lib/src/js_model/element_map.dart b/pkg/compiler/lib/src/js_model/element_map.dart
index 5d1215e..a342420 100644
--- a/pkg/compiler/lib/src/js_model/element_map.dart
+++ b/pkg/compiler/lib/src/js_model/element_map.dart
@@ -18,7 +18,7 @@
import '../js_emitter/code_emitter_task.dart';
import '../js_model/closure.dart' show JRecordField;
import '../js_model/elements.dart' show JGeneratorBody;
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../serialization/serialization.dart';
import '../ssa/type_builder.dart';
import '../types/abstract_value_domain.dart';
@@ -92,16 +92,15 @@
Name getName(ir.Name name);
/// Computes the [native.NativeBehavior] for a call to the [JS] function.
- native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
+ NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
/// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
/// function.
- native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
- ir.StaticInvocation node);
+ NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node);
/// Computes the [native.NativeBehavior] for a call to the
/// [JS_EMBEDDED_GLOBAL] function.
- native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
+ NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node);
/// Returns the [js.Name] for the `JsGetName` [constant] value.
@@ -220,7 +219,7 @@
/// Returns the returned type annotation in the [nativeBehavior].
AbstractValue typeFromNativeBehavior(
- native.NativeBehavior nativeBehavior, JClosedWorld closedWorld);
+ NativeBehavior nativeBehavior, JClosedWorld closedWorld);
}
/// Map from kernel IR nodes to local entities.
diff --git a/pkg/compiler/lib/src/js_model/element_map_impl.dart b/pkg/compiler/lib/src/js_model/element_map_impl.dart
index b621427..07c24f3 100644
--- a/pkg/compiler/lib/src/js_model/element_map_impl.dart
+++ b/pkg/compiler/lib/src/js_model/element_map_impl.dart
@@ -41,7 +41,7 @@
import '../kernel/element_map_impl.dart';
import '../kernel/env.dart';
import '../kernel/kelements.dart';
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../options.dart';
import '../ordered_typeset.dart';
import '../serialization/serialization.dart';
@@ -1160,16 +1160,16 @@
/// Looks up [typeName] for use in the spec-string of a `JS` call.
// TODO(johnniwinther): Use this in [native.NativeBehavior] instead of calling
// the `ForeignResolver`.
- native.TypeLookup typeLookup({bool resolveAsRaw: true}) {
+ TypeLookup typeLookup({bool resolveAsRaw: true}) {
return resolveAsRaw
? (_cachedTypeLookupRaw ??= _typeLookup(resolveAsRaw: true))
: (_cachedTypeLookupFull ??= _typeLookup(resolveAsRaw: false));
}
- native.TypeLookup _cachedTypeLookupRaw;
- native.TypeLookup _cachedTypeLookupFull;
+ TypeLookup _cachedTypeLookupRaw;
+ TypeLookup _cachedTypeLookupFull;
- native.TypeLookup _typeLookup({bool resolveAsRaw: true}) {
+ TypeLookup _typeLookup({bool resolveAsRaw: true}) {
bool cachedMayLookupInMain;
bool mayLookupInMain() {
var mainUri = elementEnvironment.mainLibrary.canonicalUri;
@@ -1234,28 +1234,28 @@
/// Computes the [native.NativeBehavior] for a call to the [JS] function.
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
+ NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 2 ||
node.arguments.named.isNotEmpty) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS);
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS_FIRST);
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String codeString = _getStringArgument(node, 1);
if (codeString == null) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS_SECOND);
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
- return native.NativeBehavior.ofJsCall(
+ return NativeBehavior.ofJsCall(
specString,
codeString,
typeLookup(resolveAsRaw: true),
@@ -1264,28 +1264,27 @@
commonElements);
}
- /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
+ /// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
/// function.
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
- ir.StaticInvocation node) {
+ NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS builtin expression has no type.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
if (node.arguments.positional.length < 2) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS builtin is missing name.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "Unexpected first argument.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
- return native.NativeBehavior.ofJsBuiltinCall(
+ return NativeBehavior.ofJsBuiltinCall(
specString,
typeLookup(resolveAsRaw: true),
CURRENT_ELEMENT_SPANNABLE,
@@ -1293,34 +1292,34 @@
commonElements);
}
- /// Computes the [native.NativeBehavior] for a call to the
+ /// Computes the [NativeBehavior] for a call to the
/// [JS_EMBEDDED_GLOBAL] function.
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
+ NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"JS embedded global expression has no type.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
if (node.arguments.positional.length < 2) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS embedded global is missing name.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
if (node.arguments.positional.length > 2 ||
node.arguments.named.isNotEmpty) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"JS embedded global has more than 2 arguments.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "Unexpected first argument.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
- return native.NativeBehavior.ofJsEmbeddedGlobalCall(
+ return NativeBehavior.ofJsEmbeddedGlobalCall(
specString,
typeLookup(resolveAsRaw: true),
CURRENT_ELEMENT_SPANNABLE,
@@ -2411,8 +2410,8 @@
}
}
-/// [native.BehaviorBuilder] for kernel based elements.
-class JsBehaviorBuilder extends native.BehaviorBuilder {
+/// [BehaviorBuilder] for kernel based elements.
+class JsBehaviorBuilder extends BehaviorBuilder {
final ElementEnvironment elementEnvironment;
final CommonElements commonElements;
final DiagnosticReporter reporter;
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index 2187722..9ab34db 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -2,15 +2,44 @@
// 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.
+// TODO(johnniwinther): Add a test that ensure that this library doesn't depend
+// on the dart2js internals.
library compiler.src.kernel.dart2js_target;
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/core_types.dart';
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/target/targets.dart';
+import 'invocation_mirror_constants.dart';
-import '../native/native.dart' show maybeEnableNative;
-import '../universe/selector.dart';
+const Iterable<String> _allowedDartSchemePaths = const <String>[
+ 'async',
+ 'html',
+ 'html_common',
+ 'indexed_db',
+ 'js',
+ 'js_util',
+ 'svg',
+ '_native_typed_data',
+ 'web_audio',
+ 'web_gl',
+ 'web_sql'
+];
+
+bool maybeEnableNative(Uri uri) {
+ bool allowedTestLibrary() {
+ String scriptName = uri.path;
+ return scriptName.contains('tests/compiler/dart2js_native') ||
+ scriptName.contains('tests/compiler/dart2js_extra');
+ }
+
+ bool allowedDartLibrary() {
+ if (uri.scheme != 'dart') return false;
+ return _allowedDartSchemePaths.contains(uri.path);
+ }
+
+ return allowedTestLibrary() || allowedDartLibrary();
+}
/// A kernel [Target] to configure the Dart Front End for dart2js.
class Dart2jsTarget extends Target {
@@ -59,13 +88,13 @@
bool isSuper) {
int kind;
if (name.startsWith('get:')) {
- kind = Selector.invocationMirrorGetterKind;
+ kind = invocationMirrorGetterKind;
name = name.substring(4);
} else if (name.startsWith('set:')) {
- kind = Selector.invocationMirrorSetterKind;
+ kind = invocationMirrorSetterKind;
name = name.substring(4);
} else {
- kind = Selector.invocationMirrorMethodKind;
+ kind = invocationMirrorMethodKind;
}
return new ir.StaticInvocation(
coreTypes.index
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index 5edfd7d..9533b15 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -13,7 +13,7 @@
import '../js/js.dart' as js;
import '../js_backend/namer.dart';
import '../js_backend/native_data.dart';
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../universe/call_structure.dart';
import '../universe/selector.dart';
@@ -86,17 +86,16 @@
/// Returns the [Name] corresponding to [name].
Name getName(ir.Name name);
- /// Computes the [native.NativeBehavior] for a call to the [JS] function.
- native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
+ /// Computes the [NativeBehavior] for a call to the [JS] function.
+ NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
- /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
+ /// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
/// function.
- native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
- ir.StaticInvocation node);
+ NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node);
- /// Computes the [native.NativeBehavior] for a call to the
+ /// Computes the [NativeBehavior] for a call to the
/// [JS_EMBEDDED_GLOBAL] function.
- native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
+ NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node);
/// Returns the [js.Name] for the `JsGetName` [constant] value.
@@ -147,15 +146,15 @@
bool isNativeClass(ir.Class node);
/// Computes the native behavior for reading the native [field].
- native.NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
+ NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
{bool isJsInterop});
/// Computes the native behavior for writing to the native [field].
- native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field);
+ NativeBehavior getNativeBehaviorForFieldStore(ir.Field field);
/// Computes the native behavior for calling the function or constructor
/// [member].
- native.NativeBehavior getNativeBehaviorForMethod(ir.Member member,
+ NativeBehavior getNativeBehaviorForMethod(ir.Member member,
{bool isJsInterop});
/// Compute the kind of foreign helper function called by [node], if any.
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index d0cacf4..ec2f758 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -41,7 +41,8 @@
import '../js_backend/native_data.dart';
import '../js_backend/no_such_method_registry.dart';
import '../js_model/locals.dart';
-import '../native/native.dart' as native;
+import '../kernel/dart2js_target.dart';
+import '../native/behavior.dart';
import '../native/resolver.dart';
import '../options.dart';
import '../ordered_typeset.dart';
@@ -104,7 +105,7 @@
final Map<ir.Field, IndexedField> fieldMap = {};
final Map<ir.TreeNode, Local> localFunctionMap = {};
- native.BehaviorBuilder _nativeBehaviorBuilder;
+ BehaviorBuilder _nativeBehaviorBuilder;
FrontendStrategy _frontendStrategy;
Map<KMember, Map<ir.TreeNode, ir.DartType>> staticTypeCacheForTesting;
@@ -817,18 +818,18 @@
}
/// Looks up [typeName] for use in the spec-string of a `JS` call.
- // TODO(johnniwinther): Use this in [native.NativeBehavior] instead of calling
+ // TODO(johnniwinther): Use this in [NativeBehavior] instead of calling
// the `ForeignResolver`.
- native.TypeLookup typeLookup({bool resolveAsRaw: true}) {
+ TypeLookup typeLookup({bool resolveAsRaw: true}) {
return resolveAsRaw
? (_cachedTypeLookupRaw ??= _typeLookup(resolveAsRaw: true))
: (_cachedTypeLookupFull ??= _typeLookup(resolveAsRaw: false));
}
- native.TypeLookup _cachedTypeLookupRaw;
- native.TypeLookup _cachedTypeLookupFull;
+ TypeLookup _cachedTypeLookupRaw;
+ TypeLookup _cachedTypeLookupFull;
- native.TypeLookup _typeLookup({bool resolveAsRaw: true}) {
+ TypeLookup _typeLookup({bool resolveAsRaw: true}) {
bool cachedMayLookupInMain;
bool mayLookupInMain() {
var mainUri = elementEnvironment.mainLibrary.canonicalUri;
@@ -891,30 +892,30 @@
return node.arguments.positional[index].accept(new Stringifier());
}
- /// Computes the [native.NativeBehavior] for a call to the [JS] function.
+ /// Computes the [NativeBehavior] for a call to the [JS] function.
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
+ NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 2 ||
node.arguments.named.isNotEmpty) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS);
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS_FIRST);
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String codeString = _getStringArgument(node, 1);
if (codeString == null) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS_SECOND);
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
- return native.NativeBehavior.ofJsCall(
+ return NativeBehavior.ofJsCall(
specString,
codeString,
typeLookup(resolveAsRaw: true),
@@ -923,28 +924,27 @@
commonElements);
}
- /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
+ /// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
/// function.
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
- ir.StaticInvocation node) {
+ NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS builtin expression has no type.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
if (node.arguments.positional.length < 2) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS builtin is missing name.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "Unexpected first argument.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
- return native.NativeBehavior.ofJsBuiltinCall(
+ return NativeBehavior.ofJsBuiltinCall(
specString,
typeLookup(resolveAsRaw: true),
CURRENT_ELEMENT_SPANNABLE,
@@ -952,34 +952,34 @@
commonElements);
}
- /// Computes the [native.NativeBehavior] for a call to the
+ /// Computes the [NativeBehavior] for a call to the
/// [JS_EMBEDDED_GLOBAL] function.
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
+ NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"JS embedded global expression has no type.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
if (node.arguments.positional.length < 2) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS embedded global is missing name.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
if (node.arguments.positional.length > 2 ||
node.arguments.named.isNotEmpty) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"JS embedded global has more than 2 arguments.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "Unexpected first argument.");
- return new native.NativeBehavior();
+ return new NativeBehavior();
}
- return native.NativeBehavior.ofJsEmbeddedGlobalCall(
+ return NativeBehavior.ofJsEmbeddedGlobalCall(
specString,
typeLookup(resolveAsRaw: true),
CURRENT_ELEMENT_SPANNABLE,
@@ -1332,7 +1332,7 @@
env.addComponent(component);
}
- native.BehaviorBuilder get nativeBehaviorBuilder =>
+ BehaviorBuilder get nativeBehaviorBuilder =>
_nativeBehaviorBuilder ??= new KernelBehaviorBuilder(elementEnvironment,
commonElements, nativeBasicData, reporter, options);
@@ -1505,7 +1505,7 @@
/// Computes the native behavior for reading the native [field].
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
+ NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
{bool isJsInterop}) {
DartType type = getDartType(field.type);
List<ConstantValue> metadata = getMetadata(field.annotations);
@@ -1516,14 +1516,14 @@
/// Computes the native behavior for writing to the native [field].
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) {
+ NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) {
DartType type = getDartType(field.type);
return nativeBehaviorBuilder.buildFieldStoreBehavior(type);
}
/// Computes the native behavior for calling [member].
// TODO(johnniwinther): Cache this for later use.
- native.NativeBehavior getNativeBehaviorForMethod(ir.Member member,
+ NativeBehavior getNativeBehaviorForMethod(ir.Member member,
{bool isJsInterop}) {
DartType type;
if (member is ir.Procedure) {
@@ -1891,8 +1891,8 @@
}
}
-/// [native.BehaviorBuilder] for kernel based elements.
-class KernelBehaviorBuilder extends native.BehaviorBuilder {
+/// [BehaviorBuilder] for kernel based elements.
+class KernelBehaviorBuilder extends BehaviorBuilder {
final ElementEnvironment elementEnvironment;
final CommonElements commonElements;
final DiagnosticReporter reporter;
@@ -1998,14 +1998,13 @@
CommonElements get commonElements => elementMap.commonElements;
@override
- native.NativeBehavior computeNativeFieldStoreBehavior(
- covariant KField field) {
+ NativeBehavior computeNativeFieldStoreBehavior(covariant KField field) {
ir.Field node = elementMap.getMemberNode(field);
return elementMap.getNativeBehaviorForFieldStore(node);
}
@override
- native.NativeBehavior computeNativeFieldLoadBehavior(covariant KField field,
+ NativeBehavior computeNativeFieldLoadBehavior(covariant KField field,
{bool isJsInterop}) {
ir.Field node = elementMap.getMemberNode(field);
return elementMap.getNativeBehaviorForFieldLoad(node,
@@ -2013,8 +2012,7 @@
}
@override
- native.NativeBehavior computeNativeMethodBehavior(
- covariant KFunction function,
+ NativeBehavior computeNativeMethodBehavior(covariant KFunction function,
{bool isJsInterop}) {
ir.Member node = elementMap.getMemberNode(function);
return elementMap.getNativeBehaviorForMethod(node,
@@ -2023,7 +2021,7 @@
@override
bool isNativeMethod(covariant KFunction function) {
- if (!native.maybeEnableNative(function.library.canonicalUri)) return false;
+ if (!maybeEnableNative(function.library.canonicalUri)) return false;
ir.Member node = elementMap.getMemberNode(function);
return node.annotations.any((ir.Expression expression) {
return expression is ir.ConstructorInvocation &&
diff --git a/pkg/compiler/lib/src/kernel/invocation_mirror_constants.dart b/pkg/compiler/lib/src/kernel/invocation_mirror_constants.dart
new file mode 100644
index 0000000..246429e
--- /dev/null
+++ b/pkg/compiler/lib/src/kernel/invocation_mirror_constants.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2018, 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.
+
+const int invocationMirrorMethodKind = 0;
+const int invocationMirrorGetterKind = 1;
+const int invocationMirrorSetterKind = 2;
diff --git a/pkg/compiler/lib/src/native/native.dart b/pkg/compiler/lib/src/native/native.dart
deleted file mode 100644
index ae0ce99..0000000
--- a/pkg/compiler/lib/src/native/native.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2012, 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.
-
-library native;
-
-export 'behavior.dart';
-export 'enqueue.dart';
-export 'js.dart';
-
-const Iterable<String> _allowedDartSchemePaths = const <String>[
- 'async',
- 'html',
- 'html_common',
- 'indexed_db',
- 'js',
- 'js_util',
- 'svg',
- '_native_typed_data',
- 'web_audio',
- 'web_gl',
- 'web_sql'
-];
-
-bool maybeEnableNative(Uri uri) {
- bool allowedTestLibrary() {
- String scriptName = uri.path;
- return scriptName.contains('tests/compiler/dart2js_native') ||
- scriptName.contains('tests/compiler/dart2js_extra');
- }
-
- bool allowedDartLibary() {
- if (uri.scheme != 'dart') return false;
- return _allowedDartSchemePaths.contains(uri.path);
- }
-
- return allowedTestLibrary() || allowedDartLibary();
-}
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index bea9f23..d9a0664 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -32,7 +32,9 @@
import '../js_model/elements.dart' show JGeneratorBody;
import '../js_model/element_map.dart';
import '../js_model/js_strategy.dart';
-import '../native/native.dart' as native;
+import '../kernel/invocation_mirror_constants.dart';
+import '../native/behavior.dart';
+import '../native/js.dart';
import '../types/abstract_value_domain.dart';
import '../types/types.dart';
import '../universe/call_structure.dart';
@@ -2484,7 +2486,7 @@
js.Template code = js.js.parseForeignJS('#');
push(new HForeignCode(code, abstractValueDomain.boolType,
[localsHandler.readLocal(switchTarget)],
- nativeBehavior: native.NativeBehavior.PURE));
+ nativeBehavior: NativeBehavior.PURE));
}
handleIf(
@@ -3394,7 +3396,7 @@
lengthInput = conversion;
}
js.Template code = js.js.parseForeignJS('new Array(#)');
- var behavior = new native.NativeBehavior();
+ var behavior = new NativeBehavior();
var expectedType =
_elementMap.getDartType(invocation.getStaticType(null));
@@ -3417,9 +3419,8 @@
HForeignCode foreign = new HForeignCode(
code, resultType, <HInstruction>[lengthInput],
nativeBehavior: behavior,
- throwBehavior: canThrow
- ? native.NativeThrowBehavior.MAY
- : native.NativeThrowBehavior.NEVER)
+ throwBehavior:
+ canThrow ? NativeThrowBehavior.MAY : NativeThrowBehavior.NEVER)
..sourceInformation = sourceInformation;
push(foreign);
// TODO(redemption): Global type analysis tracing may have determined that
@@ -3430,7 +3431,7 @@
// We set the instruction as [canThrow] to avoid it being dead code.
// We need a finer grained side effect.
add(new HForeignCode(code, abstractValueDomain.nullType, [stack.last],
- throwBehavior: native.NativeThrowBehavior.MAY));
+ throwBehavior: NativeThrowBehavior.MAY));
}
} else if (isGrowableListConstructorCall) {
push(buildLiteralList(<HInstruction>[]));
@@ -3612,13 +3613,13 @@
Name memberName = new Name(name, _currentFrame.member.library);
Selector selector;
switch (kindLiteral.value) {
- case Selector.invocationMirrorGetterKind:
+ case invocationMirrorGetterKind:
selector = new Selector.getter(memberName);
break;
- case Selector.invocationMirrorSetterKind:
+ case invocationMirrorSetterKind:
selector = new Selector.setter(memberName);
break;
- case Selector.invocationMirrorMethodKind:
+ case invocationMirrorMethodKind:
if (memberName == Names.INDEX_NAME) {
selector = new Selector.index();
} else if (memberName == Names.INDEX_SET_NAME) {
@@ -3811,7 +3812,7 @@
.staticFunctionAccess(_elementMap.getMethod(staticTarget))),
abstractValueDomain.dynamicType,
<HInstruction>[],
- nativeBehavior: native.NativeBehavior.PURE,
+ nativeBehavior: NativeBehavior.PURE,
foreignFunction: _elementMap.getMethod(staticTarget)));
return;
}
@@ -3843,8 +3844,7 @@
sideEffects.setAllSideEffects();
push(new HForeignCode(js.js.parseForeignJS("$isolateName = #"),
abstractValueDomain.dynamicType, inputs,
- nativeBehavior: native.NativeBehavior.CHANGES_OTHER,
- effects: sideEffects));
+ nativeBehavior: NativeBehavior.CHANGES_OTHER, effects: sideEffects));
}
void handleForeignJsGetStaticState(ir.StaticInvocation invocation) {
@@ -3857,7 +3857,7 @@
push(new HForeignCode(js.js.parseForeignJS(namer.staticStateHolder),
abstractValueDomain.dynamicType, <HInstruction>[],
- nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
+ nativeBehavior: NativeBehavior.DEPENDS_OTHER));
}
void handleForeignJsGetName(ir.StaticInvocation invocation) {
@@ -3899,7 +3899,7 @@
js.Template expr = js.js.expressionTemplateYielding(
emitter.generateEmbeddedGlobalAccess(globalName));
- native.NativeBehavior nativeBehavior =
+ NativeBehavior nativeBehavior =
_elementMap.getNativeBehaviorForJsEmbeddedGlobalCall(invocation);
assert(
nativeBehavior != null,
@@ -3946,7 +3946,7 @@
inputs.add(pop());
}
- native.NativeBehavior nativeBehavior =
+ NativeBehavior nativeBehavior =
_elementMap.getNativeBehaviorForJsBuiltinCall(invocation);
assert(
nativeBehavior != null,
@@ -4037,7 +4037,7 @@
return;
}
- native.NativeBehavior nativeBehavior =
+ NativeBehavior nativeBehavior =
_elementMap.getNativeBehaviorForJsCall(invocation);
assert(
nativeBehavior != null,
@@ -4062,7 +4062,7 @@
return;
}
- if (native.HasCapturedPlaceholders.check(nativeBehavior.codeTemplate.ast)) {
+ if (HasCapturedPlaceholders.check(nativeBehavior.codeTemplate.ast)) {
reporter.reportErrorMessage(
_elementMap.getSpannable(targetElement, invocation),
MessageKind.JS_PLACEHOLDER_CAPTURE);
@@ -4256,8 +4256,7 @@
var codeTemplate =
new js.Template(null, js.objectLiteral(parameterNameMap));
- var nativeBehavior = new native.NativeBehavior()
- ..codeTemplate = codeTemplate;
+ var nativeBehavior = new NativeBehavior()..codeTemplate = codeTemplate;
if (options.trustJSInteropTypeAnnotations) {
InterfaceType thisType = _elementMap.elementEnvironment
.getThisType(constructor.enclosingClass);
@@ -4282,8 +4281,7 @@
arguments = arguments.where((arg) => arg != null).toList();
var inputs = <HInstruction>[target]..addAll(arguments);
- var nativeBehavior = new native.NativeBehavior()
- ..sideEffects.setAllSideEffects();
+ var nativeBehavior = new NativeBehavior()..sideEffects.setAllSideEffects();
DartType type = element is ConstructorEntity
? _elementMap.elementEnvironment.getThisType(element.enclosingClass)
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index bcfe386..c6f57d2 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -27,7 +27,8 @@
import '../js_backend/runtime_types.dart';
import '../js_emitter/code_emitter_task.dart';
import '../js_model/elements.dart' show JGeneratorBody;
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
+import '../native/enqueue.dart';
import '../options.dart';
import '../types/abstract_value_domain.dart';
import '../universe/call_structure.dart' show CallStructure;
@@ -157,7 +158,7 @@
final CompilerOptions _options;
final CodeEmitterTask _emitter;
- final native.NativeCodegenEnqueuer _nativeEnqueuer;
+ final NativeCodegenEnqueuer _nativeEnqueuer;
final CheckedModeHelpers _checkedModeHelpers;
final OneShotInterceptorData _oneShotInterceptorData;
final RuntimeTypesSubstitutions _rtiSubstitutions;
@@ -2215,7 +2216,7 @@
}
void registerForeignTypes(HForeign node) {
- native.NativeBehavior nativeBehavior = node.nativeBehavior;
+ NativeBehavior nativeBehavior = node.nativeBehavior;
if (nativeBehavior == null) return;
_nativeEnqueuer.registerNativeBehavior(
_registry.worldImpact, nativeBehavior, node);
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index b3c93c2..222f33d 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -16,7 +16,7 @@
import '../io/source_information.dart';
import '../js/js.dart' as js;
import '../js_backend/js_backend.dart';
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../types/abstract_value_domain.dart';
import '../universe/selector.dart' show Selector;
import '../universe/side_effects.dart' show SideEffects;
@@ -2055,7 +2055,7 @@
HForeign(AbstractValue type, List<HInstruction> inputs) : super(inputs, type);
bool get isStatement => false;
- native.NativeBehavior get nativeBehavior => null;
+ NativeBehavior get nativeBehavior => null;
bool canThrow(AbstractValueDomain domain) {
return sideEffects.hasSideEffects() || sideEffects.dependsOnSomething();
@@ -2065,15 +2065,15 @@
class HForeignCode extends HForeign {
final js.Template codeTemplate;
final bool isStatement;
- final native.NativeBehavior nativeBehavior;
- native.NativeThrowBehavior throwBehavior;
+ final NativeBehavior nativeBehavior;
+ NativeThrowBehavior throwBehavior;
final FunctionEntity foreignFunction;
HForeignCode(this.codeTemplate, AbstractValue type, List<HInstruction> inputs,
{this.isStatement: false,
SideEffects effects,
- native.NativeBehavior nativeBehavior,
- native.NativeThrowBehavior throwBehavior,
+ NativeBehavior nativeBehavior,
+ NativeThrowBehavior throwBehavior,
this.foreignFunction})
: this.nativeBehavior = nativeBehavior,
this.throwBehavior = throwBehavior,
@@ -2084,7 +2084,7 @@
}
if (this.throwBehavior == null) {
this.throwBehavior = (nativeBehavior == null)
- ? native.NativeThrowBehavior.MAY
+ ? NativeThrowBehavior.MAY
: nativeBehavior.throwBehavior;
}
assert(this.throwBehavior != null);
@@ -2095,12 +2095,8 @@
}
}
- HForeignCode.statement(
- js.Template codeTemplate,
- List<HInstruction> inputs,
- SideEffects effects,
- native.NativeBehavior nativeBehavior,
- AbstractValue type)
+ HForeignCode.statement(js.Template codeTemplate, List<HInstruction> inputs,
+ SideEffects effects, NativeBehavior nativeBehavior, AbstractValue type)
: this(codeTemplate, type, inputs,
isStatement: true,
effects: effects,
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 67455a8..e4b5eab 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -16,7 +16,7 @@
import '../js_backend/backend.dart';
import '../js_backend/native_data.dart' show NativeData;
import '../js_backend/runtime_types.dart';
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../options.dart';
import '../types/abstract_value_domain.dart';
import '../types/types.dart';
@@ -770,8 +770,7 @@
// Strengthen instruction type from annotations to help optimize
// dependent instructions.
- native.NativeBehavior nativeBehavior =
- _nativeData.getNativeMethodBehavior(method);
+ NativeBehavior nativeBehavior = _nativeData.getNativeMethodBehavior(method);
AbstractValue returnType =
AbstractValueFactory.fromNativeBehavior(nativeBehavior, _closedWorld);
HInvokeDynamicMethod result = new HInvokeDynamicMethod(
diff --git a/pkg/compiler/lib/src/ssa/types.dart b/pkg/compiler/lib/src/ssa/types.dart
index 39fd61c..8519ee9 100644
--- a/pkg/compiler/lib/src/ssa/types.dart
+++ b/pkg/compiler/lib/src/ssa/types.dart
@@ -4,7 +4,7 @@
import '../common_elements.dart' show CommonElements;
import '../elements/entities.dart';
-import '../native/native.dart' as native;
+import '../native/behavior.dart';
import '../types/abstract_value_domain.dart';
import '../types/types.dart';
import '../universe/selector.dart' show Selector;
@@ -36,7 +36,7 @@
}
static AbstractValue fromNativeBehavior(
- native.NativeBehavior nativeBehavior, JClosedWorld closedWorld) {
+ NativeBehavior nativeBehavior, JClosedWorld closedWorld) {
AbstractValueDomain abstractValueDomain = closedWorld.abstractValueDomain;
var typesReturned = nativeBehavior.typesReturned;
if (typesReturned.isEmpty) return abstractValueDomain.dynamicType;
@@ -46,7 +46,7 @@
// [type] is either an instance of [DartType] or special objects
// like [native.SpecialType.JsObject].
AbstractValue fromNativeType(dynamic type) {
- if (type == native.SpecialType.JsObject) {
+ if (type == SpecialType.JsObject) {
return abstractValueDomain
.createNonNullExact(commonElements.objectClass);
} else if (type.isVoid) {
diff --git a/pkg/compiler/lib/src/universe/selector.dart b/pkg/compiler/lib/src/universe/selector.dart
index acc7100..42cac09 100644
--- a/pkg/compiler/lib/src/universe/selector.dart
+++ b/pkg/compiler/lib/src/universe/selector.dart
@@ -10,6 +10,7 @@
import '../elements/entity_utils.dart' as utils;
import '../elements/names.dart';
import '../elements/operators.dart';
+import '../kernel/invocation_mirror_constants.dart';
import '../serialization/serialization.dart';
import '../util/util.dart' show Hashing;
import 'call_structure.dart' show CallStructure;
@@ -237,10 +238,6 @@
*/
String get invocationMirrorMemberName => isSetter ? '$name=' : name;
- static const int invocationMirrorMethodKind = 0;
- static const int invocationMirrorGetterKind = 1;
- static const int invocationMirrorSetterKind = 2;
-
int get invocationMirrorKind {
int kind = invocationMirrorMethodKind;
if (isGetter) {
diff --git a/tests/compiler/dart2js/js/js_spec_string_test.dart b/tests/compiler/dart2js/js/js_spec_string_test.dart
index 4f301af..1e7080d 100644
--- a/tests/compiler/dart2js/js/js_spec_string_test.dart
+++ b/tests/compiler/dart2js/js/js_spec_string_test.dart
@@ -5,7 +5,7 @@
// Unit test of the [NativeBehavior.processSpecString] method.
import 'package:expect/expect.dart';
-import 'package:compiler/src/native/native.dart';
+import 'package:compiler/src/native/behavior.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:compiler/src/universe/side_effects.dart' show SideEffects;
diff --git a/tests/compiler/dart2js/js/js_throw_behavior_test.dart b/tests/compiler/dart2js/js/js_throw_behavior_test.dart
index e0b75b9..22fb733 100644
--- a/tests/compiler/dart2js/js/js_throw_behavior_test.dart
+++ b/tests/compiler/dart2js/js/js_throw_behavior_test.dart
@@ -3,7 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:expect/expect.dart';
-import 'package:compiler/src/native/native.dart';
+import 'package:compiler/src/native/behavior.dart';
+import 'package:compiler/src/native/js.dart';
import 'package:compiler/src/js/js.dart' as js;
void test(String source, NativeThrowBehavior expectedThrowBehavior) {