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

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

Issue 1419503008: TBR: bug fixes for switch from [] to JsNative.SetProperty Make calls to .isExternal property more r… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 83bfba90c02077390e7cda9d9eeb6af410af7cc3..ce2c5a2a301356c4fd9d6aaed882123ef83ee98d 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -310,8 +310,9 @@ String _getDeclarationName(mirrors.DeclarationMirror declaration) {
final _JS_LIBRARY_PREFIX = "js_library";
final _UNDEFINED_VAR = "_UNDEFINED_JS_CONST";
-String _accessJsPath(String path) {
- var parts = path.split(".");
+String _accessJsPath(String path) => _accessJsPathHelper(path.split("."));
+
+String _accessJsPathHelper(Iterable<String> parts) {
var sb = new StringBuffer();
sb
..write('${_JS_LIBRARY_PREFIX}.JsNative.getProperty(' * parts.length)
@@ -322,11 +323,10 @@ String _accessJsPath(String path) {
return sb.toString();
}
-
String _accessJsPathSetter(String path) {
var parts = path.split(".");
- return "${_JS_LIBRARY_PREFIX}.JsNative.setProperty(${_accessJsPath(parts.getRange(0, parts.length - 1).join('.'))
- }, '{parts.end}', v)";
+ return "${_JS_LIBRARY_PREFIX}.JsNative.setProperty(${_accessJsPathHelper(parts.getRange(0, parts.length - 1))
+ }, '${parts.last}', v)";
}
@Deprecated("Internal Use Only")
@@ -395,13 +395,12 @@ void addMemberHelper(
sb.write("\n");
}
-// TODO(jacobr): make this check more robust.
-bool _isExternal(mirrors.Mirror mirror) {
- /*
- var source = mirror.source;
- return source != null && source.startsWith("external ");
- */
- return mirror.isExternal;
+bool _isExternal(mirrors.MethodMirror mirror) {
+ // This try-catch block is a workaround for BUG:24834.
+ try {
+ return mirror.isExternal;
+ } catch (e) { }
+ return false;
}
List<String> _generateExternalMethods() {
« 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