22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- // Used for importing CFE utility functions for constructor tear-offs.
6- import 'package:front_end/src/api_prototype/lowering_predicates.dart' ;
75import 'package:kernel/core_types.dart' ;
86import 'package:kernel/kernel.dart' ;
97import 'package:kernel/target/targets.dart' ;
@@ -23,7 +21,6 @@ import 'package:_fe_analyzer_shared/src/messages/codes.dart'
2321 messageJsInteropOperatorsNotSupported,
2422 messageJsInteropStaticInteropExternalExtensionMembersWithTypeParameters,
2523 messageJsInteropStaticInteropGenerativeConstructor,
26- messageJsInteropStaticInteropSyntheticConstructor,
2724 templateJsInteropDartClassExtendsJSClass,
2825 templateJsInteropNonStaticWithStaticInteropSupertype,
2926 templateJsInteropStaticInteropNoJSAnnotation,
@@ -46,7 +43,6 @@ class JsInteropChecks extends RecursiveVisitor {
4643 bool _classHasJSAnnotation = false ;
4744 bool _classHasAnonymousAnnotation = false ;
4845 bool _classHasStaticInteropAnnotation = false ;
49- bool _inTearoff = false ;
5046 bool _libraryHasJSAnnotation = false ;
5147 Map <Reference , Extension >? _libraryExtensionsIndex;
5248 // TODO(joshualitt): These checks add value for our users, but unfortunately
@@ -373,9 +369,7 @@ class JsInteropChecks extends RecursiveVisitor {
373369 procedure.fileUri);
374370 }
375371 }
376- _inTearoff = isTearOffLowering (procedure);
377372 super .visitProcedure (procedure);
378- _inTearoff = false ;
379373 }
380374
381375 @override
@@ -419,30 +413,6 @@ class JsInteropChecks extends RecursiveVisitor {
419413 }
420414 }
421415
422- @override
423- void visitConstructorInvocation (ConstructorInvocation node) {
424- var constructor = node.target;
425- if (constructor.isSynthetic &&
426- // Synthetic tear-offs are created for synthetic constructors by
427- // invoking them, so they need to be excluded here.
428- ! _inTearoff &&
429- hasStaticInteropAnnotation (constructor.enclosingClass)) {
430- // TODO(srujzs): This is insufficient to disallow use of synthetic
431- // constructors, as tear-offs may be used. However, use of such tear-offs
432- // are lowered as a StaticTearOffConstant. This means that we'll need a
433- // constant visitor in order to handle that correctly. It should be rare
434- // for users to use those tear-offs in favor of just invocation, but it's
435- // plausible. For now, in order to avoid the complexity and the extra
436- // visiting, we don't check tear-off usage.
437- _diagnosticsReporter.report (
438- messageJsInteropStaticInteropSyntheticConstructor,
439- node.fileOffset,
440- node.name.text.length,
441- node.location? .file);
442- }
443- super .visitConstructorInvocation (node);
444- }
445-
446416 /// Reports an error if [functionNode] has named parameters.
447417 void _checkNoNamedParameters (FunctionNode functionNode) {
448418 // ignore: unnecessary_null_comparison
0 commit comments