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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart

Issue 11860008: Stop passing library elements to tons of namer functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
index fc2d9a8ae8775c161373c9023d12ba923d77e4a2..c12f126a6ef2ee6d6e2ff30115893c807e033ee1 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
@@ -262,19 +262,14 @@ function(cls, desc) {
FunctionElement element,
js.Block body,
List<js.Parameter> parameters) {
- String methodName;
- Namer namer = backend.namer;
- if (element.kind == ElementKind.FUNCTION) {
- methodName = namer.instanceMethodName(element);
- } else if (element.kind == ElementKind.GETTER) {
- methodName = namer.getterName(element.getLibrary(), element.name);
- } else if (element.kind == ElementKind.SETTER) {
- methodName = namer.setterName(element.getLibrary(), element.name);
- } else {
- compiler.internalError("unexpected kind: '${element.kind}'",
- element: element);
+ ElementKind kind = element.kind;
+ if (kind != ElementKind.FUNCTION &&
+ kind != ElementKind.GETTER &&
+ kind != ElementKind.SETTER) {
+ compiler.internalError("unexpected kind: '$kind'", element: element);
}
+ String methodName = backend.namer.getName(element);
return new js.Block(
[generateMethodBodyWithPrototypeCheck(methodName, body, parameters)]);
}

Powered by Google App Engine
This is Rietveld 408576698