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

Side by Side Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 2609063002: Further reduce use of Element in codegen. (Closed)
Patch Set: Created 3 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
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 library js_backend.namer; 5 library js_backend.namer;
6 6
7 import 'dart:collection' show HashMap; 7 import 'dart:collection' show HashMap;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; 9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName;
10 10
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 /// 1362 ///
1363 /// Example translation to JS: 1363 /// Example translation to JS:
1364 /// 1364 ///
1365 /// A.prototype.super$A$foo = function() {...} 1365 /// A.prototype.super$A$foo = function() {...}
1366 /// A.prototype.foo$0 = A.prototype.super$A$foo 1366 /// A.prototype.foo$0 = A.prototype.super$A$foo
1367 /// 1367 ///
1368 /// B.prototype.foo$0 = function() { 1368 /// B.prototype.foo$0 = function() {
1369 /// this.super$A$foo(); // super.foo() 1369 /// this.super$A$foo(); // super.foo()
1370 /// } 1370 /// }
1371 /// 1371 ///
1372 jsAst.Name aliasedSuperMemberPropertyName(Element member) { 1372 jsAst.Name aliasedSuperMemberPropertyName(MemberElement member) {
1373 assert(!member.isField); // Fields do not need super aliases. 1373 assert(!member.isField); // Fields do not need super aliases.
1374 return _disambiguateInternalMember(member, () { 1374 return _disambiguateInternalMember(member, () {
1375 String invocationName = operatorNameToIdentifier(member.name); 1375 String invocationName = operatorNameToIdentifier(member.name);
1376 return "super\$${member.enclosingClass.name}\$$invocationName"; 1376 return "super\$${member.enclosingClass.name}\$$invocationName";
1377 }); 1377 });
1378 } 1378 }
1379 1379
1380 /// Property name in which to store the given static or instance [method]. 1380 /// Property name in which to store the given static or instance [method].
1381 /// For instance methods, this includes the suffix encoding arity and named 1381 /// For instance methods, this includes the suffix encoding arity and named
1382 /// parameters. 1382 /// parameters.
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 void addSuggestion(String original, String suggestion) { 2095 void addSuggestion(String original, String suggestion) {
2096 assert(!_suggestedNames.containsKey(original)); 2096 assert(!_suggestedNames.containsKey(original));
2097 _suggestedNames[original] = suggestion; 2097 _suggestedNames[original] = suggestion;
2098 } 2098 }
2099 2099
2100 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2100 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2101 bool isSuggestion(String candidate) { 2101 bool isSuggestion(String candidate) {
2102 return _suggestedNames.containsValue(candidate); 2102 return _suggestedNames.containsValue(candidate);
2103 } 2103 }
2104 } 2104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698