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

Unified Diff: runtime/vm/parser.cc

Issue 1284093004: Reuse canonicalized type for receiver type if class is not signature class and has no type paramete… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix typo Created 5 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 | « no previous file | no next file » | 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 ed49a3ccf32951909966398f40713e130128282e..a8d9795b1362a39303cd0b6c99f1a762c960d7bc 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -11859,12 +11859,17 @@ bool Parser::ParsingStaticMember() const {
const AbstractType* Parser::ReceiverType(const Class& cls) {
ASSERT(!cls.IsNull());
- const TypeArguments& type_arguments = TypeArguments::Handle(
- Z,
+ AbstractType& type = AbstractType::ZoneHandle(Z, cls.CanonicalType());
+ if (!type.IsNull()) {
+ // This requirement is embedded in 'CanonicalType' function.
+ ASSERT((cls.NumTypeArguments() == 0) && !cls.IsSignatureClass());
+ return &type;
+ }
+
+ const TypeArguments& type_arguments = TypeArguments::Handle(Z,
(cls.NumTypeParameters() > 0) ?
cls.type_parameters() : TypeArguments::null());
- AbstractType& type = AbstractType::ZoneHandle(
- Z, Type::New(cls, type_arguments, cls.token_pos()));
+ type = Type::New(cls, type_arguments, cls.token_pos());
if (cls.is_type_finalized()) {
type ^= ClassFinalizer::FinalizeType(
cls, type, ClassFinalizer::kCanonicalizeWellFormed);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698