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

Side by Side Diff: lib/src/compiler/reify_coercions.dart

Issue 1929283002: Fix for messed-up short-circuit operators. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: rerun presumbit 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
« no previous file with comments | « lib/runtime/dart_sdk.js ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'package:analyzer/analyzer.dart' as analyzer; 5 import 'package:analyzer/analyzer.dart' as analyzer;
6 import 'package:analyzer/dart/ast/ast.dart'; 6 import 'package:analyzer/dart/ast/ast.dart';
7 import 'package:analyzer/dart/element/type.dart' show DartType; 7 import 'package:analyzer/dart/element/type.dart' show DartType;
8 import 'package:analyzer/src/dart/ast/ast.dart' show FunctionBodyImpl; 8 import 'package:analyzer/src/dart/ast/ast.dart' show FunctionBodyImpl;
9 import 'package:analyzer/src/dart/ast/utilities.dart' show NodeReplacer; 9 import 'package:analyzer/src/dart/ast/utilities.dart' show NodeReplacer;
10 import 'package:analyzer/src/dart/element/type.dart' show DynamicTypeImpl; 10 import 'package:analyzer/src/dart/element/type.dart' show DynamicTypeImpl;
(...skipping 27 matching lines...) Expand all
38 @override 38 @override
39 visitExpression(Expression node) { 39 visitExpression(Expression node) {
40 var coercion = CoercionInfo.get(node); 40 var coercion = CoercionInfo.get(node);
41 if (coercion is DownCast) { 41 if (coercion is DownCast) {
42 return _visitDownCast(coercion, node); 42 return _visitDownCast(coercion, node);
43 } 43 }
44 return super.visitExpression(node); 44 return super.visitExpression(node);
45 } 45 }
46 46
47 @override 47 @override
48 visitParenthesizedExpression(ParenthesizedExpression node) {
49 super.visitParenthesizedExpression(node);
50 node.staticType = node.expression.staticType;
51 }
52
53 @override
48 visitForEachStatement(ForEachStatement node) { 54 visitForEachStatement(ForEachStatement node) {
49 // Visit other children. 55 // Visit other children.
50 node.iterable.accept(this); 56 node.iterable.accept(this);
51 node.body.accept(this); 57 node.body.accept(this);
52 58
53 // If needed, assert a cast inside the body before the variable is read. 59 // If needed, assert a cast inside the body before the variable is read.
54 var variable = node.identifier ?? node.loopVariable.identifier; 60 var variable = node.identifier ?? node.loopVariable.identifier;
55 var coercion = CoercionInfo.get(variable); 61 var coercion = CoercionInfo.get(variable);
56 if (coercion is DownCast) { 62 if (coercion is DownCast) {
57 // Build the cast. We will place this cast in the body, so need to clone 63 // Build the cast. We will place this cast in the body, so need to clone
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 157
152 @override 158 @override
153 ExpressionFunctionBody visitExpressionFunctionBody( 159 ExpressionFunctionBody visitExpressionFunctionBody(
154 ExpressionFunctionBody node) { 160 ExpressionFunctionBody node) {
155 var clone = super.visitExpressionFunctionBody(node); 161 var clone = super.visitExpressionFunctionBody(node);
156 (clone as FunctionBodyImpl).localVariableInfo = 162 (clone as FunctionBodyImpl).localVariableInfo =
157 (node as FunctionBodyImpl).localVariableInfo; 163 (node as FunctionBodyImpl).localVariableInfo;
158 return clone; 164 return clone;
159 } 165 }
160 } 166 }
OLDNEW
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698