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

Unified Diff: frog/corejs.dart

Issue 9110027: Some cleanups to Frog to avoid looking up its builtin types too much (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: removed dead files Created 8 years, 11 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: frog/corejs.dart
diff --git a/frog/corejs.dart b/frog/corejs.dart
index b4aa6e64352f99fccab14896f955d3991caf99c1..a10d1ea2bd1ce11a45851cbd6e5516927c8b2af7 100644
--- a/frog/corejs.dart
+++ b/frog/corejs.dart
@@ -101,7 +101,7 @@ class CoreJs {
}
/** Generates the $inherits function when it's first used. */
- ensureInheritsHelper() {
+ void ensureInheritsHelper() {
if (_generatedInherits) return;
_generatedInherits = true;
writer.writeln(_INHERITS_FUNCTION);
@@ -152,6 +152,15 @@ class CoreJs {
for (var opImpl in orderValuesByKeys(_usedOperators)) {
w.writeln(opImpl);
}
+
+ if (world.dom != null) {
+ ensureTypeNameOf();
+ // TODO(jmesserly): we need to find a way to avoid conflicts with other
+ // generated "typeName" fields. Ideally we wouldn't be patching 'Object'
+ // here.
+ w.writeln('Object.prototype.get\$typeName = ' +
+ ' Object.prototype.\$typeNameOf;');
+ }
}
}
@@ -298,9 +307,6 @@ function $dynamicSetMetadata(inputTable) {
""";
/** Snippet for `$typeNameOf`. */
-// TODO(sigmund): find a way to make this work on all browsers, including
-// checking the typeName on prototype objects (so we can fix dynamic
-// dispatching on $varMethod).
final String _TYPE_NAME_OF_FUNCTION = @"""
Object.prototype.$typeNameOf = function() {
if ((typeof(window) != 'undefined' && window.constructor.name == 'DOMWindow')
« no previous file with comments | « client/dom/frog/dom_frog.js ('k') | frog/element.dart » ('j') | frog/member.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698