remove dead code from dartdevc/k JS gen
The function `_emitJSType` was unreachable because we already skip JS
interop classes.
Change-Id: I9ee563725d5b2bb539beaa38e61e4435e8e8fcd3
Reviewed-on: https://dart-review.googlesource.com/59561
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 707576a..a4f0d88 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -868,17 +868,6 @@
return _emitClassDeclaration(node, node.element as ClassElement, []);
}
- JS.Statement _emitJSType(Element e) {
- var jsTypeName = getAnnotationName(e, isJSAnnotation);
- if (jsTypeName == null || jsTypeName == e.name) return null;
-
- // We export the JS type as if it was a Dart type. For example this allows
- // `dom.InputElement` to actually be HTMLInputElement.
- // TODO(jmesserly): if we had the JS name on the Element, we could just
- // generate it correctly when we refer to it.
- return js.statement('# = #;', [_emitTopLevelName(e), jsTypeName]);
- }
-
@override
JS.Statement visitClassDeclaration(ClassDeclaration node) {
return _emitClassDeclaration(node, node.element, node.members);
@@ -889,10 +878,6 @@
// If this class is annotated with `@JS`, then there is nothing to emit.
if (_hasJSInteropAnnotation(classElem)) return null;
- // If this is a JavaScript type, emit it now and then exit.
- var jsTypeDef = _emitJSType(classElem);
- if (jsTypeDef != null) return jsTypeDef;
-
// Generic classes will be defined inside a function that closes over the
// type parameter. So we can use their local variable name directly.
//
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index bf7fea8..6a21ffb 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -521,10 +521,6 @@
// If this class is annotated with `@JS`, then there is nothing to emit.
if (findAnnotation(c, isPublicJSAnnotation) != null) return null;
- // If this is a JavaScript type, emit it now and then exit.
- var jsTypeDef = _emitJSType(c);
- if (jsTypeDef != null) return jsTypeDef;
-
// Generic classes will be defined inside a function that closes over the
// type parameter. So we can use their local variable name directly.
//
@@ -1946,17 +1942,6 @@
'registerExtension(#, #)', [js.string(jsPeerName), className]));
}
- JS.Statement _emitJSType(Class c) {
- var jsTypeName = getAnnotationName(c, isJSAnnotation);
- if (jsTypeName == null || jsTypeName == c.name) return null;
-
- // We export the JS type as if it was a Dart type. For example this allows
- // `dom.InputElement` to actually be HTMLInputElement.
- // TODO(jmesserly): if we had the JS name on the Element, we could just
- // generate it correctly when we refer to it.
- return js.statement('# = #;', [_emitTopLevelName(c), jsTypeName]);
- }
-
void _emitTypedef(Typedef t) {
var savedUri = _currentUri;
_currentUri = t.fileUri;