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

Unified Diff: runtime/vm/parser.cc

Issue 9150036: Skip qualified identifiers that are part of ignored types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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') | no next file » | 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 3437)
+++ runtime/vm/parser.cc (working copy)
@@ -822,6 +822,9 @@
(follower == Token::kPERIOD) || // Qualified class name of type.
Token::IsIdentifier(follower) || // Parameter name following a type.
(follower == Token::kTHIS)) { // Field parameter following a type.
+ // The types of formal parameters are never ignored, even in unchecked
+ // mode, because they are part of the function type of closurized
+ // functions appearing in type tests with typedef's.
hausner 2012/01/19 18:20:35 typedefs
regis 2012/01/19 18:31:33 Done.
parameter.type = &AbstractType::ZoneHandle(
ParseType(is_top_level_ ? kCanResolve : kMustResolve));
} else {
@@ -2329,6 +2332,9 @@
((follower == Token::kPERIOD) && // Qualified class name of type,
(LookaheadToken(3) != Token::kLPAREN))) { // but not a named constr.
ASSERT(is_top_level_);
+ // The declared type of fields is never ignored, even in unchecked mode,
+ // because getters and setters could be closurized at some time (not
+ // supported yet).
member.type = &AbstractType::ZoneHandle(ParseType(kCanResolve));
}
}
@@ -2663,7 +2669,9 @@
ConsumeToken();
result_type = Type::VoidType();
} else if (!IsFunctionTypeAliasName()) {
- result_type = ParseType(kDoNotResolve); // No owner class yet.
+ // Type annotations in typedef are never ignored, even in unchecked mode.
+ // Wait until we have an owner class before resolving the result type.
+ result_type = ParseType(kDoNotResolve);
}
const intptr_t alias_name_pos = token_index_;
@@ -6656,10 +6664,14 @@
}
QualIdent type_name;
const intptr_t type_pos = token_index_;
- ParseQualIdent(&type_name);
- if (type_name.is_local_scope_ident) {
- ErrorMsg(type_pos, "using '%s' in this context is invalid",
- type_name.ident->ToCString());
+ if (type_resolution == kIgnore) {
+ SkipQualIdent();
+ } else {
+ ParseQualIdent(&type_name);
+ if (type_name.is_local_scope_ident) {
+ ErrorMsg(type_pos, "using '%s' in this context is invalid",
+ type_name.ident->ToCString());
+ }
}
Class& scope_class = Class::Handle();
Object& type_class = Object::Handle();
@@ -7764,4 +7776,14 @@
SetAllowFunctionLiterals(saved_mode);
}
+
+void Parser::SkipQualIdent() {
+ ASSERT(IsIdentifier());
+ ConsumeToken();
+ if (CurrentToken() == Token::kPERIOD) {
+ ConsumeToken(); // Consume the kPERIOD token.
+ ExpectIdentifier("identifier expected after '.'");
+ }
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698