| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 9 import '../common/names.dart'; | 9 import '../common/names.dart'; |
| 10 import '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 | 374 |
| 375 /// Pushes a boolean checking [expression] against null. | 375 /// Pushes a boolean checking [expression] against null. |
| 376 pushCheckNull(HInstruction expression) { | 376 pushCheckNull(HInstruction expression) { |
| 377 push(new HIdentity( | 377 push(new HIdentity( |
| 378 expression, graph.addConstantNull(compiler), null, backend.boolType)); | 378 expression, graph.addConstantNull(compiler), null, backend.boolType)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 @override | 381 @override |
| 382 void defaultExpression(ir.Expression expression) { | 382 void defaultExpression(ir.Expression expression) { |
| 383 // TODO(het): This is only to get tests working | 383 // TODO(het): This is only to get tests working. |
| 384 stack.add(graph.addConstantNull(compiler)); | 384 String message = 'Unhandled ir.${expression.runtimeType} $expression'; |
| 385 HInstruction nullValue = graph.addConstantNull(compiler); |
| 386 HInstruction errorMessage = |
| 387 graph.addConstantString(new DartString.literal(message), compiler); |
| 388 HInstruction trap = new HForeignCode( |
| 389 js.js.parseForeignJS("#.#"), |
| 390 backend.dynamicType, |
| 391 <HInstruction>[nullValue, errorMessage]); |
| 392 trap.sideEffects..setAllSideEffects()..setDependsOnSomething(); |
| 393 push(trap); |
| 385 } | 394 } |
| 386 | 395 |
| 387 /// Returns the current source element. | 396 /// Returns the current source element. |
| 388 /// | 397 /// |
| 389 /// The returned element is a declaration element. | 398 /// The returned element is a declaration element. |
| 390 // TODO(efortuna): Update this when we implement inlining. | 399 // TODO(efortuna): Update this when we implement inlining. |
| 391 @override | 400 @override |
| 392 Element get sourceElement => astAdapter.getElement(target); | 401 Element get sourceElement => astAdapter.getElement(target); |
| 393 | 402 |
| 394 @override | 403 @override |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 push(new HNot(popBoolified(), backend.boolType)); | 1675 push(new HNot(popBoolified(), backend.boolType)); |
| 1667 } | 1676 } |
| 1668 | 1677 |
| 1669 @override | 1678 @override |
| 1670 void visitStringConcatenation(ir.StringConcatenation stringConcat) { | 1679 void visitStringConcatenation(ir.StringConcatenation stringConcat) { |
| 1671 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); | 1680 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); |
| 1672 stringConcat.accept(stringBuilder); | 1681 stringConcat.accept(stringBuilder); |
| 1673 stack.add(stringBuilder.result); | 1682 stack.add(stringBuilder.result); |
| 1674 } | 1683 } |
| 1675 } | 1684 } |
| OLD | NEW |