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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 11571004: Implement is-checks for static functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 1d66cb51ee67accab7f1975e5b3c9ce5f2ca86a4..8c1777f9dd1fa86fdda0a2c650d0c76fe69d9c1b 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1244,14 +1244,25 @@ $lazyInitializerLogic
}
void emitStaticFunctionWithNamer(CodeBuffer buffer,
- Element element,
+ FunctionElement element,
CodeBuffer functionBuffer,
String functionNamer(Element element)) {
String functionName = functionNamer(element);
buffer.add('$isolateProperties.$functionName$_=$_');
buffer.add(functionBuffer);
buffer.add('$N$n');
+ for (TypedefElement typedef in checkedTypedefs) {
ngeoffray 2012/12/13 12:38:57 This will add is checks to all static functions. Y
karlklose 2012/12/13 13:08:46 Done.
+ FunctionType typedefType =
+ typedef.computeType(compiler).unalias(compiler);
+ if (compiler.types.isSubtype(element.computeType(compiler),
+ typedefType)) {
+ String typedefName = namer.getName(typedef);
+ buffer.add('$isolateProperties.$functionName'
+ '.is\$$typedefName$_=${_}true$N');
+ }
+ }
}
+
void emitStaticFunctionsWithNamer(CodeBuffer buffer,
Map<Element, CodeBuffer> generatedCode,
String functionNamer(Element element)) {

Powered by Google App Engine
This is Rietveld 408576698