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

Unified Diff: tool/input_sdk/private/classes.dart

Issue 1700153002: Wrapperless dart:html and friends (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: A couple more tweaks Created 4 years, 10 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 | « tool/input_sdk/lib/web_sql/ddc/web_sql_ddc.dart ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/private/classes.dart
diff --git a/tool/input_sdk/private/classes.dart b/tool/input_sdk/private/classes.dart
index d10c6d727e233ae48a72dfff56db8d02f4046665..4b27c394c23e3b3edc70caaf9a2b59c2f1120433 100644
--- a/tool/input_sdk/private/classes.dart
+++ b/tool/input_sdk/private/classes.dart
@@ -186,6 +186,8 @@ _setStaticSignature(f, sigF) =>
// Set the lazily computed runtime type field on static methods
_setStaticTypes(f, names) => JS('', '''(() => {
for (let name of $names) {
+ // TODO(vsm): Need to generate static methods.
+ if (!$f[name]) continue;
$tagMemoized($f[name], function() {
let parts = $f[$_staticSig][name];
return $definiteFunctionType.apply(null, parts);
@@ -236,7 +238,7 @@ virtualField(subclass, fieldName) => JS('', '''(() => {
let prop = $getOwnPropertyDescriptor($subclass.prototype, $fieldName);
if (prop) return;
- let symbol = Symbol($subclass.name + '.' + $fieldName);
+ let symbol = Symbol($subclass.name + '.' + $fieldName.toString());
$defineProperty($subclass.prototype, $fieldName, {
get: function() { return this[symbol]; },
set: function(x) { this[symbol] = x; }
@@ -265,7 +267,7 @@ final dartx = JS('', '{}');
getExtensionSymbol(name) => JS('', '''(() => {
let sym = $dartx[$name];
- if (!sym) $dartx[$name] = sym = Symbol('dartx.' + $name);
+ if (!sym) $dartx[$name] = sym = Symbol('dartx.' + $name.toString());
return sym;
})()''');
@@ -286,11 +288,13 @@ _installProperties(jsProto, extProto) => JS('', '''(() => {
/// JavaScript class.
///
registerExtension(jsType, dartExtType) => JS('', '''(() => {
+ // TODO(vsm): Not all registered js types are real.
+ if (!jsType) return;
+
let extProto = $dartExtType.prototype;
let jsProto = $jsType.prototype;
// Mark the JS type's instances so we can easily check for extensions.
- $assert_(jsProto[$_extensionType] === void 0);
jsProto[$_extensionType] = $dartExtType;
$_installProperties(jsProto, extProto);
let originalSigFn = $getOwnPropertyDescriptor($dartExtType, $_methodSig).get;
@@ -321,6 +325,11 @@ defineExtensionMembers(type, methodNames) => JS('', '''(() => {
let proto = $type.prototype;
for (let name of $methodNames) {
let method = $getOwnPropertyDescriptor(proto, name);
+ // TODO(vsm): We should be able to generate code to avoid this case.
+ // The method may be null if this type implements a potentially native
+ // interface but isn't native itself. For a field on this type, we're not
+ // generating a corresponding getter/setter method - it's just a field.
+ if (!method) continue;
$defineProperty(proto, $getExtensionSymbol(name), method);
}
// Ensure the signature is available too.
« no previous file with comments | « tool/input_sdk/lib/web_sql/ddc/web_sql_ddc.dart ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698