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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 10035058: Throw a type error in production mode when the type of the type test is not (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
===================================================================
--- runtime/vm/class_finalizer.cc (revision 6753)
+++ runtime/vm/class_finalizer.cc (working copy)
@@ -1270,7 +1270,9 @@
va_list args;
va_start(args, format);
LanguageError& error = LanguageError::Handle();
- if ((finalization == kFinalizeWellFormed) || FLAG_enable_type_checks) {
+ if (FLAG_enable_type_checks ||
+ !type.HasResolvedTypeClass() ||
+ (finalization == kFinalizeWellFormed)) {
const Script& script = Script::Handle(cls.script());
if (prev_error.IsNull()) {
error ^= Parser::FormatError(
@@ -1283,12 +1285,15 @@
ReportError(error);
}
}
- if (FLAG_enable_type_checks) {
- // In checked mode, mark type as malformed.
+ if (FLAG_enable_type_checks || !type.HasResolvedTypeClass()) {
+ // In check mode, always mark the type as malformed.
+ // In production mode, mark the type as malformed only if its type class is
+ // not resolved.
type.set_malformed_error(error);
} else {
- // In production mode, replace malformed type with Dynamic type.
- type.set_type_class(Class::Handle(Object::dynamic_class()));
+ // In production mode, do not mark the type with a resolved type class as
+ // malformed, but make it raw.
+ ASSERT(type.HasResolvedTypeClass());
type.set_arguments(AbstractTypeArguments::Handle());
}
if (!type.IsFinalized()) {
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698