Index: runtime/vm/parser.cc |
=================================================================== |
--- runtime/vm/parser.cc (revision 16343) |
+++ runtime/vm/parser.cc (working copy) |
@@ -7480,12 +7480,14 @@ |
// Treat as implicit closure. |
left = LoadClosure(primary); |
} else if (left->AsPrimaryNode()->primary().IsClass()) { |
Ivan Posva
2012/12/21 00:14:27
left->AsPrimaryNode() can be short-circuited to pr
Tom Ball
2012/12/21 22:24:11
Done.
|
- Class& cls = Class::CheckedHandle( |
- left->AsPrimaryNode()->primary().raw()); |
- String& cls_name = String::Handle(cls.Name()); |
- ErrorMsg(left->token_pos(), |
- "illegal use of class name '%s'", |
- cls_name.ToCString()); |
+ Class& type_class = Class::Handle(); |
+ type_class ^= primary->primary().raw(); |
+ Type& type = Type::ZoneHandle( |
+ Type::New(type_class, TypeArguments::Handle(), |
Ivan Posva
2012/12/21 00:14:27
Instead of the acrobatics creating a type_class ha
Tom Ball
2012/12/21 22:24:11
Done.
|
+ primary->token_pos())); |
+ type ^= ClassFinalizer::FinalizeType( |
+ current_class(), type, ClassFinalizer::kCanonicalize); |
+ left = new LiteralNode(primary->token_pos(), type); |
} else if (primary->IsSuper()) { |
// Return "super" to handle unary super operator calls, |
// or to report illegal use of "super" otherwise. |
@@ -8333,17 +8335,6 @@ |
AstNode* resolved = NULL; |
ResolveIdentInLocalScope(ident_pos, ident, &resolved); |
if (resolved == NULL) { |
- // Check whether the identifier is a type parameter. Type parameters |
- // can never be used in primary expressions. |
- if (!current_class().IsNull()) { |
- TypeParameter& type_param = TypeParameter::Handle( |
- current_class().LookupTypeParameter(ident, ident_pos)); |
- if (!type_param.IsNull()) { |
- String& type_param_name = String::Handle(type_param.name()); |
- ErrorMsg(ident_pos, "illegal use of type parameter %s", |
- type_param_name.ToCString()); |
- } |
- } |
regis
2012/12/21 00:09:10
Removing this code cannot be correct. The identifi
Tom Ball
2012/12/21 22:24:11
I restored this block and the next, and restored t
|
// Not found in the local scope, and the name is not a type parameter. |
// Try finding the variable in the library scope (current library |
// and all libraries imported by it without a library prefix). |
@@ -9276,19 +9267,6 @@ |
if (!ResolveIdentInLocalScope(qual_ident.ident_pos, |
*qual_ident.ident, |
&primary)) { |
- // Check whether the identifier is a type parameter. Type parameters |
- // can never be used as part of primary expressions. |
- if (!current_class().IsNull()) { |
- TypeParameter& type_param = TypeParameter::ZoneHandle( |
- current_class().LookupTypeParameter(*(qual_ident.ident), |
- TokenPos())); |
- if (!type_param.IsNull()) { |
- const String& type_param_name = String::Handle(type_param.name()); |
- ErrorMsg(qual_ident.ident_pos, |
- "illegal use of type parameter %s", |
- type_param_name.ToCString()); |
- } |
- } |
regis
2012/12/21 00:09:10
ditto
|
// This is a non-local unqualified identifier so resolve the |
// identifier locally in the main app library and all libraries |
// imported by it. |