| OLD | NEW |
| 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 #include "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 Exceptions::CreateAndThrowTypeError( | 579 Exceptions::CreateAndThrowTypeError( |
| 580 location, no_name, no_name, no_name, malformed_error_message); | 580 location, no_name, no_name, no_name, malformed_error_message); |
| 581 UNREACHABLE(); | 581 UNREACHABLE(); |
| 582 } | 582 } |
| 583 UpdateTypeTestCache(node_id, instance, type, instantiator, | 583 UpdateTypeTestCache(node_id, instance, type, instantiator, |
| 584 instantiator_type_arguments, result, cache); | 584 instantiator_type_arguments, result, cache); |
| 585 arguments.SetReturn(result); | 585 arguments.SetReturn(result); |
| 586 } | 586 } |
| 587 | 587 |
| 588 | 588 |
| 589 // For error reporting simplify type name, e.g, all integer types (Smi, Mint, | 589 // For error reporting, simplify type name, e.g, all integer types (Smi, Mint, |
| 590 // Bigint) a re reported as 'int'. | 590 // Bigint) are reported as 'int' and all String types are mapped to 'String'. |
| 591 static RawString* GetSimpleTypeName(const Instance& value) { | 591 static RawString* GetSimpleTypeName(const Instance& value) { |
| 592 if (value.IsInteger()) { | 592 if (value.IsInteger()) { |
| 593 return String::NewSymbol("int"); | 593 return String::NewSymbol("int"); |
| 594 } else if (value.IsString()) { |
| 595 return String::NewSymbol("String"); |
| 594 } else { | 596 } else { |
| 595 return Type::Handle(value.GetType()).Name(); | 597 return Type::Handle(value.GetType()).Name(); |
| 596 } | 598 } |
| 597 } | 599 } |
| 598 | 600 |
| 599 | 601 |
| 600 // Check that the type of the given instance is a subtype of the given type and | 602 // Check that the type of the given instance is a subtype of the given type and |
| 601 // can therefore be assigned. | 603 // can therefore be assigned. |
| 602 // Arg0: node-id of the assignment. | 604 // Arg0: node-id of the assignment. |
| 603 // Arg1: instance being assigned. | 605 // Arg1: instance being assigned. |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 } | 1540 } |
| 1539 } | 1541 } |
| 1540 } | 1542 } |
| 1541 // The cache is null terminated, therefore the loop above should never | 1543 // The cache is null terminated, therefore the loop above should never |
| 1542 // terminate by itself. | 1544 // terminate by itself. |
| 1543 UNREACHABLE(); | 1545 UNREACHABLE(); |
| 1544 return Code::null(); | 1546 return Code::null(); |
| 1545 } | 1547 } |
| 1546 | 1548 |
| 1547 } // namespace dart | 1549 } // namespace dart |
| OLD | NEW |