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

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

Issue 70073004: Revert "Retain types of toplevel and instance variables for reflection." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 /** 7 /**
8 * Generates the code for all used classes in the program. Static fields (even 8 * Generates the code for all used classes in the program. Static fields (even
9 * in classes) are ignored, since they can be treated as non-class elements. 9 * in classes) are ignored, since they can be treated as non-class elements.
10 * 10 *
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const RANGE1_ADJUST = - (FIRST_FIELD_CODE - RANGE1_FIRST); 130 const RANGE1_ADJUST = - (FIRST_FIELD_CODE - RANGE1_FIRST);
131 const RANGE2_ADJUST = - (FIRST_FIELD_CODE + RANGE1_SIZE - RANGE2_FIRST); 131 const RANGE2_ADJUST = - (FIRST_FIELD_CODE + RANGE1_SIZE - RANGE2_FIRST);
132 const RANGE3_ADJUST = 132 const RANGE3_ADJUST =
133 - (FIRST_FIELD_CODE + RANGE1_SIZE + RANGE2_SIZE - RANGE3_FIRST); 133 - (FIRST_FIELD_CODE + RANGE1_SIZE + RANGE2_SIZE - RANGE3_FIRST);
134 134
135 String receiverParamName = compiler.enableMinification ? "r" : "receiver"; 135 String receiverParamName = compiler.enableMinification ? "r" : "receiver";
136 String valueParamName = compiler.enableMinification ? "v" : "value"; 136 String valueParamName = compiler.enableMinification ? "v" : "value";
137 String reflectableField = namer.reflectableField; 137 String reflectableField = namer.reflectableField;
138 138
139 // function generateAccessor(field, prototype, cls) { 139 // function generateAccessor(field, prototype, cls) {
140 jsAst.Fun fun = js.fun(['fieldDescriptor', 'accessors', 'cls'], [ 140 jsAst.Fun fun = js.fun(['field', 'accessors', 'cls'], [
141 js('var fieldInformation = fieldDescriptor.split(":")'),
142 js('var field = fieldInformation[0]'),
143 js('var len = field.length'), 141 js('var len = field.length'),
144 js('var code = field.charCodeAt(len - 1)'), 142 js('var code = field.charCodeAt(len - 1)'),
145 js('var reflectable'), 143 js('var reflectable = false'),
146 js.if_('fieldInformation.length > 1', js('reflectable = true'), 144 js.if_('code == $REFLECTION_MARKER', [
147 js('reflectable = false')), 145 js('len--'),
146 js('code = field.charCodeAt(len - 1)'),
147 js('field = field.substring(0, len)'),
148 js('reflectable = true')
149 ]),
148 js('code = ((code >= $RANGE1_FIRST) && (code <= $RANGE1_LAST))' 150 js('code = ((code >= $RANGE1_FIRST) && (code <= $RANGE1_LAST))'
149 ' ? code - $RANGE1_ADJUST' 151 ' ? code - $RANGE1_ADJUST'
150 ' : ((code >= $RANGE2_FIRST) && (code <= $RANGE2_LAST))' 152 ' : ((code >= $RANGE2_FIRST) && (code <= $RANGE2_LAST))'
151 ' ? code - $RANGE2_ADJUST' 153 ' ? code - $RANGE2_ADJUST'
152 ' : ((code >= $RANGE3_FIRST) && (code <= $RANGE3_LAST))' 154 ' : ((code >= $RANGE3_FIRST) && (code <= $RANGE3_LAST))'
153 ' ? code - $RANGE3_ADJUST' 155 ' ? code - $RANGE3_ADJUST'
154 ' : $NO_FIELD_CODE'), 156 ' : $NO_FIELD_CODE'),
155 157
156 // if (needsAccessor) { 158 // if (needsAccessor) {
157 js.if_('code', [ 159 js.if_('code', [
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 } 1592 }
1591 1593
1592 bool isDeferred(Element element) { 1594 bool isDeferred(Element element) {
1593 return compiler.deferredLoadTask.isDeferred(element); 1595 return compiler.deferredLoadTask.isDeferred(element);
1594 } 1596 }
1595 1597
1596 bool get areAnyElementsDeferred { 1598 bool get areAnyElementsDeferred {
1597 return compiler.deferredLoadTask.areAnyElementsDeferred; 1599 return compiler.deferredLoadTask.areAnyElementsDeferred;
1598 } 1600 }
1599 } 1601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698