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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart

Issue 828083003: dart2js: Don't assume fields are needed, if they are static. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 8
9 ClassStubGenerator get _stubGenerator => 9 ClassStubGenerator get _stubGenerator =>
10 new ClassStubGenerator(compiler, namer, backend); 10 new ClassStubGenerator(compiler, namer, backend);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 String accessorName, 118 String accessorName,
119 bool needsGetter, 119 bool needsGetter,
120 bool needsSetter, 120 bool needsSetter,
121 bool needsCheckedSetter) { 121 bool needsCheckedSetter) {
122 // Ignore needsCheckedSetter - that is handled below. 122 // Ignore needsCheckedSetter - that is handled below.
123 bool needsAccessor = (needsGetter || needsSetter); 123 bool needsAccessor = (needsGetter || needsSetter);
124 // We need to output the fields for non-native classes so we can auto- 124 // We need to output the fields for non-native classes so we can auto-
125 // generate the constructor. For native classes there are no 125 // generate the constructor. For native classes there are no
126 // constructors, so we don't need the fields unless we are generating 126 // constructors, so we don't need the fields unless we are generating
127 // accessors at runtime. 127 // accessors at runtime.
128 if (!classIsNative || needsAccessor) { 128 bool needsFieldsForConstructor = !emitStatics && !classIsNative;
129 if (needsFieldsForConstructor || needsAccessor) {
129 var metadata = emitter.metadataEmitter.buildMetadataFunction(field); 130 var metadata = emitter.metadataEmitter.buildMetadataFunction(field);
130 if (metadata != null) { 131 if (metadata != null) {
131 hasMetadata = true; 132 hasMetadata = true;
132 } else { 133 } else {
133 metadata = new jsAst.LiteralNull(); 134 metadata = new jsAst.LiteralNull();
134 } 135 }
135 fieldMetadata.add(metadata); 136 fieldMetadata.add(metadata);
136 recordMangledField(field, accessorName, 137 recordMangledField(field, accessorName,
137 namer.privateName(field.library, field.name)); 138 namer.privateName(field.library, field.name));
138 String fieldName = name; 139 String fieldName = name;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); 620 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index);
620 } 621 }
621 jsAst.Expression convertRtiToRuntimeType = emitter 622 jsAst.Expression convertRtiToRuntimeType = emitter
622 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); 623 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType'));
623 compiler.dumpInfoTask.registerElementAst(element, 624 compiler.dumpInfoTask.registerElementAst(element,
624 builder.addProperty(name, 625 builder.addProperty(name,
625 js('function () { return #(#) }', 626 js('function () { return #(#) }',
626 [convertRtiToRuntimeType, computeTypeVariable]))); 627 [convertRtiToRuntimeType, computeTypeVariable])));
627 } 628 }
628 } 629 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698