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

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

Issue 22831022: 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, 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 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // The element type is a function type either directly or through 463 // The element type is a function type either directly or through
464 // typedef(s). 464 // typedef(s).
465 return false; 465 return false;
466 } 466 }
467 467
468 if (!element.isClass()) { 468 if (!element.isClass()) {
469 compiler.cancel("Is check does not handle element", element: element); 469 compiler.cancel("Is check does not handle element", element: element);
470 return false; 470 return false;
471 } 471 }
472 472
473 if (backend.classesMixedIntoNativeClasses.contains(element)) return true;
474
475 return subtypes[element] != null; 473 return subtypes[element] != null;
476 } 474 }
477 475
478 bool requiresNativeIsCheck(Element element) { 476 bool requiresNativeIsCheck(Element element) {
479 // TODO(sra): Remove this function. It determines if a native type may 477 // TODO(sra): Remove this function. It determines if a native type may
480 // satisfy a check against [element], in which case an interceptor must be 478 // satisfy a check against [element], in whcih case an interceptor must be
481 // used. We should also use an interceptor if the check can't be satisfied 479 // used. We should also use an interceptor if the check can't be satisfied
482 // by a native class in case we get a native instance that tries to spoof 480 // by a native class in case we get a natibe instance that tries to spoof
483 // the type info. i.e the criteria for whether or not to use an interceptor 481 // the type info. i.e the criteria for whether or not to use an interceptor
484 // is whether the receiver can be native, not the type of the test. 482 // is whether the receiver can be native, not the type of the test.
485 if (!element.isClass()) return false; 483 if (!element.isClass()) return false;
486 ClassElement cls = element; 484 ClassElement cls = element;
487 if (Elements.isNativeOrExtendsNative(cls)) return true; 485 if (cls.isNative()) return true;
488 return isSupertypeOfNativeClass(element); 486 return isSupertypeOfNativeClass(element);
489 } 487 }
490 488
491 void assembleCode(CodeBuffer targetBuffer) { 489 void assembleCode(CodeBuffer targetBuffer) {
492 List<jsAst.Property> objectProperties = <jsAst.Property>[]; 490 List<jsAst.Property> objectProperties = <jsAst.Property>[];
493 491
494 void addProperty(String name, jsAst.Expression value) { 492 void addProperty(String name, jsAst.Expression value) {
495 objectProperties.add(new jsAst.Property(js.string(name), value)); 493 objectProperties.add(new jsAst.Property(js.string(name), value));
496 } 494 }
497 495
(...skipping 23 matching lines...) Expand all
521 if (emitter.compiler.enableMinification) targetBuffer.add(';'); 519 if (emitter.compiler.enableMinification) targetBuffer.add(';');
522 targetBuffer.add(jsAst.prettyPrint( 520 targetBuffer.add(jsAst.prettyPrint(
523 new jsAst.ExpressionStatement(init), compiler)); 521 new jsAst.ExpressionStatement(init), compiler));
524 targetBuffer.add('\n'); 522 targetBuffer.add('\n');
525 } 523 }
526 524
527 targetBuffer.add(nativeBuffer); 525 targetBuffer.add(nativeBuffer);
528 targetBuffer.add('\n'); 526 targetBuffer.add('\n');
529 } 527 }
530 } 528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698