OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 "both classes or both interfaces", | 333 "both classes or both interfaces", |
334 class_name.ToCString(), | 334 class_name.ToCString(), |
335 super_class_name.ToCString()); | 335 super_class_name.ToCString()); |
336 } | 336 } |
337 // If cls belongs to core lib or to core lib's implementation, restrictions | 337 // If cls belongs to core lib or to core lib's implementation, restrictions |
338 // about allowed interfaces are lifted. | 338 // about allowed interfaces are lifted. |
339 if ((cls.library() != Library::CoreLibrary()) && | 339 if ((cls.library() != Library::CoreLibrary()) && |
340 (cls.library() != Library::CoreImplLibrary())) { | 340 (cls.library() != Library::CoreImplLibrary())) { |
341 // Prevent extending core implementation classes. | 341 // Prevent extending core implementation classes. |
342 switch (super_class.id()) { | 342 switch (super_class.id()) { |
343 case kInteger: | 343 case kIntegerCid: |
344 case kSmi: | 344 case kSmiCid: |
345 case kMint: | 345 case kMintCid: |
346 case kBigint: | 346 case kBigintCid: |
347 case kDouble: | 347 case kDoubleCid: |
348 case kOneByteString: | 348 case kOneByteStringCid: |
349 case kTwoByteString: | 349 case kTwoByteStringCid: |
350 case kFourByteString: | 350 case kFourByteStringCid: |
351 case kExternalOneByteString: | 351 case kExternalOneByteStringCid: |
352 case kExternalTwoByteString: | 352 case kExternalTwoByteStringCid: |
353 case kExternalFourByteString: | 353 case kExternalFourByteStringCid: |
354 case kBool: | 354 case kBoolCid: |
355 case kArray: | 355 case kArrayCid: |
356 case kImmutableArray: | 356 case kImmutableArrayCid: |
357 case kGrowableObjectArray: | 357 case kGrowableObjectArrayCid: |
358 case kInt8Array: | 358 case kInt8ArrayCid: |
359 case kExternalInt8Array: | 359 case kExternalInt8ArrayCid: |
360 case kUint8Array: | 360 case kUint8ArrayCid: |
361 case kExternalUint8Array: | 361 case kExternalUint8ArrayCid: |
362 case kInt16Array: | 362 case kInt16ArrayCid: |
363 case kExternalInt16Array: | 363 case kExternalInt16ArrayCid: |
364 case kUint16Array: | 364 case kUint16ArrayCid: |
365 case kExternalUint16Array: | 365 case kExternalUint16ArrayCid: |
366 case kInt32Array: | 366 case kInt32ArrayCid: |
367 case kExternalInt32Array: | 367 case kExternalInt32ArrayCid: |
368 case kUint32Array: | 368 case kUint32ArrayCid: |
369 case kExternalUint32Array: | 369 case kExternalUint32ArrayCid: |
370 case kInt64Array: | 370 case kInt64ArrayCid: |
371 case kExternalInt64Array: | 371 case kExternalInt64ArrayCid: |
372 case kUint64Array: | 372 case kUint64ArrayCid: |
373 case kExternalUint64Array: | 373 case kExternalUint64ArrayCid: |
374 case kFloat32Array: | 374 case kFloat32ArrayCid: |
375 case kExternalFloat32Array: | 375 case kExternalFloat32ArrayCid: |
376 case kFloat64Array: | 376 case kFloat64ArrayCid: |
377 case kExternalFloat64Array: { | 377 case kExternalFloat64ArrayCid: { |
378 const Script& script = Script::Handle(cls.script()); | 378 const Script& script = Script::Handle(cls.script()); |
379 ReportError(script, cls.token_pos(), | 379 ReportError(script, cls.token_pos(), |
380 "'%s' is not allowed to extend '%s'", | 380 "'%s' is not allowed to extend '%s'", |
381 String::Handle(cls.Name()).ToCString(), | 381 String::Handle(cls.Name()).ToCString(), |
382 String::Handle(super_class.Name()).ToCString()); | 382 String::Handle(super_class.Name()).ToCString()); |
383 break; | 383 break; |
384 } | 384 } |
385 default: break; | 385 default: break; |
386 } | 386 } |
387 } | 387 } |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 void ClassFinalizer::ReportError(const char* format, ...) { | 1504 void ClassFinalizer::ReportError(const char* format, ...) { |
1505 va_list args; | 1505 va_list args; |
1506 va_start(args, format); | 1506 va_start(args, format); |
1507 const Error& error = Error::Handle( | 1507 const Error& error = Error::Handle( |
1508 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1508 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
1509 va_end(args); | 1509 va_end(args); |
1510 ReportError(error); | 1510 ReportError(error); |
1511 } | 1511 } |
1512 | 1512 |
1513 } // namespace dart | 1513 } // namespace dart |
OLD | NEW |