| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 Exceptions::CreateAndThrowTypeError( | 581 Exceptions::CreateAndThrowTypeError( |
| 582 location, no_name, no_name, no_name, malformed_error_message); | 582 location, no_name, no_name, no_name, malformed_error_message); |
| 583 UNREACHABLE(); | 583 UNREACHABLE(); |
| 584 } | 584 } |
| 585 UpdateTypeTestCache(node_id, instance, type, instantiator, | 585 UpdateTypeTestCache(node_id, instance, type, instantiator, |
| 586 instantiator_type_arguments, result, cache); | 586 instantiator_type_arguments, result, cache); |
| 587 arguments.SetReturn(result); | 587 arguments.SetReturn(result); |
| 588 } | 588 } |
| 589 | 589 |
| 590 | 590 |
| 591 // For error reporting simplify type name, e.g, all integer types (Smi, Mint, | 591 // For error reporting, simplify type name, e.g, all integer types (Smi, Mint, |
| 592 // Bigint) a re reported as 'int'. | 592 // Bigint) are reported as 'int' and all String types are mapped to 'String'. |
| 593 static RawString* GetSimpleTypeName(const Instance& value) { | 593 static RawString* GetSimpleTypeName(const Instance& value) { |
| 594 if (value.IsInteger()) { | 594 if (value.IsInteger()) { |
| 595 return String::NewSymbol("int"); | 595 return String::NewSymbol("int"); |
| 596 } else if (value.IsString()) { |
| 597 return String::NewSymbol("String"); |
| 596 } else { | 598 } else { |
| 597 return Type::Handle(value.GetType()).Name(); | 599 return Type::Handle(value.GetType()).Name(); |
| 598 } | 600 } |
| 599 } | 601 } |
| 600 | 602 |
| 601 | 603 |
| 602 // Check that the type of the given instance is a subtype of the given type and | 604 // Check that the type of the given instance is a subtype of the given type and |
| 603 // can therefore be assigned. | 605 // can therefore be assigned. |
| 604 // Arg0: node-id of the assignment. | 606 // Arg0: node-id of the assignment. |
| 605 // Arg1: instance being assigned. | 607 // Arg1: instance being assigned. |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 } | 1571 } |
| 1570 } | 1572 } |
| 1571 } | 1573 } |
| 1572 // The cache is null terminated, therefore the loop above should never | 1574 // The cache is null terminated, therefore the loop above should never |
| 1573 // terminate by itself. | 1575 // terminate by itself. |
| 1574 UNREACHABLE(); | 1576 UNREACHABLE(); |
| 1575 return Code::null(); | 1577 return Code::null(); |
| 1576 } | 1578 } |
| 1577 | 1579 |
| 1578 } // namespace dart | 1580 } // namespace dart |
| OLD | NEW |