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

Side by Side Diff: pkg/compiler/lib/src/typechecker.dart

Issue 2301953003: Rerun formatter on dartjs except kernel and shared_messages (Closed)
Patch Set: Created 4 years, 3 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/ssa/graph_builder.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 library dart2js.typechecker; 5 library dart2js.typechecker;
6 6
7 import 'common/names.dart' show Identifiers; 7 import 'common/names.dart' show Identifiers;
8 import 'common/resolution.dart' show Resolution; 8 import 'common/resolution.dart' show Resolution;
9 import 'common/tasks.dart' show CompilerTask; 9 import 'common/tasks.dart' show CompilerTask;
10 import 'common.dart'; 10 import 'common.dart';
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 if (type.isVoid) { 1769 if (type.isVoid) {
1770 reportTypeWarning(node.type, MessageKind.VOID_VARIABLE); 1770 reportTypeWarning(node.type, MessageKind.VOID_VARIABLE);
1771 type = const DynamicType(); 1771 type = const DynamicType();
1772 } 1772 }
1773 return type; 1773 return type;
1774 } 1774 }
1775 1775
1776 void analyzeVariableInitializer( 1776 void analyzeVariableInitializer(
1777 Spannable spannable, DartType declaredType, Node initializer) { 1777 Spannable spannable, DartType declaredType, Node initializer) {
1778 if (initializer == null) return; 1778 if (initializer == null) return;
1779 1779
1780 DartType expressionType = analyzeNonVoid(initializer); 1780 DartType expressionType = analyzeNonVoid(initializer);
1781 checkAssignable(spannable, expressionType, declaredType); 1781 checkAssignable(spannable, expressionType, declaredType);
1782 } 1782 }
1783 1783
1784 DartType visitVariableDefinitions(VariableDefinitions node) { 1784 DartType visitVariableDefinitions(VariableDefinitions node) {
1785 DartType type = analyzeVariableTypeAnnotation(node); 1785 DartType type = analyzeVariableTypeAnnotation(node);
1786 for (Link<Node> link = node.definitions.nodes; 1786 for (Link<Node> link = node.definitions.nodes;
1787 !link.isEmpty; 1787 !link.isEmpty;
1788 link = link.tail) { 1788 link = link.tail) {
1789 Node definition = link.head; 1789 Node definition = link.head;
1790 invariant(definition, definition is Identifier || definition is SendSet, 1790 invariant(definition, definition is Identifier || definition is SendSet,
1791 message: 'expected identifier or initialization'); 1791 message: 'expected identifier or initialization');
1792 if (definition is SendSet) { 1792 if (definition is SendSet) {
1793 SendSet initialization = definition; 1793 SendSet initialization = definition;
1794 analyzeVariableInitializer( 1794 analyzeVariableInitializer(initialization.assignmentOperator, type,
1795 initialization.assignmentOperator,
1796 type,
1797 initialization.arguments.head); 1795 initialization.arguments.head);
1798 // TODO(sigmund): explore inferring a type for `var` using the RHS (like 1796 // TODO(sigmund): explore inferring a type for `var` using the RHS (like
1799 // DDC does), for example: 1797 // DDC does), for example:
1800 // if (node.type == null && node.modifiers.isVar && 1798 // if (node.type == null && node.modifiers.isVar &&
1801 // !initializer.isDynamic) { 1799 // !initializer.isDynamic) {
1802 // var variable = elements[definition]; 1800 // var variable = elements[definition];
1803 // if (variable != null) { 1801 // if (variable != null) {
1804 // var typePromotion = new TypePromotion( 1802 // var typePromotion = new TypePromotion(
1805 // node, variable, initializer); 1803 // node, variable, initializer);
1806 // registerKnownTypePromotion(typePromotion); 1804 // registerKnownTypePromotion(typePromotion);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 2047
2050 visitTypedef(Typedef node) { 2048 visitTypedef(Typedef node) {
2051 // Do not typecheck [Typedef] nodes. 2049 // Do not typecheck [Typedef] nodes.
2052 } 2050 }
2053 2051
2054 visitNode(Node node) { 2052 visitNode(Node node) {
2055 reporter.internalError(node, 2053 reporter.internalError(node,
2056 'Unexpected node ${node.getObjectDescription()} in the type checker.'); 2054 'Unexpected node ${node.getObjectDescription()} in the type checker.');
2057 } 2055 }
2058 } 2056 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/graph_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698