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

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

Issue 170103003: Avoid use of empty string as a property name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 (function() { 346 (function() {
347 var result = $array[$index]; 347 var result = $array[$index];
348 if ($check) { 348 if ($check) {
349 throw new Error( 349 throw new Error(
350 name + ": expected value of type \'$type\' at index " + ($index) + 350 name + ": expected value of type \'$type\' at index " + ($index) +
351 " but got " + (typeof result)); 351 " but got " + (typeof result));
352 } 352 }
353 return result; 353 return result;
354 })()'''; 354 })()''';
355 } 355 }
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