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

Side by Side Diff: frog/gen.dart

Issue 9214005: Get Firefox and IE working again with Object.defineProperty! (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « frog/corejs.dart ('k') | tests/corelib/corelib.status » ('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) 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 /** 5 /**
6 * Top level generator object for writing code and keeping track of 6 * Top level generator object for writing code and keeping track of
7 * dependencies. 7 * dependencies.
8 * 8 *
9 * Should have two compilation models, but only one implemented so far. 9 * Should have two compilation models, but only one implemented so far.
10 * 10 *
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 writeFunction = writer.enterBlock; 250 writeFunction = writer.enterBlock;
251 ending = ''; 251 ending = '';
252 } 252 }
253 if (type.isObject) { 253 if (type.isObject) {
254 world.counters.objectProtoMembers++; 254 world.counters.objectProtoMembers++;
255 } 255 }
256 if (type.isObject || type.genericType == world.listFactoryType) { 256 if (type.isObject || type.genericType == world.listFactoryType) {
257 // We special case these two so that by default we can use "= function()" 257 // We special case these two so that by default we can use "= function()"
258 // syntax for better readability. 258 // syntax for better readability.
259 if (isOneLiner) { 259 if (isOneLiner) {
260 ending = ', enumerable: false, configurable: true })' + ending; 260 ending = ', enumerable: false, writable: true, configurable: true })' +
261 ending;
261 } 262 }
262 writeFunction('Object.defineProperty(${type.jsname}.prototype, "$name",' + 263 writeFunction('Object.defineProperty(${type.jsname}.prototype, "$name",' +
263 ' { value: $functionBody$ending'); 264 ' { value: $functionBody$ending');
264 if (isOneLiner) return '}'; 265 if (isOneLiner) return '}';
265 return '}, enumerable: false, configurable: true });'; 266 return '}, enumerable: false, writable: true, configurable: true });';
266 } else { 267 } else {
267 writeFunction(_prototypeOf(type, name) + ' = ' + functionBody + ending); 268 writeFunction(_prototypeOf(type, name) + ' = ' + functionBody + ending);
268 return (!isOneLiner) ? '}' : ''; 269 return isOneLiner? '': '}';
269 } 270 }
270 } 271 }
271 272
272 _maybeIsTest(Type onType, Type checkType) { 273 _maybeIsTest(Type onType, Type checkType) {
273 bool isSubtype = onType.isSubtypeOf(checkType); 274 bool isSubtype = onType.isSubtypeOf(checkType);
274 if (checkType.isTested) { 275 if (checkType.isTested) {
275 // TODO(jmesserly): cache these functions? they just return true or false. 276 // TODO(jmesserly): cache these functions? they just return true or false.
276 _writePrototypePatch(onType, 'is\$${checkType.jsname}', 277 _writePrototypePatch(onType, 'is\$${checkType.jsname}',
277 'function(){return $isSubtype}', writer); 278 'function(){return $isSubtype}', writer);
278 } 279 }
(...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); 2784 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false));
2784 } 2785 }
2785 for (int i = bareCount; i < length; i++) { 2786 for (int i = bareCount; i < length; i++) {
2786 var name = getName(i); 2787 var name = getName(i);
2787 if (name == null) name = '\$$i'; 2788 if (name == null) name = '\$$i';
2788 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); 2789 result.add(new Value(world.varType, name, null, /*needsTemp:*/false));
2789 } 2790 }
2790 return new Arguments(nodes, result); 2791 return new Arguments(nodes, result);
2791 } 2792 }
2792 } 2793 }
OLDNEW
« no previous file with comments | « frog/corejs.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698