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

Unified Diff: lib/src/checker/resolver.dart

Issue 962083002: support the JS builtin (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: formatting Created 5 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
Index: lib/src/checker/resolver.dart
diff --git a/lib/src/checker/resolver.dart b/lib/src/checker/resolver.dart
index 5ca4c20dae54e941ea7a27f42d784f9624524cd3..4095a9e1136ca8db63e15bbe627f86ac4d7e103f 100644
--- a/lib/src/checker/resolver.dart
+++ b/lib/src/checker/resolver.dart
@@ -363,7 +363,17 @@ class RestrictedStaticTypeAnalyzer extends StaticTypeAnalyzer {
visitMethodInvocation(MethodInvocation node) {
// TODO(sigmund): follow up with analyzer team - why is this needed?
visitSimpleIdentifier(node.methodName);
- return super.visitMethodInvocation(node);
+ super.visitMethodInvocation(node);
+
+ // Fix types for JS builtin calls.
+ // Analyzer has already computed them in the call above, we just need to
+ // save it as the method's static return type.
+ var e = node.methodName.staticElement;
+ if (e is FunctionElement &&
+ e.library.name == '_foreign_helper' &&
+ e.name == 'JS') {
+ node.staticType = node.propagatedType;
vsm 2015/02/27 17:20:05 We haven't been using propagatedType so far - not
Jennifer Messerly 2015/02/27 18:27:07 Analyzer is doing exactly the right logic: https:/
vsm 2015/02/27 18:39:31 I agree, it's doing the right logic right now. I'
Jennifer Messerly 2015/02/27 18:48:09 I'm super confused :| soundness -- what does that
vsm 2015/02/27 18:58:02 Sorry for belaboring the point. :-) Here's anoth
Jennifer Messerly 2015/02/27 19:24:48 ah, gotcha. yeah I see how someone could misunders
+ }
}
// Review note: no longer need to override visitFunctionExpression, this is
« no previous file with comments | « no previous file | lib/src/codegen/js_codegen.dart » ('j') | test/codegen/expect/_isolate_helper/_isolate_helper.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698