Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 7 |
| 8 class OldEmitter implements Emitter { | 8 class OldEmitter implements Emitter { |
| 9 final Compiler compiler; | 9 final Compiler compiler; |
| 10 final CodeEmitterTask task; | 10 final CodeEmitterTask task; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 /** Needs defineClass to be defined. */ | 305 /** Needs defineClass to be defined. */ |
| 306 List buildInheritFrom() { | 306 List buildInheritFrom() { |
| 307 return [js(r''' | 307 return [js(r''' |
| 308 var inheritFrom = function() { | 308 var inheritFrom = function() { |
| 309 function tmp() {} | 309 function tmp() {} |
| 310 var hasOwnProperty = Object.prototype.hasOwnProperty; | 310 var hasOwnProperty = Object.prototype.hasOwnProperty; |
| 311 return function (constructor, superConstructor) { | 311 return function (constructor, superConstructor) { |
| 312 tmp.prototype = superConstructor.prototype; | 312 tmp.prototype = superConstructor.prototype; |
| 313 var object = new tmp(); | 313 var object = new tmp(); |
| 314 var properties = constructor.prototype; | 314 var properties = constructor.prototype; |
| 315 for (var member in properties) | 315 for (var member in properties) { |
| 316 if (hasOwnProperty.call(properties, member)) | 316 if (hasOwnProperty.call(properties, member)) { |
| 317 object[member] = properties[member]; | 317 var s = member.split(':'); |
| 318 if (s.length > 1) { | |
| 319 object[s[0]] = object[s[1]] = properties[member]; | |
| 320 } else { | |
| 321 object[member] = properties[member]; | |
| 322 } | |
| 323 } | |
| 324 } | |
| 318 object.constructor = constructor; | 325 object.constructor = constructor; |
| 319 constructor.prototype = object; | 326 constructor.prototype = object; |
| 320 return object; | 327 return object; |
| 321 }; | 328 }; |
| 322 }() | 329 }() |
| 323 ''')]; | 330 ''')]; |
| 324 } | 331 } |
| 325 | 332 |
| 326 jsAst.Fun get finishClassesFunction { | 333 jsAst.Fun get finishClassesFunction { |
| 327 // Class descriptions are collected in a JS object. | 334 // Class descriptions are collected in a JS object. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 "function \$reflectable(fn){fn.$reflectableField=1;return fn};\\n"+ | 373 "function \$reflectable(fn){fn.$reflectableField=1;return fn};\\n"+ |
| 367 "var \$desc;\\n"; | 374 "var \$desc;\\n"; |
| 368 var constructorsList = []; | 375 var constructorsList = []; |
| 369 } | 376 } |
| 370 | 377 |
| 371 for (var cls in collectedClasses) { | 378 for (var cls in collectedClasses) { |
| 372 var desc = collectedClasses[cls]; | 379 var desc = collectedClasses[cls]; |
| 373 if (desc instanceof Array) desc = desc[1]; | 380 if (desc instanceof Array) desc = desc[1]; |
| 374 | 381 |
| 375 /* The 'fields' are either a constructor function or a | 382 /* The 'fields' are either a constructor function or a |
| 376 * string encoding fields, constructor and superclass. Get | 383 * string encoding fields, constructor and superclass. Get the |
|
floitsch
2014/11/04 13:35:21
Gets
herhut
2014/11/04 13:55:37
Done.
| |
| 377 * the superclass and the fields in the format | 384 * superclass and fields in the format |
| 378 * '[name/]Super;field1,field2' | 385 * '[name/]Super;field1,field2' |
| 379 * from the CLASS_DESCRIPTOR_PROPERTY property on the descriptor. | 386 * from the CLASS_DESCRIPTOR_PROPERTY property on the descriptor. |
| 380 * The 'name/' is optional and contains the name that should be used | 387 * The 'name/' is optional and contains the name that should be used |
| 381 * when printing the runtime type string. It is used, for example, | 388 * when printing the runtime type string. It is used, for example, |
| 382 * to print the runtime type JSInt as 'int'. | 389 * to print the runtime type JSInt as 'int'. |
| 383 */ | 390 */ |
| 384 var classData = desc["${namer.classDescriptorProperty}"], | 391 var classData = desc["${namer.classDescriptorProperty}"], |
| 385 supr, name = cls, fields = classData; | 392 supr, name = cls, fields = classData; |
| 386 if (#) // backend.hasRetainedMetadata | 393 if (#) // backend.hasRetainedMetadata |
| 387 if (typeof classData == "object" && | 394 if (typeof classData == "object" && |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1989 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 1996 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 1990 if (element.isInstanceMember) { | 1997 if (element.isInstanceMember) { |
| 1991 cachedClassBuilders.remove(element.enclosingClass); | 1998 cachedClassBuilders.remove(element.enclosingClass); |
| 1992 | 1999 |
| 1993 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2000 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 1994 | 2001 |
| 1995 } | 2002 } |
| 1996 } | 2003 } |
| 1997 } | 2004 } |
| 1998 } | 2005 } |
| OLD | NEW |