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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1911443002: Associate compile-time errors with elements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with 111a794141cd313460e4fe2593cfea9862fe1c0f Created 4 years, 7 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
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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 enqueueClass(enqueuer, cls, registry); 1442 enqueueClass(enqueuer, cls, registry);
1443 } 1443 }
1444 for (BackendImpact otherImpact in impact.otherImpacts) { 1444 for (BackendImpact otherImpact in impact.otherImpacts) {
1445 enqueueImpact(enqueuer, otherImpact, registry); 1445 enqueueImpact(enqueuer, otherImpact, registry);
1446 } 1446 }
1447 } 1447 }
1448 1448
1449 WorldImpact codegen(CodegenWorkItem work) { 1449 WorldImpact codegen(CodegenWorkItem work) {
1450 Element element = work.element; 1450 Element element = work.element;
1451 if (compiler.elementHasCompileTimeError(element)) { 1451 if (compiler.elementHasCompileTimeError(element)) {
1452 generatedCode[element] = jsAst.js( 1452 DiagnosticMessage message =
1453 "function () { throw new Error('Compile time error in $element') }"); 1453 // If there's more than one error, the first is probably most
1454 // informative, as the following errors may be side-effects of the
1455 // first error.
1456 compiler.elementsWithCompileTimeErrors[element].first;
1457 String messageText = message.message.computeMessage();
1458 jsAst.LiteralString messageLiteral =
1459 js.escapedString("Compile time error in $element: $messageText");
1460 generatedCode[element] = js(
1461 "function () { throw new Error(#); }", [messageLiteral]);
1454 return const CodegenImpact(); 1462 return const CodegenImpact();
1455 } 1463 }
1456 var kind = element.kind; 1464 var kind = element.kind;
1457 if (kind == ElementKind.TYPEDEF) { 1465 if (kind == ElementKind.TYPEDEF) {
1458 return const WorldImpact(); 1466 return const WorldImpact();
1459 } 1467 }
1460 if (element.isConstructor && 1468 if (element.isConstructor &&
1461 element.enclosingClass == helpers.jsNullClass) { 1469 element.enclosingClass == helpers.jsNullClass) {
1462 // Work around a problem compiling JSNull's constructor. 1470 // Work around a problem compiling JSNull's constructor.
1463 return const CodegenImpact(); 1471 return const CodegenImpact();
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
3008 3016
3009 @override 3017 @override
3010 void onImpactUsed(ImpactUseCase impactUse) { 3018 void onImpactUsed(ImpactUseCase impactUse) {
3011 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 3019 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
3012 // TODO(johnniwinther): Allow emptying when serialization has been 3020 // TODO(johnniwinther): Allow emptying when serialization has been
3013 // performed. 3021 // performed.
3014 resolution.emptyCache(); 3022 resolution.emptyCache();
3015 } 3023 }
3016 } 3024 }
3017 } 3025 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/resolution/class_hierarchy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698