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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2392863002: Roll kernel to latest (Closed)
Patch Set: Reinsert code Created 4 years, 2 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 library dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compile_time_constants.dart'; 10 import '../compile_time_constants.dart';
(...skipping 4584 matching lines...) Expand 10 before | Expand all | Expand 10 after
4595 LabelDefinition labelElement = targetElement.addLabel(label, labelName); 4595 LabelDefinition labelElement = targetElement.addLabel(label, labelName);
4596 registry.defineLabel(label, labelElement); 4596 registry.defineLabel(label, labelElement);
4597 continueLabels[labelName] = labelElement; 4597 continueLabels[labelName] = labelElement;
4598 } 4598 }
4599 cases = cases.tail; 4599 cases = cases.tail;
4600 // Test that only the last case, if any, is a default case. 4600 // Test that only the last case, if any, is a default case.
4601 if (switchCase.defaultKeyword != null && !cases.isEmpty) { 4601 if (switchCase.defaultKeyword != null && !cases.isEmpty) {
4602 reporter.reportErrorMessage( 4602 reporter.reportErrorMessage(
4603 switchCase, MessageKind.INVALID_CASE_DEFAULT); 4603 switchCase, MessageKind.INVALID_CASE_DEFAULT);
4604 } 4604 }
4605 if (cases.isNotEmpty) {
4606 Node last = switchCase.statements.last;
4607 if (last.asBreakStatement() == null &&
4608 last.asContinueStatement() == null &&
4609 last.asThrow() == null &&
4610 last.asReturn() == null) {
4611 registry.registerFeature(Feature.FALL_THROUGH_ERROR);
4612 }
4613 }
4605 } 4614 }
4606 4615
4607 addDeferredAction(enclosingElement, () { 4616 addDeferredAction(enclosingElement, () {
4608 checkCaseExpressions(node); 4617 checkCaseExpressions(node);
4609 }); 4618 });
4610 4619
4611 statementScope.enterSwitch(breakElement, continueLabels); 4620 statementScope.enterSwitch(breakElement, continueLabels);
4612 node.cases.accept(this); 4621 node.cases.accept(this);
4613 statementScope.exitSwitch(); 4622 statementScope.exitSwitch();
4614 4623
4615 // Clean-up unused labels. 4624 // Clean-up unused labels.
4616 continueLabels.forEach((String key, LabelDefinition label) { 4625 continueLabels.forEach((String key, LabelDefinition label) {
4617 if (!label.isContinueTarget) { 4626 if (!label.isContinueTarget) {
4618 JumpTarget targetElement = label.target; 4627 JumpTarget targetElement = label.target;
4619 SwitchCase switchCase = targetElement.statement; 4628 SwitchCase switchCase = targetElement.statement;
4620 registry.undefineTarget(switchCase); 4629 registry.undefineTarget(switchCase);
4621 registry.undefineLabel(label.label); 4630 registry.undefineLabel(label.label);
4622 } 4631 }
4623 }); 4632 });
4624 // TODO(15575): We should warn if we can detect a fall through 4633 // TODO(15575): We should warn if we can detect a fall through
4625 // error. 4634 // error.
4626 registry.registerFeature(Feature.FALL_THROUGH_ERROR);
4627 return const NoneResult(); 4635 return const NoneResult();
4628 } 4636 }
4629 4637
4630 ResolutionResult visitSwitchCase(SwitchCase node) { 4638 ResolutionResult visitSwitchCase(SwitchCase node) {
4631 node.labelsAndCases.accept(this); 4639 node.labelsAndCases.accept(this);
4632 visitIn(node.statements, new BlockScope(scope)); 4640 visitIn(node.statements, new BlockScope(scope));
4633 return const NoneResult(); 4641 return const NoneResult();
4634 } 4642 }
4635 4643
4636 ResolutionResult visitCaseMatch(CaseMatch node) { 4644 ResolutionResult visitCaseMatch(CaseMatch node) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 } 4740 }
4733 return const NoneResult(); 4741 return const NoneResult();
4734 } 4742 }
4735 } 4743 }
4736 4744
4737 /// Looks up [name] in [scope] and unwraps the result. 4745 /// Looks up [name] in [scope] and unwraps the result.
4738 Element lookupInScope( 4746 Element lookupInScope(
4739 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4747 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4740 return Elements.unwrap(scope.lookup(name), reporter, node); 4748 return Elements.unwrap(scope.lookup(name), reporter, node);
4741 } 4749 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_visitor.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698