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

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

Issue 12051056: Allow native classes to mixin behavior from an ordinary Dart class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comments. Created 7 years, 11 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 library native; 5 library native;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 import 'dart:uri'; 8 import 'dart:uri';
9 import 'dart2jslib.dart' hide SourceString; 9 import 'dart2jslib.dart' hide SourceString;
10 import 'elements/elements.dart'; 10 import 'elements/elements.dart';
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // be instantiated (abstract or simply unused). 430 // be instantiated (abstract or simply unused).
431 addSubtypes(cls.superclass, emitter); 431 addSubtypes(cls.superclass, emitter);
432 432
433 for (DartType type in cls.allSupertypes) { 433 for (DartType type in cls.allSupertypes) {
434 List<Element> subtypes = emitter.subtypes.putIfAbsent( 434 List<Element> subtypes = emitter.subtypes.putIfAbsent(
435 type.element, 435 type.element,
436 () => <ClassElement>[]); 436 () => <ClassElement>[]);
437 subtypes.add(cls); 437 subtypes.add(cls);
438 } 438 }
439 439
440 ClassElement superclass = cls.superclass;
441 while (superclass != null && superclass.isMixinApplication) {
442 assert(!superclass.isNative());
443 superclass = superclass.superclass;
444 }
445
440 List<Element> directSubtypes = emitter.directSubtypes.putIfAbsent( 446 List<Element> directSubtypes = emitter.directSubtypes.putIfAbsent(
441 cls.superclass, 447 superclass,
442 () => <ClassElement>[]); 448 () => <ClassElement>[]);
443 directSubtypes.add(cls); 449 directSubtypes.add(cls);
444 } 450 }
445 451
446 void logSummary(log(message)) { 452 void logSummary(log(message)) {
447 log('Compiled ${registeredClasses.length} native classes, ' 453 log('Compiled ${registeredClasses.length} native classes, '
448 '${unusedClasses.length} native classes omitted.'); 454 '${unusedClasses.length} native classes omitted.');
449 } 455 }
450 } 456 }
451 457
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 } else { 882 } else {
877 if (parameters.parameterCount != 0) { 883 if (parameters.parameterCount != 0) {
878 compiler.cancel( 884 compiler.cancel(
879 'native "..." syntax is restricted to functions with zero parameters', 885 'native "..." syntax is restricted to functions with zero parameters',
880 node: nativeBody); 886 node: nativeBody);
881 } 887 }
882 LiteralString jsCode = nativeBody.asLiteralString(); 888 LiteralString jsCode = nativeBody.asLiteralString();
883 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); 889 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[]));
884 } 890 }
885 } 891 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698