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

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 1699233002: Revert "Compile-time error if mixin class has a fact (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 2245
2246 Array& functions = Array::Handle(zone); 2246 Array& functions = Array::Handle(zone);
2247 Function& func = Function::Handle(zone); 2247 Function& func = Function::Handle(zone);
2248 // The parser creates the mixin application class with no functions. 2248 // The parser creates the mixin application class with no functions.
2249 ASSERT((functions = cls.functions(), functions.Length() == 0)); 2249 ASSERT((functions = cls.functions(), functions.Length() == 0));
2250 // Now clone the functions from the mixin class. 2250 // Now clone the functions from the mixin class.
2251 functions = mixin_cls.functions(); 2251 functions = mixin_cls.functions();
2252 const intptr_t num_functions = functions.Length(); 2252 const intptr_t num_functions = functions.Length();
2253 for (intptr_t i = 0; i < num_functions; i++) { 2253 for (intptr_t i = 0; i < num_functions; i++) {
2254 func ^= functions.At(i); 2254 func ^= functions.At(i);
2255 if (func.IsFactory() || func.IsGenerativeConstructor()) { 2255 if (func.IsGenerativeConstructor()) {
2256 // A mixin class must not have explicit constructors. 2256 // A mixin class must not have explicit constructors.
2257 if (!func.IsImplicitConstructor()) { 2257 if (!func.IsImplicitConstructor()) {
2258 const char* ctr_kind = func.IsFactory() ? "factory" : "constructor";
2259 const Script& script = Script::Handle(cls.script()); 2258 const Script& script = Script::Handle(cls.script());
2260 const Error& error = Error::Handle( 2259 const Error& error = Error::Handle(
2261 LanguageError::NewFormatted(Error::Handle(), 2260 LanguageError::NewFormatted(Error::Handle(),
2262 script, func.token_pos(), Report::AtLocation, 2261 script, func.token_pos(), Report::AtLocation,
2263 Report::kError, Heap::kNew, 2262 Report::kError, Heap::kNew,
2264 "%s '%s' is illegal in mixin class %s", 2263 "constructor '%s' is illegal in mixin class %s",
2265 ctr_kind,
2266 String::Handle(func.PrettyName()).ToCString(), 2264 String::Handle(func.PrettyName()).ToCString(),
2267 String::Handle(zone, mixin_cls.Name()).ToCString())); 2265 String::Handle(zone, mixin_cls.Name()).ToCString()));
2268 2266
2269 ReportErrors(error, cls, cls.token_pos(), 2267 ReportErrors(error, cls, cls.token_pos(),
2270 "mixin class '%s' must not have constructors", 2268 "mixin class '%s' must not have constructors",
2271 String::Handle(zone, mixin_cls.Name()).ToCString()); 2269 String::Handle(zone, mixin_cls.Name()).ToCString());
2272 } 2270 }
2273 continue; // Skip the implicit constructor. 2271 continue; // Skip the implicit constructor.
2274 } 2272 }
2275 if (!func.is_static() && 2273 if (!func.is_static() &&
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3317 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3320 field ^= fields_array.At(0); 3318 field ^= fields_array.At(0);
3321 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3319 ASSERT(field.Offset() == ByteBuffer::data_offset());
3322 name ^= field.name(); 3320 name ^= field.name();
3323 expected_name ^= String::New("_data"); 3321 expected_name ^= String::New("_data");
3324 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3322 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3325 #endif 3323 #endif
3326 } 3324 }
3327 3325
3328 } // namespace dart 3326 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698