| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 break; | 142 break; |
| 143 case ir.AsyncMarker.SyncYielding: | 143 case ir.AsyncMarker.SyncYielding: |
| 144 failedAt( | 144 failedAt( |
| 145 _analyzedMember, "Unexpected async marker: ${node.asyncMarker}"); | 145 _analyzedMember, "Unexpected async marker: ${node.asyncMarker}"); |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 return _returnType; | 148 return _returnType; |
| 149 } | 149 } |
| 150 | 150 |
| 151 @override | 151 @override |
| 152 TypeInformation defaultExpression(ir.Expression expression) { | 152 TypeInformation defaultExpression(ir.Expression node) { |
| 153 // TODO(efortuna): Remove when more is implemented. | 153 // TODO(johnniwinther): Make this throw to assert that all expressions are |
| 154 // handled. |
| 154 return _types.dynamicType; | 155 return _types.dynamicType; |
| 155 } | 156 } |
| 156 | 157 |
| 157 @override | 158 @override |
| 159 TypeInformation defaultStatement(ir.Statement node) { |
| 160 // TODO(johnniwinther): Make this throw to assert that all statements are |
| 161 // handled. |
| 162 node.visitChildren(this); |
| 163 return null; |
| 164 } |
| 165 |
| 166 @override |
| 158 TypeInformation visitNullLiteral(ir.NullLiteral literal) { | 167 TypeInformation visitNullLiteral(ir.NullLiteral literal) { |
| 159 return _types.nullType; | 168 return _types.nullType; |
| 160 } | 169 } |
| 161 | 170 |
| 162 @override | 171 @override |
| 163 TypeInformation visitBlock(ir.Block block) { | 172 TypeInformation visitBlock(ir.Block block) { |
| 164 for (ir.Statement statement in block.statements) { | 173 for (ir.Statement statement in block.statements) { |
| 165 statement.accept(this); | 174 statement.accept(this); |
| 166 if (_locals.aborts) break; | 175 if (_locals.aborts) break; |
| 167 } | 176 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } else { | 238 } else { |
| 230 _locals.update(local, visit(node.initializer), node, type); | 239 _locals.update(local, visit(node.initializer), node, type); |
| 231 } | 240 } |
| 232 return null; | 241 return null; |
| 233 } | 242 } |
| 234 | 243 |
| 235 @override | 244 @override |
| 236 TypeInformation visitVariableGet(ir.VariableGet node) { | 245 TypeInformation visitVariableGet(ir.VariableGet node) { |
| 237 return _locals.use(_localsMap.getLocalVariable(node.variable)); | 246 return _locals.use(_localsMap.getLocalVariable(node.variable)); |
| 238 } | 247 } |
| 248 |
| 249 @override |
| 250 TypeInformation visitVariableSet(ir.VariableSet node) { |
| 251 Local local = _localsMap.getLocalVariable(node.variable); |
| 252 DartType type = _localsMap.getLocalType(_elementMap, local); |
| 253 TypeInformation rhsType = visit(node.value); |
| 254 _locals.update(local, rhsType, node, type); |
| 255 return rhsType; |
| 256 } |
| 239 } | 257 } |
| OLD | NEW |