| Index: sdk/lib/_internal/compiler/implementation/native_handler.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/native_handler.dart b/sdk/lib/_internal/compiler/implementation/native_handler.dart
|
| index 38577c948c4b4d9eb72308141131e60468c9db0a..f5caa613ec9f0cf6c12aaece4f46a86a157e437e 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/native_handler.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/native_handler.dart
|
| @@ -537,9 +537,28 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
|
|
|
| class NativeResolutionEnqueuer extends NativeEnqueuerBase {
|
|
|
| + Map<String, ClassElement> tagOwner = new Map<String, ClassElement>();
|
| +
|
| NativeResolutionEnqueuer(Enqueuer world, Compiler compiler)
|
| : super(world, compiler, compiler.enableNativeLiveTypeAnalysis);
|
|
|
| + void processNativeClass(ClassElement classElement) {
|
| + super.processNativeClass(classElement);
|
| +
|
| + // Since we map from dispatch tags to classes, a dispatch tag must be used
|
| + // on only one native class.
|
| + for (String tag in nativeTagsOfClass(classElement)) {
|
| + ClassElement owner = tagOwner[tag];
|
| + if (owner != null) {
|
| + compiler.reportError(classElement,
|
| + MessageKind.GENERIC,
|
| + {'text': "Tag '$tag' already in use by '${owner.name}'"});
|
| + } else {
|
| + tagOwner[tag] = classElement;
|
| + }
|
| + }
|
| + }
|
| +
|
| void logSummary(log(message)) {
|
| log('Resolved ${registeredClasses.length} native elements used, '
|
| '${unusedClasses.length} native elements dead.');
|
| @@ -1048,6 +1067,22 @@ String checkForNativeClass(ElementListener listener) {
|
| return nativeTagInfo;
|
| }
|
|
|
| +// The tags string contains comma-separated 'words' which are either dispatch
|
| +// tags (having JavaScript identifier syntax) and directives that begin with
|
| +// `!`.
|
| +List<String> nativeTagsOfClassRaw(ClassElement cls) {
|
| + String quotedName = cls.nativeTagInfo;
|
| + return quotedName.substring(1, quotedName.length - 1).split(',');
|
| +}
|
| +
|
| +List<String> nativeTagsOfClass(ClassElement cls) {
|
| + return nativeTagsOfClassRaw(cls).where((s) => !s.startsWith('!')).toList();
|
| +}
|
| +
|
| +bool nativeTagsForcedNonLeaf(ClassElement cls) =>
|
| + nativeTagsOfClassRaw(cls).contains('!nonleaf');
|
| +
|
| +
|
| final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
|
|
|
| void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
|
|
|