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

Side by Side Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://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 unified diff | Download patch | Annotate | Revision Log
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 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 String get finishClassesName 62 String get finishClassesName
63 => '${namer.ISOLATE}.\$finishClasses'; 63 => '${namer.ISOLATE}.\$finishClasses';
64 String get finishIsolateConstructorName 64 String get finishIsolateConstructorName
65 => '${namer.ISOLATE}.\$finishIsolateConstructor'; 65 => '${namer.ISOLATE}.\$finishIsolateConstructor';
66 String get pendingClassesName 66 String get pendingClassesName
67 => '${namer.ISOLATE}.\$pendingClasses'; 67 => '${namer.ISOLATE}.\$pendingClasses';
68 String get isolatePropertiesName 68 String get isolatePropertiesName
69 => '${namer.ISOLATE}.${namer.ISOLATE_PROPERTIES}'; 69 => '${namer.ISOLATE}.${namer.ISOLATE_PROPERTIES}';
70 String get supportsProtoName 70 String get supportsProtoName
71 => 'supportsProto'; 71 => 'supportsProto';
72 String get lazyInitializerName() 72 String get lazyInitializerName
73 => '${namer.ISOLATE}.\$lazy'; 73 => '${namer.ISOLATE}.\$lazy';
74 74
75 final String GETTER_SUFFIX = "?"; 75 final String GETTER_SUFFIX = "?";
76 final String SETTER_SUFFIX = "!"; 76 final String SETTER_SUFFIX = "!";
77 final String GETTER_SETTER_SUFFIX = "="; 77 final String GETTER_SETTER_SUFFIX = "=";
78 78
79 String get generateGetterSetterFunction { 79 String get generateGetterSetterFunction {
80 return """ 80 return """
81 function(field, prototype) { 81 function(field, prototype) {
82 var len = field.length; 82 var len = field.length;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 str += "}\\n"; 254 str += "}\\n";
255 var newIsolate = new Function(str); 255 var newIsolate = new Function(str);
256 newIsolate.prototype = isolatePrototype; 256 newIsolate.prototype = isolatePrototype;
257 isolatePrototype.constructor = newIsolate; 257 isolatePrototype.constructor = newIsolate;
258 newIsolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; 258 newIsolate.${namer.ISOLATE_PROPERTIES} = isolateProperties;
259 return newIsolate; 259 return newIsolate;
260 }"""; 260 }""";
261 } 261 }
262 262
263 String get lazyInitializerFunction() { 263 String get lazyInitializerFunction {
264 String isolate = namer.CURRENT_ISOLATE; 264 String isolate = namer.CURRENT_ISOLATE;
265 JavaScriptBackend backend = compiler.backend; 265 JavaScriptBackend backend = compiler.backend;
266 String cyclicThrow = namer.isolateAccess(backend.cyclicThrowHelper); 266 String cyclicThrow = namer.isolateAccess(backend.cyclicThrowHelper);
267 return """ 267 return """
268 function(prototype, staticName, fieldName, getterName, lazyValue) { 268 function(prototype, staticName, fieldName, getterName, lazyValue) {
269 var sentinelUndefined = {}; 269 var sentinelUndefined = {};
270 var sentinelInProgress = {}; 270 var sentinelInProgress = {};
271 prototype[fieldName] = sentinelUndefined; 271 prototype[fieldName] = sentinelUndefined;
272 var getter = new Function("{ return $isolate." + fieldName + ";}"); 272 var getter = new Function("{ return $isolate." + fieldName + ";}");
273 prototype[getterName] = function() { 273 prototype[getterName] = function() {
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 sourceName = token.slowToString(); 1297 sourceName = token.slowToString();
1298 } 1298 }
1299 sourceMapBuilder.addMapping( 1299 sourceMapBuilder.addMapping(
1300 sourceFile, token.charOffset, sourceName, offset); 1300 sourceFile, token.charOffset, sourceName, offset);
1301 }); 1301 });
1302 return sourceMapBuilder.build(compiledFile); 1302 return sourceMapBuilder.build(compiledFile);
1303 } 1303 }
1304 } 1304 }
1305 1305
1306 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition); 1306 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698