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

Side by Side 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, 10 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 unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 CoreTypes get coreTypes => compiler.coreTypes; 552 CoreTypes get coreTypes => compiler.coreTypes;
553 553
554 Resolution get resolution => compiler.resolution; 554 Resolution get resolution => compiler.resolution;
555 555
556 /// Returns constant environment for the JavaScript interpretation of the 556 /// Returns constant environment for the JavaScript interpretation of the
557 /// constants. 557 /// constants.
558 JavaScriptConstantCompiler get constants { 558 JavaScriptConstantCompiler get constants {
559 return constantCompilerTask.jsConstantCompiler; 559 return constantCompilerTask.jsConstantCompiler;
560 } 560 }
561 561
562 FunctionElement resolveExternalFunction(FunctionElement element) { 562 MethodElement resolveExternalFunction(MethodElement element) {
563 if (isForeign(element) || isJsInterop(element)) return element; 563 if (isForeign(element)) {
564 return element;
565 }
566 if (isJsInterop(element)) {
567 if (element.memberName == const PublicName('[]') ||
568 element.memberName == const PublicName('[]=')) {
569 reporter.reportErrorMessage(element,
570 MessageKind.JS_INTEROP_INDEX_NOT_SUPPORTED);
571 }
572 return element;
573 }
564 return patchResolverTask.measure(() { 574 return patchResolverTask.measure(() {
565 return patchResolverTask.resolveExternalFunction(element); 575 return patchResolverTask.resolveExternalFunction(element);
566 }); 576 });
567 } 577 }
568 578
569 bool isForeign(Element element) => element.library == helpers.foreignLibrary; 579 bool isForeign(Element element) => element.library == helpers.foreignLibrary;
570 580
571 bool isBackendLibrary(LibraryElement library) { 581 bool isBackendLibrary(LibraryElement library) {
572 return library == helpers.interceptorsLibrary || 582 return library == helpers.interceptorsLibrary ||
573 library == helpers.jsHelperLibrary; 583 library == helpers.jsHelperLibrary;
(...skipping 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3172 } 3182 }
3173 } 3183 }
3174 3184
3175 @override 3185 @override
3176 void onImpactUsed(ImpactUseCase impactUse) { 3186 void onImpactUsed(ImpactUseCase impactUse) {
3177 if (impactUse == DeferredLoadTask.IMPACT_USE) { 3187 if (impactUse == DeferredLoadTask.IMPACT_USE) {
3178 resolution.emptyCache(); 3188 resolution.emptyCache();
3179 } 3189 }
3180 } 3190 }
3181 } 3191 }
OLDNEW
« 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