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

Unified Diff: runtime/vm/parser.cc

Issue 23465004: More cleanup related to malformed and malbounded types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/vm/parser.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 26669)
+++ runtime/vm/parser.cc (working copy)
@@ -28,9 +28,7 @@
DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements.");
DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks.");
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
-DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
-DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings.");
-DECLARE_FLAG(bool, error_on_malformed_type);
+DECLARE_FLAG(bool, error_on_bad_type);
DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
static void CheckedModeHandler(bool value) {
@@ -7012,38 +7010,6 @@
}
-void Parser::Warning(intptr_t token_pos, const char* format, ...) {
hausner 2013/08/26 22:17:33 Can you please leave Warning() and friends in the
regis 2013/08/26 23:23:38 Done.
- if (FLAG_silent_warnings) return;
- va_list args;
- va_start(args, format);
- const Error& error = Error::Handle(
- FormatError(script_, token_pos, "Warning", format, args));
- va_end(args);
- if (FLAG_warning_as_error) {
- isolate()->long_jump_base()->Jump(1, error);
- UNREACHABLE();
- } else {
- OS::Print("%s", error.ToErrorCString());
- }
-}
-
-
-void Parser::Warning(const char* format, ...) {
- if (FLAG_silent_warnings) return;
- va_list args;
- va_start(args, format);
- const Error& error = Error::Handle(
- FormatError(script_, TokenPos(), "Warning", format, args));
- va_end(args);
- if (FLAG_warning_as_error) {
- isolate()->long_jump_base()->Jump(1, error);
- UNREACHABLE();
- } else {
- OS::Print("%s", error.ToErrorCString());
- }
-}
-
-
void Parser::Unimplemented(const char* msg) {
ErrorMsg(TokenPos(), "%s", msg);
}
@@ -8283,7 +8249,7 @@
if (ParsingStaticMember()) {
ASSERT(scope_class.raw() == current_class().raw());
if ((finalization == ClassFinalizer::kCanonicalizeWellFormed) ||
- FLAG_error_on_malformed_type) {
+ FLAG_error_on_bad_type) {
*type = ClassFinalizer::NewFinalizedMalformedType(
Error::Handle(), // No previous error.
scope_class,
@@ -8301,7 +8267,7 @@
// malformed if type arguments have previously been parsed.
if (!AbstractTypeArguments::Handle(type->arguments()).IsNull()) {
if ((finalization == ClassFinalizer::kCanonicalizeWellFormed) ||
- FLAG_error_on_malformed_type) {
+ FLAG_error_on_bad_type) {
*type = ClassFinalizer::NewFinalizedMalformedType(
Error::Handle(), // No previous error.
scope_class,
@@ -8329,7 +8295,7 @@
&error);
if (!error.IsNull()) {
if ((finalization == ClassFinalizer::kCanonicalizeWellFormed) ||
- FLAG_error_on_malformed_type) {
+ FLAG_error_on_bad_type) {
*type = ClassFinalizer::NewFinalizedMalformedType(
error,
scope_class,
@@ -8355,7 +8321,7 @@
&error);
if (!error.IsNull()) {
if ((finalization == ClassFinalizer::kCanonicalizeWellFormed) ||
- FLAG_error_on_malformed_type) {
+ FLAG_error_on_bad_type) {
*type = ClassFinalizer::NewFinalizedMalformedType(
error,
scope_class,
@@ -8376,7 +8342,7 @@
parameterized_type.set_type_class(resolved_type_class);
} else if (finalization >= ClassFinalizer::kCanonicalize) {
if ((finalization == ClassFinalizer::kCanonicalizeWellFormed) ||
- FLAG_error_on_malformed_type) {
+ FLAG_error_on_bad_type) {
ClassFinalizer::FinalizeMalformedType(
Error::Handle(), // No previous error.
scope_class,
@@ -9177,7 +9143,7 @@
if (list_type_arguments.Length() == 1) {
element_type = list_type_arguments.TypeAt(0);
} else {
- if (FLAG_error_on_malformed_type) {
+ if (FLAG_error_on_bad_type) {
ErrorMsg(type_pos,
"a list literal takes one type argument specifying "
"the element type");
@@ -9375,7 +9341,7 @@
"a type variable");
}
if (key_type.IsMalformed()) {
- if (FLAG_error_on_malformed_type) {
+ if (FLAG_error_on_bad_type) {
ErrorMsg(Error::Handle(key_type.malformed_error()));
}
// Map malformed key type to dynamic.
@@ -9383,7 +9349,7 @@
map_type_arguments.SetTypeAt(0, key_type);
}
if (value_type.IsMalformed()) {
- if (FLAG_error_on_malformed_type) {
+ if (FLAG_error_on_bad_type) {
ErrorMsg(Error::Handle(value_type.malformed_error()));
}
// Map malformed value type to dynamic.
@@ -9391,7 +9357,7 @@
map_type_arguments.SetTypeAt(1, value_type);
}
} else {
- if (FLAG_error_on_malformed_type) {
+ if (FLAG_error_on_bad_type) {
ErrorMsg(type_pos,
"a map literal takes two type arguments specifying "
"the key type and the value type");
@@ -9625,7 +9591,7 @@
type.IsTypeParameter() ? "type parameter " : "",
type.IsTypeParameter() ?
String::Handle(type.UserVisibleName()).ToCString() : "dynamic");
- } else if (FLAG_enable_type_checks || FLAG_error_on_malformed_type) {
+ } else if (FLAG_enable_type_checks || FLAG_error_on_bad_type) {
Error& bound_error = Error::Handle();
if (type.IsMalboundedWithError(&bound_error)) {
// Replace the type with a malformed type.
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698