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

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

Issue 12079022: Add test for native mixin fields and fix the implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix comment. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js_native/native_mixin_field_test.dart » ('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) 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 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 bool needsSetter, 874 bool needsSetter,
875 bool needsCheckedSetter)) { 875 bool needsCheckedSetter)) {
876 assert(invariant(classElement, classElement.isDeclaration)); 876 assert(invariant(classElement, classElement.isDeclaration));
877 // If the class is never instantiated we still need to set it up for 877 // If the class is never instantiated we still need to set it up for
878 // inheritance purposes, but we can simplify its JavaScript constructor. 878 // inheritance purposes, but we can simplify its JavaScript constructor.
879 bool isInstantiated = 879 bool isInstantiated =
880 compiler.codegenWorld.instantiatedClasses.contains(classElement); 880 compiler.codegenWorld.instantiatedClasses.contains(classElement);
881 881
882 void visitField(ClassElement enclosingClass, Element member) { 882 void visitField(ClassElement enclosingClass, Element member) {
883 assert(invariant(classElement, member.isDeclaration)); 883 assert(invariant(classElement, member.isDeclaration));
884
885 LibraryElement library = member.getLibrary(); 884 LibraryElement library = member.getLibrary();
886 SourceString name = member.name; 885 SourceString name = member.name;
887 bool isPrivate = name.isPrivate(); 886 bool isPrivate = name.isPrivate();
887
888 // If we're dealing with a native class and we've found the
889 // field in an applied mixin, we treat it as if we've found the
890 // field in the class itself.
891 if (classElement.isNative() && enclosingClass.isMixinApplication) {
892 enclosingClass = classElement;
893 }
894
888 // See if we can dynamically create getters and setters. 895 // See if we can dynamically create getters and setters.
889 // We can only generate getters and setters for [classElement] since 896 // We can only generate getters and setters for [classElement] since
890 // the fields of super classes could be overwritten with getters or 897 // the fields of super classes could be overwritten with getters or
891 // setters. 898 // setters.
892 bool needsGetter = false; 899 bool needsGetter = false;
893 bool needsSetter = false; 900 bool needsSetter = false;
894 // We need to name shadowed fields differently, so they don't clash with 901 // We need to name shadowed fields differently, so they don't clash with
895 // the non-shadowed field. 902 // the non-shadowed field.
896 bool isShadowed = false; 903 bool isShadowed = false;
897 if (identical(enclosingClass, classElement)) { 904 if (identical(enclosingClass, classElement)) {
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 """; 2295 """;
2289 const String HOOKS_API_USAGE = """ 2296 const String HOOKS_API_USAGE = """
2290 // The code supports the following hooks: 2297 // The code supports the following hooks:
2291 // dartPrint(message) - if this function is defined it is called 2298 // dartPrint(message) - if this function is defined it is called
2292 // instead of the Dart [print] method. 2299 // instead of the Dart [print] method.
2293 // dartMainRunner(main) - if this function is defined, the Dart [main] 2300 // dartMainRunner(main) - if this function is defined, the Dart [main]
2294 // method will not be invoked directly. 2301 // method will not be invoked directly.
2295 // Instead, a closure that will invoke [main] is 2302 // Instead, a closure that will invoke [main] is
2296 // passed to [dartMainRunner]. 2303 // passed to [dartMainRunner].
2297 """; 2304 """;
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_native/native_mixin_field_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698