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

Unified Diff: runtime/vm/parser.cc

Issue 2814833003: Fix type parameter invocation in the VM (fixes #19725). (Closed)
Patch Set: Created 3 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 | « no previous file | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index f708b97b19f7bc70ab23d418b3afbcbade38320b..6e83ad6ded5681538d7c7850ccce109337ad2d85 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -12098,34 +12098,12 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) {
false /* is_conditional */);
}
} else if (primary_node->primary().IsTypeParameter()) {
- TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z);
- type_parameter = TypeParameter::Cast(primary_node->primary()).raw();
- const String& name = String::ZoneHandle(Z, type_parameter.name());
- if (type_parameter.IsClassTypeParameter()) {
- if (ParsingStaticMember()) {
- // Treat as this.T(), because T is in scope.
- ReportError(primary_pos,
- "cannot access type parameter '%s' "
- "from static function",
- name.ToCString());
- } else {
- // Treat as call to unresolved (instance) method.
- selector =
- ParseInstanceCall(LoadReceiver(primary_pos), name,
- primary_pos, false /* is_conditional */);
- }
- } else {
- ASSERT(type_parameter.IsFunctionTypeParameter());
- // TODO(regis): Should we throw a type error instead?
- ReportError(primary_pos,
- "illegal use of function type parameter '%s'",
- name.ToCString());
- }
+ selector = LoadTypeParameter(primary_node);
} else if (primary_node->primary().IsClass()) {
const Class& type_class = Class::Cast(primary_node->primary());
AbstractType& type = Type::ZoneHandle(
- Z, Type::New(type_class, TypeArguments::Handle(Z), primary_pos,
- Heap::kOld));
+ Z, Type::New(type_class, Object::null_type_arguments(),
+ primary_pos, Heap::kOld));
type ^= CanonicalizeType(type);
// Type may be malbounded, but not malformed.
ASSERT(!type.IsMalformed());
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698