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

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

Issue 998983002: Ensure that descriptors have a prototype. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Typo Created 5 years, 9 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
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/22776.dart » ('j') | 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 // 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES); 48 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_GLOBAL_NAMES);
49 jsAst.Expression mangledNamesAccess = 49 jsAst.Expression mangledNamesAccess =
50 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_NAMES); 50 emitter.generateEmbeddedGlobalAccess(embeddedNames.MANGLED_NAMES);
51 jsAst.Expression librariesAccess = 51 jsAst.Expression librariesAccess =
52 emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES); 52 emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES);
53 jsAst.Expression typesAccess = 53 jsAst.Expression typesAccess =
54 emitter.generateEmbeddedGlobalAccess(embeddedNames.TYPES); 54 emitter.generateEmbeddedGlobalAccess(embeddedNames.TYPES);
55 55
56 jsAst.Statement processClassData = js.statement('''{ 56 jsAst.Statement processClassData = js.statement('''{
57 function processClassData(cls, descriptor, processedClasses) { 57 function processClassData(cls, descriptor, processedClasses) {
58 var newDesc = map(); // Use a slow object. 58 // Create a proper JavaScript object (as opposed to a map without
59 // prototype) here so that it can be reused as a prototype for instances
60 // of the corresponding class later on.
61 var newDesc = {};
62 newDesc.x = 0; delete newDesc.x; // Make object slow.
59 var previousProperty; 63 var previousProperty;
60 var properties = Object.keys(descriptor); 64 var properties = Object.keys(descriptor);
61 for (var i = 0; i < properties.length; i++) { 65 for (var i = 0; i < properties.length; i++) {
62 var property = properties[i]; 66 var property = properties[i];
63 var firstChar = property.substring(0, 1); 67 var firstChar = property.substring(0, 1);
64 if (property === "static") { 68 if (property === "static") {
65 processStatics(#embeddedStatics[cls] = descriptor[property], 69 processStatics(#embeddedStatics[cls] = descriptor[property],
66 processedClasses); 70 processedClasses);
67 } else if (firstChar === "+") { 71 } else if (firstChar === "+") {
68 mangledNames[previousProperty] = property.substring(1); 72 mangledNames[previousProperty] = property.substring(1);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 (function() { 488 (function() {
485 var result = $array[$index]; 489 var result = $array[$index];
486 if ($check) { 490 if ($check) {
487 throw new Error( 491 throw new Error(
488 name + ": expected value of type \'$type\' at index " + ($index) + 492 name + ": expected value of type \'$type\' at index " + ($index) +
489 " but got " + (typeof result)); 493 " but got " + (typeof result));
490 } 494 }
491 return result; 495 return result;
492 })()'''; 496 })()''';
493 } 497 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/22776.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698