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

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

Issue 1148373004: Revert "dart2js: Do not emit type metadata for fields declared in non-reflectable classes." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 int code = field.getterFlags + (field.setterFlags << 2); 156 int code = field.getterFlags + (field.setterFlags << 2);
157 if (code == 0) { 157 if (code == 0) {
158 compiler.internalError(fieldElement, 158 compiler.internalError(fieldElement,
159 'Field code is 0 ($fieldElement).'); 159 'Field code is 0 ($fieldElement).');
160 } else { 160 } else {
161 fieldCode = FIELD_CODE_CHARACTERS[code - FIRST_FIELD_CODE]; 161 fieldCode = FIELD_CODE_CHARACTERS[code - FIRST_FIELD_CODE];
162 } 162 }
163 } 163 }
164 // Fields can only be reflected if their declaring class is reflectable 164 if (backend.isAccessibleByReflection(fieldElement)) {
165 // (as they are only accessible via [ClassMirror.declarations]. However,
166 // set/get operations can be performed on them, so they are reflectable
167 // in some sense.
168 if (backend.isAccessibleByReflection(fieldElement) &&
169 backend.isAccessibleByReflection(fieldElement.enclosingClass)) {
170 DartType type = fieldElement.type; 165 DartType type = fieldElement.type;
171 reflectionMarker = '-${task.metadataCollector.reifyType(type)}'; 166 reflectionMarker = '-${task.metadataCollector.reifyType(type)}';
172 } 167 }
173 String builtFieldname = '$fieldName$fieldCode$reflectionMarker'; 168 String builtFieldname = '$fieldName$fieldCode$reflectionMarker';
174 builder.addField(builtFieldname); 169 builder.addField(builtFieldname);
175 // Add 1 because adding a field to the class also requires a comma 170 // Add 1 because adding a field to the class also requires a comma
176 compiler.dumpInfoTask.recordFieldNameSize(fieldElement, 171 compiler.dumpInfoTask.recordFieldNameSize(fieldElement,
177 builtFieldname.length + 1); 172 builtFieldname.length + 1);
178 fieldsAdded = true; 173 fieldsAdded = true;
179 } 174 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 ? new Selector.getter(member.name, member.library) 546 ? new Selector.getter(member.name, member.library)
552 : new Selector.setter(member.name, member.library); 547 : new Selector.setter(member.name, member.library);
553 String reflectionName = emitter.getReflectionName(selector, name); 548 String reflectionName = emitter.getReflectionName(selector, name);
554 if (reflectionName != null) { 549 if (reflectionName != null) {
555 var reflectable = 550 var reflectable =
556 js(backend.isAccessibleByReflection(member) ? '1' : '0'); 551 js(backend.isAccessibleByReflection(member) ? '1' : '0');
557 builder.addProperty('+$reflectionName', reflectable); 552 builder.addProperty('+$reflectionName', reflectable);
558 } 553 }
559 } 554 }
560 } 555 }
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