| 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) are reported as 'int' and all String types are mapped to 'String'. | 590 // Bigint) a re reported as 'int'. |
| 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"); | |
| 596 } else { | 594 } else { |
| 597 return Type::Handle(value.GetType()).Name(); | 595 return Type::Handle(value.GetType()).Name(); |
| 598 } | 596 } |
| 599 } | 597 } |
| 600 | 598 |
| 601 | 599 |
| 602 // Check that the type of the given instance is a subtype of the given type and | 600 // Check that the type of the given instance is a subtype of the given type and |
| 603 // can therefore be assigned. | 601 // can therefore be assigned. |
| 604 // Arg0: node-id of the assignment. | 602 // Arg0: node-id of the assignment. |
| 605 // Arg1: instance being assigned. | 603 // Arg1: instance being assigned. |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 } | 1538 } |
| 1541 } | 1539 } |
| 1542 } | 1540 } |
| 1543 // The cache is null terminated, therefore the loop above should never | 1541 // The cache is null terminated, therefore the loop above should never |
| 1544 // terminate by itself. | 1542 // terminate by itself. |
| 1545 UNREACHABLE(); | 1543 UNREACHABLE(); |
| 1546 return Code::null(); | 1544 return Code::null(); |
| 1547 } | 1545 } |
| 1548 | 1546 |
| 1549 } // namespace dart | 1547 } // namespace dart |
| OLD | NEW |