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

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

Issue 61683007: Reapply "Retain types of toplevel and instance variables for reflection." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix: use '-' instead of ':' as a separator in the field descriptor. 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(['field', 'accessors', 'cls'], [ 140 jsAst.Fun fun = js.fun(['fieldDescriptor', 'accessors', 'cls'], [
141 js('var fieldInformation = fieldDescriptor.split("-")'),
142 js('var field = fieldInformation[0]'),
141 js('var len = field.length'), 143 js('var len = field.length'),
142 js('var code = field.charCodeAt(len - 1)'), 144 js('var code = field.charCodeAt(len - 1)'),
143 js('var reflectable = false'), 145 js('var reflectable'),
144 js.if_('code == $REFLECTION_MARKER', [ 146 js.if_('fieldInformation.length > 1', js('reflectable = true'),
145 js('len--'), 147 js('reflectable = false')),
146 js('code = field.charCodeAt(len - 1)'),
147 js('field = field.substring(0, len)'),
148 js('reflectable = true')
149 ]),
150 js('code = ((code >= $RANGE1_FIRST) && (code <= $RANGE1_LAST))' 148 js('code = ((code >= $RANGE1_FIRST) && (code <= $RANGE1_LAST))'
151 ' ? code - $RANGE1_ADJUST' 149 ' ? code - $RANGE1_ADJUST'
152 ' : ((code >= $RANGE2_FIRST) && (code <= $RANGE2_LAST))' 150 ' : ((code >= $RANGE2_FIRST) && (code <= $RANGE2_LAST))'
153 ' ? code - $RANGE2_ADJUST' 151 ' ? code - $RANGE2_ADJUST'
154 ' : ((code >= $RANGE3_FIRST) && (code <= $RANGE3_LAST))' 152 ' : ((code >= $RANGE3_FIRST) && (code <= $RANGE3_LAST))'
155 ' ? code - $RANGE3_ADJUST' 153 ' ? code - $RANGE3_ADJUST'
156 ' : $NO_FIELD_CODE'), 154 ' : $NO_FIELD_CODE'),
157 155
158 // if (needsAccessor) { 156 // if (needsAccessor) {
159 js.if_('code', [ 157 js.if_('code', [
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 } 1590 }
1593 1591
1594 bool isDeferred(Element element) { 1592 bool isDeferred(Element element) {
1595 return compiler.deferredLoadTask.isDeferred(element); 1593 return compiler.deferredLoadTask.isDeferred(element);
1596 } 1594 }
1597 1595
1598 bool get areAnyElementsDeferred { 1596 bool get areAnyElementsDeferred {
1599 return compiler.deferredLoadTask.areAnyElementsDeferred; 1597 return compiler.deferredLoadTask.areAnyElementsDeferred;
1600 } 1598 }
1601 } 1599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698