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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart

Issue 24057003: Revert "Revert "Fix casts and type assertions on mixins used in native classes."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 part of js_backend; 5 part of js_backend;
6 6
7 class NativeEmitter { 7 class NativeEmitter {
8 8
9 CodeEmitterTask emitter; 9 CodeEmitterTask emitter;
10 CodeBuffer nativeBuffer; 10 CodeBuffer nativeBuffer;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // The element type is a function type either directly or through 457 // The element type is a function type either directly or through
458 // typedef(s). 458 // typedef(s).
459 return false; 459 return false;
460 } 460 }
461 461
462 if (!element.isClass()) { 462 if (!element.isClass()) {
463 compiler.cancel("Is check does not handle element", element: element); 463 compiler.cancel("Is check does not handle element", element: element);
464 return false; 464 return false;
465 } 465 }
466 466
467 if (backend.classesMixedIntoNativeClasses.contains(element)) return true;
468
467 return subtypes[element] != null; 469 return subtypes[element] != null;
468 } 470 }
469 471
470 bool requiresNativeIsCheck(Element element) { 472 bool requiresNativeIsCheck(Element element) {
471 // TODO(sra): Remove this function. It determines if a native type may 473 // TODO(sra): Remove this function. It determines if a native type may
472 // satisfy a check against [element], in whcih case an interceptor must be 474 // satisfy a check against [element], in which case an interceptor must be
473 // used. We should also use an interceptor if the check can't be satisfied 475 // used. We should also use an interceptor if the check can't be satisfied
474 // by a native class in case we get a natibe instance that tries to spoof 476 // by a native class in case we get a native instance that tries to spoof
475 // the type info. i.e the criteria for whether or not to use an interceptor 477 // the type info. i.e the criteria for whether or not to use an interceptor
476 // is whether the receiver can be native, not the type of the test. 478 // is whether the receiver can be native, not the type of the test.
477 if (!element.isClass()) return false; 479 if (!element.isClass()) return false;
478 ClassElement cls = element; 480 ClassElement cls = element;
479 if (cls.isNative()) return true; 481 if (Elements.isNativeOrExtendsNative(cls)) return true;
480 return isSupertypeOfNativeClass(element); 482 return isSupertypeOfNativeClass(element);
481 } 483 }
482 484
483 void assembleCode(CodeBuffer targetBuffer) { 485 void assembleCode(CodeBuffer targetBuffer) {
484 List<jsAst.Property> objectProperties = <jsAst.Property>[]; 486 List<jsAst.Property> objectProperties = <jsAst.Property>[];
485 487
486 void addProperty(String name, jsAst.Expression value) { 488 void addProperty(String name, jsAst.Expression value) {
487 objectProperties.add(new jsAst.Property(js.string(name), value)); 489 objectProperties.add(new jsAst.Property(js.string(name), value));
488 } 490 }
489 491
(...skipping 23 matching lines...) Expand all
513 if (emitter.compiler.enableMinification) targetBuffer.add(';'); 515 if (emitter.compiler.enableMinification) targetBuffer.add(';');
514 targetBuffer.add(jsAst.prettyPrint( 516 targetBuffer.add(jsAst.prettyPrint(
515 new jsAst.ExpressionStatement(init), compiler)); 517 new jsAst.ExpressionStatement(init), compiler));
516 targetBuffer.add('\n'); 518 targetBuffer.add('\n');
517 } 519 }
518 520
519 targetBuffer.add(nativeBuffer); 521 targetBuffer.add(nativeBuffer);
520 targetBuffer.add('\n'); 522 targetBuffer.add('\n');
521 } 523 }
522 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698