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

Side by Side Diff: frog/leg/namer.dart

Issue 9086010: closure calls (just the invocation part). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test status file. 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/leg/elements/elements.dart ('k') | frog/leg/resolver.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * Assigns JavaScript identifiers to Dart variables, class-names and members. 6 * Assigns JavaScript identifiers to Dart variables, class-names and members.
7 */ 7 */
8 class Namer { 8 class Namer {
9 static Set<String> _jsReserved = null; 9 static Set<String> _jsReserved = null;
10 Set<String> get jsReserved() { 10 Set<String> get jsReserved() {
11 if (_jsReserved === null) { 11 if (_jsReserved === null) {
12 _jsReserved = new Set<String>(); 12 _jsReserved = new Set<String>();
13 _jsReserved.addAll(JsNames.javaScriptKeywords); 13 _jsReserved.addAll(JsNames.javaScriptKeywords);
14 _jsReserved.addAll(JsNames.reservedPropertySymbols); 14 _jsReserved.addAll(JsNames.reservedPropertySymbols);
15 } 15 }
16 return _jsReserved; 16 return _jsReserved;
17 } 17 }
18 18
19 Map<Element, String> globals; 19 Map<Element, String> globals;
20 Map<String, int> usedGlobals; 20 Map<String, int> usedGlobals;
21 21
22 Namer() 22 Namer()
23 : globals = new Map<Element, String>(), 23 : globals = new Map<Element, String>(),
24 usedGlobals = new Map<String, int>(); 24 usedGlobals = new Map<String, int>();
25 25
26 String get currentIsolate() => "\$"; 26 String get currentIsolate() => "\$";
27 String get isolate() => "Isolate"; 27 String get isolate() => "Isolate";
28 28
29 29
30 String closureInvocationName() {
31 // TODO(floitsch): mangle, while not conflicting with instance names.
32 return '\$call';
33 }
34
30 String instanceName(SourceString instanceName) { 35 String instanceName(SourceString instanceName) {
31 String candidate = '$instanceName'; 36 String candidate = '$instanceName';
32 // TODO(floitsch): mangle, while preserving uniqueness. 37 // TODO(floitsch): mangle, while preserving uniqueness.
33 return candidate; 38 return candidate;
34 } 39 }
35 40
36 /** 41 /**
37 * The constructor-body name is computed from the corresponding 42 * The constructor-body name is computed from the corresponding
38 * constructor element because, in the case of a super-initialization, the 43 * constructor element because, in the case of a super-initialization, the
39 * body element is not accessible. 44 * body element is not accessible.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (jsId === null) jsId = define(element); 122 if (jsId === null) jsId = define(element);
118 return "$currentIsolate.$jsId"; 123 return "$currentIsolate.$jsId";
119 } 124 }
120 125
121 String isolatePropertyAccess(Element element) { 126 String isolatePropertyAccess(Element element) {
122 String jsId = globals[element]; 127 String jsId = globals[element];
123 if (jsId === null) jsId = define(element); 128 if (jsId === null) jsId = define(element);
124 return "$isolate.prototype.$jsId"; 129 return "$isolate.prototype.$jsId";
125 } 130 }
126 } 131 }
OLDNEW
« no previous file with comments | « frog/leg/elements/elements.dart ('k') | frog/leg/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698