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

Unified Diff: sdk/lib/js/dartium/js_dartium.dart

Issue 2195453002: Fix so that logic to enable private user define @JS classes does not impact codegen for dart:html n… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix so that logic to enable private user define @JS classes does not impact codegen for dart:html n… Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/js/dartium/js_dartium.dart
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart
index 4ac11975db04d0249fe878dabf686507cd5568e9..a8f0661ac72498f01fc940e603fadc309feca824 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -642,7 +642,8 @@ _generateLibraryCodegen(uri, library, staticCodegen) {
if (isDom || isJsInterop) {
// TODO(jacobr): verify class implements JavaScriptObject.
var className = mirrors.MirrorSystem.getName(clazz.simpleName);
- bool isPrivate = className.startsWith('_');
+ bool isPrivateUserDefinedClass =
+ className.startsWith('_') && !dartLibrary;
var classNameImpl = '${className}Impl';
var sbPatch = new StringBuffer();
if (isJsInterop) {
@@ -715,7 +716,7 @@ _generateLibraryCodegen(uri, library, staticCodegen) {
sbPatch.write(
" static Type get instanceRuntimeType => ${classNameImpl};\n");
}
- if (isPrivate) {
+ if (isPrivateUserDefinedClass) {
terry 2016/08/04 13:50:33 I'm assuming this should not happen? Are there cl
terry 2016/08/04 13:58:21 Looks like there are classes in dart: with undersc
sb.write("""
class ${escapePrivateClassPrefix}${className} implements $className {}
""");
@@ -810,6 +811,9 @@ List<String> _generateInteropPatchFiles(
for (var typeMirror in jsInterfaceTypes) {
mirrors.LibraryMirror libraryMirror = typeMirror.owner;
+ var location = libraryMirror.location;
+ var dartLibrary = location != null && location.sourceUri.scheme == 'dart';
+
var prefixName;
if (libraryPrefixes.containsKey(libraryMirror)) {
prefixName = libraryPrefixes[libraryMirror];
@@ -831,8 +835,9 @@ List<String> _generateInteropPatchFiles(
var isFunction = typeMirror.isSubtypeOf(functionMirror);
var isJSObject = typeMirror.isSubtypeOf(jsObjectMirror);
var className = mirrors.MirrorSystem.getName(typeMirror.simpleName);
- var isPrivate = className.startsWith('_');
- if (isPrivate) className = '${escapePrivateClassPrefix}${className}';
+ var isPrivateUserDefinedClass = className.startsWith('_') && !dartLibrary;
+ if (isPrivateUserDefinedClass)
+ className = '${escapePrivateClassPrefix}${className}';
var fullName = '${prefixName}.${className}';
(isArray ? implementsArray : implements).add(fullName);
if (!isArray && !isFunction && !isJSObject) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698