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

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

Issue 175043004: Version 1.2.0-dev.5.14 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 10 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) 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 // TODO(ahe): Share these with js_helper.dart. 7 // TODO(ahe): Share these with js_helper.dart.
8 const FUNCTION_INDEX = 0; 8 const FUNCTION_INDEX = 0;
9 const NAME_INDEX = 1; 9 const NAME_INDEX = 1;
10 const CALL_NAME_INDEX = 2; 10 const CALL_NAME_INDEX = 2;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // library is the root library (see dart:mirrors IsolateMirror.rootLibrary). 217 // library is the root library (see dart:mirrors IsolateMirror.rootLibrary).
218 // 218 //
219 // The entries of [data] are built in [assembleProgram] above. 219 // The entries of [data] are built in [assembleProgram] above.
220 ''' 220 '''
221 var name = data[0]; 221 var name = data[0];
222 var uri = data[1]; 222 var uri = data[1];
223 var metadata = data[2]; 223 var metadata = data[2];
224 var globalObject = data[3]; 224 var globalObject = data[3];
225 var descriptor = data[4]; 225 var descriptor = data[4];
226 var isRoot = !!data[5]; 226 var isRoot = !!data[5];
227 var fields = descriptor && descriptor[""]; 227 var fields = descriptor && descriptor["${namer.classDescriptorProperty}"];
228 var classes = []; 228 var classes = [];
229 var functions = []; 229 var functions = [];
230 '''; 230 ''';
231 231
232 String processStatics = ''' 232 String processStatics = '''
233 function processStatics(descriptor) { 233 function processStatics(descriptor) {
234 for (var property in descriptor) { 234 for (var property in descriptor) {
235 if (!hasOwnProperty.call(descriptor, property)) continue; 235 if (!hasOwnProperty.call(descriptor, property)) continue;
236 if (property === "") continue; 236 if (property === "${namer.classDescriptorProperty}") continue;
237 var element = descriptor[property]; 237 var element = descriptor[property];
238 var firstChar = property.substring(0, 1); 238 var firstChar = property.substring(0, 1);
239 var previousProperty; 239 var previousProperty;
240 if (firstChar === "+") { 240 if (firstChar === "+") {
241 mangledGlobalNames[previousProperty] = property.substring(1); 241 mangledGlobalNames[previousProperty] = property.substring(1);
242 var flag = descriptor[property]; 242 var flag = descriptor[property];
243 if (flag > 0) ''' // Break long line. 243 if (flag > 0) ''' // Break long line.
244 '''descriptor[previousProperty].$reflectableField = flag; 244 '''descriptor[previousProperty].$reflectableField = flag;
245 if (element && element.length) ''' // Break long line. 245 if (element && element.length) ''' // Break long line.
246 '''init.typeInformation[previousProperty] = element; 246 '''init.typeInformation[previousProperty] = element;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 newDesc[prop.substring(1)][$metadataField] = element[prop]; 279 newDesc[prop.substring(1)][$metadataField] = element[prop];
280 } else if (firstChar === "*") { 280 } else if (firstChar === "*") {
281 newDesc[previousProp].$defaultValuesField = element[prop]; 281 newDesc[previousProp].$defaultValuesField = element[prop];
282 var optionalMethods = newDesc.$methodsWithOptionalArgumentsField; 282 var optionalMethods = newDesc.$methodsWithOptionalArgumentsField;
283 if (!optionalMethods) { 283 if (!optionalMethods) {
284 newDesc.$methodsWithOptionalArgumentsField = optionalMethods={} 284 newDesc.$methodsWithOptionalArgumentsField = optionalMethods={}
285 } 285 }
286 optionalMethods[prop] = previousProp; 286 optionalMethods[prop] = previousProp;
287 } else { 287 } else {
288 var elem = element[prop]; 288 var elem = element[prop];
289 if (prop && elem != null &&''' // Break long line. 289 if (prop !== "${namer.classDescriptorProperty}" &&'''
290 ''' elem != null &&''' // Break long line.
290 ''' elem.constructor === Array &&''' // Break long line. 291 ''' elem.constructor === Array &&''' // Break long line.
291 ''' prop !== "<>") { 292 ''' prop !== "<>") {
292 addStubs(newDesc, elem, prop, false, element, []); 293 addStubs(newDesc, elem, prop, false, element, []);
293 } else { 294 } else {
294 newDesc[previousProp = prop] = elem; 295 newDesc[previousProp = prop] = elem;
295 } 296 }
296 } 297 }
297 } 298 }
298 $classesCollector[property] = [globalObject, newDesc]; 299 $classesCollector[property] = [globalObject, newDesc];
299 classes.push(property); 300 classes.push(property);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 (function() { 347 (function() {
347 var result = $array[$index]; 348 var result = $array[$index];
348 if ($check) { 349 if ($check) {
349 throw new Error( 350 throw new Error(
350 name + ": expected value of type \'$type\' at index " + ($index) + 351 name + ": expected value of type \'$type\' at index " + ($index) +
351 " but got " + (typeof result)); 352 " but got " + (typeof result));
352 } 353 }
353 return result; 354 return result;
354 })()'''; 355 })()''';
355 } 356 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart ('k') | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698