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

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

Issue 10915104: Move namer into javascript backend. (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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/js_backend/native_emitter.dart
diff --git a/lib/compiler/implementation/js_backend/native_emitter.dart b/lib/compiler/implementation/js_backend/native_emitter.dart
index 8cd5c334bd0325ac0392609dfee93d1bcc9e0beb..f0631747826ee892827b97fbb7f87d6b3bee942c 100644
--- a/lib/compiler/implementation/js_backend/native_emitter.dart
+++ b/lib/compiler/implementation/js_backend/native_emitter.dart
@@ -48,6 +48,7 @@ class NativeEmitter {
nativeBuffer = new CodeBuffer();
Compiler get compiler => emitter.compiler;
+ JavaScriptBackend get backend => compiler.backend;
void addRedirectingMethod(FunctionElement element, String name) {
redirectingMethods[element] = name;
@@ -56,35 +57,35 @@ class NativeEmitter {
String get dynamicName {
Element element = compiler.findHelper(
const SourceString('dynamicFunction'));
- return compiler.namer.isolateAccess(element);
+ return backend.namer.isolateAccess(element);
}
String get dynamicSetMetadataName {
Element element = compiler.findHelper(
const SourceString('dynamicSetMetadata'));
- return compiler.namer.isolateAccess(element);
+ return backend.namer.isolateAccess(element);
}
String get typeNameOfName {
Element element = compiler.findHelper(
const SourceString('getTypeNameOf'));
- return compiler.namer.isolateAccess(element);
+ return backend.namer.isolateAccess(element);
}
String get defPropName {
Element element = compiler.findHelper(
const SourceString('defineProperty'));
- return compiler.namer.isolateAccess(element);
+ return backend.namer.isolateAccess(element);
}
String get toStringHelperName {
Element element = compiler.findHelper(
const SourceString('toStringForNativeObject'));
- return compiler.namer.isolateAccess(element);
+ return backend.namer.isolateAccess(element);
}
String get defineNativeClassName
- => '${compiler.namer.CURRENT_ISOLATE}.\$defineNativeClass';
+ => '${backend.namer.CURRENT_ISOLATE}.\$defineNativeClass';
String get defineNativeClassFunction {
return """
@@ -102,7 +103,7 @@ function(cls, fields, methods) {
void generateNativeLiteral(ClassElement classElement) {
String quotedNative = classElement.nativeName.slowToString();
String nativeCode = quotedNative.substring(2, quotedNative.length - 1);
- String className = compiler.namer.getName(classElement);
+ String className = backend.namer.getName(classElement);
nativeBuffer.add(className);
nativeBuffer.add(' = ');
nativeBuffer.add(nativeCode);
@@ -178,7 +179,7 @@ function(cls, fields, methods) {
FunctionSignature parameters = member.computeSignature(compiler);
Element converter =
compiler.findHelper(const SourceString('convertDartClosureToJS'));
- String closureConverter = compiler.namer.isolateAccess(converter);
+ String closureConverter = backend.namer.isolateAccess(converter);
parameters.forEachParameter((Element parameter) {
String name = parameter.name.slowToString();
// If [name] is not in [argumentsBuffer], then the parameter is
@@ -223,7 +224,7 @@ function(cls, fields, methods) {
// When calling a method that has a native body, we call it
// with our calling conventions.
String arguments = Strings.join(argumentsBuffer, ",");
- code.add(' return this.${compiler.namer.getName(member)}($arguments)');
+ code.add(' return this.${backend.namer.getName(member)}($arguments)');
} else {
// When calling a JS method, we call it with the native name.
String name = redirectingMethods[member];
@@ -385,7 +386,7 @@ function(cls, fields, methods) {
void emitIsChecks(Map<String, String> objectProperties) {
for (Element type in compiler.codegenWorld.isChecks) {
if (!requiresNativeIsCheck(type)) continue;
- String name = compiler.namer.operatorIs(type);
+ String name = backend.namer.operatorIs(type);
objectProperties[name] = 'function() { return false; }';
}
}
@@ -406,7 +407,7 @@ function(cls, fields, methods) {
// In order to have the toString method on every native class,
// we must patch the JS Object prototype with a helper method.
- String toStringName = compiler.namer.instanceMethodName(
+ String toStringName = backend.namer.instanceMethodName(
null, const SourceString('toString'), 0);
objectProperties[toStringName] =
'function() { return $toStringHelperName(this); }';

Powered by Google App Engine
This is Rietveld 408576698