OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
9 | 9 |
10 #include "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 // Returns: | 1473 // Returns: |
1474 // - object in EAX for successful assignable check (or throws TypeError). | 1474 // - object in EAX for successful assignable check (or throws TypeError). |
1475 void CodeGenerator::GenerateAssertAssignable(intptr_t token_index, | 1475 void CodeGenerator::GenerateAssertAssignable(intptr_t token_index, |
1476 const Type& dst_type, | 1476 const Type& dst_type, |
1477 const String& dst_name) { | 1477 const String& dst_name) { |
1478 ASSERT(FLAG_enable_type_checks); | 1478 ASSERT(FLAG_enable_type_checks); |
1479 ASSERT(token_index >= 0); | 1479 ASSERT(token_index >= 0); |
1480 ASSERT(!dst_type.IsNull()); | 1480 ASSERT(!dst_type.IsNull()); |
1481 ASSERT(dst_type.IsFinalized()); | 1481 ASSERT(dst_type.IsFinalized()); |
1482 | 1482 |
1483 // Any expression is assignable to the VarType. Skip the test. | 1483 // Any expression is assignable to the DynamicType. Skip the test. |
1484 if (dst_type.IsVarType()) { | 1484 if (dst_type.IsDynamicType()) { |
1485 return; | 1485 return; |
1486 } | 1486 } |
1487 | 1487 |
1488 // It is a compile-time error to explicitly return a value (including null) | 1488 // It is a compile-time error to explicitly return a value (including null) |
1489 // from a void function. However, functions that do not explicitly return a | 1489 // from a void function. However, functions that do not explicitly return a |
1490 // value, implicitly return null. This includes void functions. Therefore, we | 1490 // value, implicitly return null. This includes void functions. Therefore, we |
1491 // skip the type test here and trust the parser to only return null in void | 1491 // skip the type test here and trust the parser to only return null in void |
1492 // function. | 1492 // function. |
1493 if (dst_type.IsVoidType()) { | 1493 if (dst_type.IsVoidType()) { |
1494 return; | 1494 return; |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 const Class& cls = Class::Handle(parsed_function_.function().owner()); | 2641 const Class& cls = Class::Handle(parsed_function_.function().owner()); |
2642 const Script& script = Script::Handle(cls.script()); | 2642 const Script& script = Script::Handle(cls.script()); |
2643 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); | 2643 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); |
2644 Isolate::Current()->long_jump_base()->Jump(1, error_msg); | 2644 Isolate::Current()->long_jump_base()->Jump(1, error_msg); |
2645 UNREACHABLE(); | 2645 UNREACHABLE(); |
2646 } | 2646 } |
2647 | 2647 |
2648 } // namespace dart | 2648 } // namespace dart |
2649 | 2649 |
2650 #endif // defined TARGET_ARCH_IA32 | 2650 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |