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

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

Issue 10876008: Remove most superfluous getter arguments from dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 class NativeEmitter { 5 class NativeEmitter {
6 6
7 CodeEmitterTask emitter; 7 CodeEmitterTask emitter;
8 CodeBuffer nativeBuffer; 8 CodeBuffer nativeBuffer;
9 9
10 // Classes that participate in dynamic dispatch. These are the 10 // Classes that participate in dynamic dispatch. These are the
(...skipping 29 matching lines...) Expand all
40 NativeEmitter(this.emitter) 40 NativeEmitter(this.emitter)
41 : classesWithDynamicDispatch = new Set<ClassElement>(), 41 : classesWithDynamicDispatch = new Set<ClassElement>(),
42 nativeClasses = new Set<ClassElement>(), 42 nativeClasses = new Set<ClassElement>(),
43 subtypes = new Map<ClassElement, List<ClassElement>>(), 43 subtypes = new Map<ClassElement, List<ClassElement>>(),
44 directSubtypes = new Map<ClassElement, List<ClassElement>>(), 44 directSubtypes = new Map<ClassElement, List<ClassElement>>(),
45 overriddenMethods = new Set<FunctionElement>(), 45 overriddenMethods = new Set<FunctionElement>(),
46 nativeMethods = new Set<FunctionElement>(), 46 nativeMethods = new Set<FunctionElement>(),
47 redirectingMethods = new Map<FunctionElement, String>(), 47 redirectingMethods = new Map<FunctionElement, String>(),
48 nativeBuffer = new CodeBuffer(); 48 nativeBuffer = new CodeBuffer();
49 49
50 Compiler get compiler() => emitter.compiler; 50 Compiler get compiler => emitter.compiler;
51 51
52 void addRedirectingMethod(FunctionElement element, String name) { 52 void addRedirectingMethod(FunctionElement element, String name) {
53 redirectingMethods[element] = name; 53 redirectingMethods[element] = name;
54 } 54 }
55 55
56 String get dynamicName() { 56 String get dynamicName {
57 Element element = compiler.findHelper( 57 Element element = compiler.findHelper(
58 const SourceString('dynamicFunction')); 58 const SourceString('dynamicFunction'));
59 return compiler.namer.isolateAccess(element); 59 return compiler.namer.isolateAccess(element);
60 } 60 }
61 61
62 String get dynamicSetMetadataName() { 62 String get dynamicSetMetadataName {
63 Element element = compiler.findHelper( 63 Element element = compiler.findHelper(
64 const SourceString('dynamicSetMetadata')); 64 const SourceString('dynamicSetMetadata'));
65 return compiler.namer.isolateAccess(element); 65 return compiler.namer.isolateAccess(element);
66 } 66 }
67 67
68 String get typeNameOfName() { 68 String get typeNameOfName {
69 Element element = compiler.findHelper( 69 Element element = compiler.findHelper(
70 const SourceString('getTypeNameOf')); 70 const SourceString('getTypeNameOf'));
71 return compiler.namer.isolateAccess(element); 71 return compiler.namer.isolateAccess(element);
72 } 72 }
73 73
74 String get defPropName() { 74 String get defPropName {
75 Element element = compiler.findHelper( 75 Element element = compiler.findHelper(
76 const SourceString('defineProperty')); 76 const SourceString('defineProperty'));
77 return compiler.namer.isolateAccess(element); 77 return compiler.namer.isolateAccess(element);
78 } 78 }
79 79
80 String get toStringHelperName() { 80 String get toStringHelperName {
81 Element element = compiler.findHelper( 81 Element element = compiler.findHelper(
82 const SourceString('toStringForNativeObject')); 82 const SourceString('toStringForNativeObject'));
83 return compiler.namer.isolateAccess(element); 83 return compiler.namer.isolateAccess(element);
84 } 84 }
85 85
86 String get defineNativeClassName() 86 String get defineNativeClassName
87 => '${compiler.namer.CURRENT_ISOLATE}.\$defineNativeClass'; 87 => '${compiler.namer.CURRENT_ISOLATE}.\$defineNativeClass';
88 88
89 String get defineNativeClassFunction() { 89 String get defineNativeClassFunction {
90 return """ 90 return """
91 function(cls, fields, methods) { 91 function(cls, fields, methods) {
92 var generateGetterSetter = ${emitter.generateGetterSetterFunction}; 92 var generateGetterSetter = ${emitter.generateGetterSetterFunction};
93 for (var i = 0; i < fields.length; i++) { 93 for (var i = 0; i < fields.length; i++) {
94 generateGetterSetter(fields[i], methods); 94 generateGetterSetter(fields[i], methods);
95 } 95 }
96 for (var method in methods) { 96 for (var method in methods) {
97 $dynamicName(method)[cls] = methods[method]; 97 $dynamicName(method)[cls] = methods[method];
98 } 98 }
99 }"""; 99 }""";
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if (!first) targetBuffer.add(",\n"); 432 if (!first) targetBuffer.add(",\n");
433 targetBuffer.add(" $name: $function"); 433 targetBuffer.add(" $name: $function");
434 first = false; 434 first = false;
435 }); 435 });
436 targetBuffer.add("\n});\n\n"); 436 targetBuffer.add("\n});\n\n");
437 } 437 }
438 targetBuffer.add('$nativeBuffer'); 438 targetBuffer.add('$nativeBuffer');
439 targetBuffer.add('\n'); 439 targetBuffer.add('\n');
440 } 440 }
441 } 441 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/js_backend/emitter.dart ('k') | dart/lib/compiler/implementation/lib/coreimpl_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698