Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 10143004: Map malformed function result type and malformed function parameter type to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/code_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/heap.h" 8 #include "vm/heap.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 if (function.IsFactory()) { 743 if (function.IsFactory()) {
744 // The name of a factory must always be resolved to a class or interface. 744 // The name of a factory must always be resolved to a class or interface.
745 // The parser sets the factory result type to a type with an unresolved 745 // The parser sets the factory result type to a type with an unresolved
746 // class whose name matches the factory name. 746 // class whose name matches the factory name.
747 result_finalization = kFinalizeWellFormed; 747 result_finalization = kFinalizeWellFormed;
748 // TODO(regis): Gilad asks if this compile-time error could be relaxed. 748 // TODO(regis): Gilad asks if this compile-time error could be relaxed.
749 // The result type of such a factory method would simply be malformed. 749 // The result type of such a factory method would simply be malformed.
750 } 750 }
751 ResolveType(cls, type, result_finalization); 751 ResolveType(cls, type, result_finalization);
752 type = FinalizeType(cls, type, result_finalization); 752 type = FinalizeType(cls, type, result_finalization);
753 // In production mode, a malformed result type is mapped to Dynamic.
754 if (!FLAG_enable_type_checks && type.IsMalformed()) {
755 type = Type::DynamicType();
756 }
753 function.set_result_type(type); 757 function.set_result_type(type);
754 // Resolve formal parameter types. 758 // Resolve formal parameter types.
755 const intptr_t num_parameters = function.NumberOfParameters(); 759 const intptr_t num_parameters = function.NumberOfParameters();
756 for (intptr_t i = 0; i < num_parameters; i++) { 760 for (intptr_t i = 0; i < num_parameters; i++) {
757 type = function.ParameterTypeAt(i); 761 type = function.ParameterTypeAt(i);
758 ResolveType(cls, type, kFinalize); 762 ResolveType(cls, type, kFinalize);
759 type = FinalizeType(cls, type, kFinalize); 763 type = FinalizeType(cls, type, kFinalize);
764 // In production mode, a malformed parameter type is mapped to Dynamic.
765 if (!FLAG_enable_type_checks && type.IsMalformed()) {
766 type = Type::DynamicType();
767 }
760 function.SetParameterTypeAt(i, type); 768 function.SetParameterTypeAt(i, type);
761 } 769 }
762 } 770 }
763 771
764 772
765 static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls, 773 static RawClass* FindSuperOwnerOfInstanceMember(const Class& cls,
766 const String& name) { 774 const String& name) {
767 Class& super_class = Class::Handle(); 775 Class& super_class = Class::Handle();
768 Function& function = Function::Handle(); 776 Function& function = Function::Handle();
769 Field& field = Field::Handle(); 777 Field& field = Field::Handle();
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 void ClassFinalizer::ReportError(const char* format, ...) { 1335 void ClassFinalizer::ReportError(const char* format, ...) {
1328 va_list args; 1336 va_list args;
1329 va_start(args, format); 1337 va_start(args, format);
1330 const Error& error = Error::Handle( 1338 const Error& error = Error::Handle(
1331 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); 1339 Parser::FormatError(Script::Handle(), -1, "Error", format, args));
1332 va_end(args); 1340 va_end(args);
1333 ReportError(error); 1341 ReportError(error);
1334 } 1342 }
1335 1343
1336 } // namespace dart 1344 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698