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

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: 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 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 for (ClassElement cls in impact.instantiatedClasses) { 1558 for (ClassElement cls in impact.instantiatedClasses) {
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.generateCodeWithCompileTimeErrors &&
1569 compiler.elementHasCompileTimeError(element)) {
1569 generatedCode[element] = jsAst.js( 1570 generatedCode[element] = jsAst.js(
1570 "function () { throw new Error('Compile time error in $element') }"); 1571 "function () { throw new Error('Compile time error in $element') }");
Johnni Winther 2015/12/14 11:31:20 We could use the message here as well.
sigurdm 2015/12/14 12:07:43 Done.
1571 return const CodegenImpact(); 1572 return const CodegenImpact();
1572 } 1573 }
1573 var kind = element.kind; 1574 var kind = element.kind;
1574 if (kind == ElementKind.TYPEDEF) { 1575 if (kind == ElementKind.TYPEDEF) {
1575 return const WorldImpact(); 1576 return const WorldImpact();
1576 } 1577 }
1577 if (element.isConstructor && 1578 if (element.isConstructor &&
1578 element.enclosingClass == helpers.jsNullClass) { 1579 element.enclosingClass == helpers.jsNullClass) {
1579 // Work around a problem compiling JSNull's constructor. 1580 // Work around a problem compiling JSNull's constructor.
1580 return const CodegenImpact(); 1581 return const CodegenImpact();
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 } 3075 }
3075 } 3076 }
3076 3077
3077 /// Records that [constant] is used by the element behind [registry]. 3078 /// Records that [constant] is used by the element behind [registry].
3078 class Dependency { 3079 class Dependency {
3079 final ConstantValue constant; 3080 final ConstantValue constant;
3080 final Element annotatedElement; 3081 final Element annotatedElement;
3081 3082
3082 const Dependency(this.constant, this.annotatedElement); 3083 const Dependency(this.constant, this.annotatedElement);
3083 } 3084 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698