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

Unified Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10978017: Make sure we can use JavaScript properties on Object as classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/js_properties_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/js_backend/emitter.dart
===================================================================
--- lib/compiler/implementation/js_backend/emitter.dart (revision 12781)
+++ lib/compiler/implementation/js_backend/emitter.dart (working copy)
@@ -194,8 +194,9 @@
// object and copy over the members.
return '''
function(collectedClasses) {
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var cls in collectedClasses) {
- if (Object.prototype.hasOwnProperty.call(collectedClasses, cls)) {
+ if (hasOwnProperty.call(collectedClasses, cls)) {
var desc = collectedClasses[cls];
$isolatePropertiesName[cls] = $defineClassName(cls, desc[''], desc);
if (desc['super'] !== "") $pendingClassesName[cls] = desc['super'];
@@ -207,7 +208,10 @@
$pendingClassesName = {};
var finishedClasses = {};
function finishClass(cls) {
- if (finishedClasses[cls]) return;
+'''/* Opera does not support 'getOwnPropertyNames'. Therefore we use
+ hasOwnProperty instead. */'''
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+ if (hasOwnProperty.call(finishedClasses, cls)) return;
finishedClasses[cls] = true;
var superclass = pendingClasses[cls];
'''/* The superclass is only false (empty string) for Dart's Object class. */'''
@@ -225,9 +229,6 @@
var newPrototype = new tmp();
constructor.prototype = newPrototype;
newPrototype.constructor = constructor;
-'''/* Opera does not support 'getOwnPropertyNames'. Therefore we use
- hosOwnProperty instead. */'''
- var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var member in prototype) {
if (member == '' || member == 'super') continue;
if (hasOwnProperty.call(prototype, member)) {
« no previous file with comments | « no previous file | tests/language/js_properties_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698