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

Unified Diff: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart

Issue 2150313003: Add JSNative utility class with static methods methods to efficiently manipulate typed JSInterop ob… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix analyzer warnings in js_util_test, skip js_util_test in csp mode and baseline expectations for … Created 4 years, 5 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: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 1f81f6d6b20b329441a0bee3040b08a58fda83a1..efec052e37bd4eba4be5b2e4340d662a0334e658 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -345,6 +345,8 @@ class ProgramBuilder {
for (Element e in elements) {
if (e is ClassElement && backend.isJsInterop(e)) {
e.declaration.forEachMember((_, Element member) {
+ var jsName =
+ backend.nativeData.getUnescapedJSInteropName(member.name);
if (!member.isInstanceMember) return;
if (member.isGetter || member.isField || member.isFunction) {
var selectors =
@@ -354,7 +356,7 @@ class ProgramBuilder {
var stubName = namer.invocationName(selector);
if (stubNames.add(stubName.key)) {
interceptorClass.callStubs.add(_buildStubMethod(stubName,
- js.js('function(obj) { return obj.# }', [member.name]),
+ js.js('function(obj) { return obj.# }', [jsName]),
element: member));
}
}
@@ -367,10 +369,8 @@ class ProgramBuilder {
if (selectors != null && !selectors.isEmpty) {
var stubName = namer.setterForElement(member);
if (stubNames.add(stubName.key)) {
- interceptorClass.callStubs.add(_buildStubMethod(
- stubName,
- js.js('function(obj, v) { return obj.# = v }',
- [member.name]),
+ interceptorClass.callStubs.add(_buildStubMethod(stubName,
+ js.js('function(obj, v) { return obj.# = v }', [jsName]),
element: member));
}
}
@@ -447,7 +447,7 @@ class ProgramBuilder {
interceptorClass.callStubs.add(_buildStubMethod(
stubName,
js.js('function(receiver, #) { return receiver.#(#) }',
- [parameters, member.name, parameters]),
+ [parameters, jsName, parameters]),
element: member));
}
}

Powered by Google App Engine
This is Rietveld 408576698