Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(998)

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1651933002: Report error on JS-interop operator [] and []= methods. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Sort MessageKinds. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 7407ef7a094f4b9a45eb6a160be0965e123c063e..faa4de3e16167b41b6b0d4c23e1eed023f9c085a 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -559,8 +559,18 @@ class JavaScriptBackend extends Backend {
return constantCompilerTask.jsConstantCompiler;
}
- FunctionElement resolveExternalFunction(FunctionElement element) {
- if (isForeign(element) || isJsInterop(element)) return element;
+ MethodElement resolveExternalFunction(MethodElement element) {
+ if (isForeign(element)) {
+ return element;
+ }
+ if (isJsInterop(element)) {
+ if (element.memberName == const PublicName('[]') ||
+ element.memberName == const PublicName('[]=')) {
+ reporter.reportErrorMessage(element,
+ MessageKind.JS_INTEROP_INDEX_NOT_SUPPORTED);
+ }
+ return element;
+ }
return patchResolverTask.measure(() {
return patchResolverTask.resolveExternalFunction(element);
});
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698