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

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

Issue 1525603002: Associate compile-time errors with elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@_temporary_fletch_patches
Patch Set: Address review Created 5 years 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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 enqueueClass(enqueuer, cls, registry); 1559 enqueueClass(enqueuer, cls, registry);
1560 } 1560 }
1561 for (BackendImpact otherImpact in impact.otherImpacts) { 1561 for (BackendImpact otherImpact in impact.otherImpacts) {
1562 enqueueImpact(enqueuer, otherImpact, registry); 1562 enqueueImpact(enqueuer, otherImpact, registry);
1563 } 1563 }
1564 } 1564 }
1565 1565
1566 WorldImpact codegen(CodegenWorkItem work) { 1566 WorldImpact codegen(CodegenWorkItem work) {
1567 Element element = work.element; 1567 Element element = work.element;
1568 if (compiler.elementHasCompileTimeError(element)) { 1568 if (compiler.elementHasCompileTimeError(element)) {
1569 generatedCode[element] = jsAst.js( 1569 DiagnosticMessage message =
1570 "function () { throw new Error('Compile time error in $element') }"); 1570 compiler.elementsWithCompileTimeErrors[element];
1571 String messageText = message.message.computeMessage();
1572 jsAst.LiteralString messageLiteral =
1573 js.escapedString("Compile time error in $element: $messageText");
1574 generatedCode[element] = js(
1575 "function () { throw new Error(#); }", [messageLiteral]);
1571 return const CodegenImpact(); 1576 return const CodegenImpact();
1572 } 1577 }
1573 var kind = element.kind; 1578 var kind = element.kind;
1574 if (kind == ElementKind.TYPEDEF) { 1579 if (kind == ElementKind.TYPEDEF) {
1575 return const WorldImpact(); 1580 return const WorldImpact();
1576 } 1581 }
1577 if (element.isConstructor && 1582 if (element.isConstructor &&
1578 element.enclosingClass == helpers.jsNullClass) { 1583 element.enclosingClass == helpers.jsNullClass) {
1579 // Work around a problem compiling JSNull's constructor. 1584 // Work around a problem compiling JSNull's constructor.
1580 return const CodegenImpact(); 1585 return const CodegenImpact();
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 } 3079 }
3075 } 3080 }
3076 3081
3077 /// Records that [constant] is used by the element behind [registry]. 3082 /// Records that [constant] is used by the element behind [registry].
3078 class Dependency { 3083 class Dependency {
3079 final ConstantValue constant; 3084 final ConstantValue constant;
3080 final Element annotatedElement; 3085 final Element annotatedElement;
3081 3086
3082 const Dependency(this.constant, this.annotatedElement); 3087 const Dependency(this.constant, this.annotatedElement);
3083 } 3088 }
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