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

Unified Diff: dart/sdk/lib/_internal/lib/js_helper.dart

Issue 104723004: Address late comments from CL 50313007. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Another typo Created 7 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: dart/sdk/lib/_internal/lib/js_helper.dart
diff --git a/dart/sdk/lib/_internal/lib/js_helper.dart b/dart/sdk/lib/_internal/lib/js_helper.dart
index ba5cf5bf68c5ba31092a8d792d645a91e63fd818..2837596419a8c53f56a84724dce8f6dfb664836c 100644
--- a/dart/sdk/lib/_internal/lib/js_helper.dart
+++ b/dart/sdk/lib/_internal/lib/js_helper.dart
@@ -258,6 +258,8 @@ class CachedInvocation {
}
}
+/// A "catch all" invocation is when we cannot directly call a stub. Instead, we
+/// must extend the provided arguments with default arguments.
class CachedCatchAllInvocation extends CachedInvocation {
final ReflectionInfo info;
@@ -1785,7 +1787,7 @@ abstract class Closure implements Function {
var functionType = info.functionType;
- // Create a closure and "monkey" patch it with call stubs.
+ // Create a closure.
Closure closure;
var trampoline = function;
if (!isStatic) {
@@ -1819,6 +1821,7 @@ abstract class Closure implements Function {
JS('', '#.\$signature = #', closure, signatureFunction);
+ // "Monkey" patch the closure with call stubs.
JS('', '#[#] = #', closure, callName, trampoline);
for (int i = 1; i < functions.length; i++) {
var stub = functions[i];
@@ -1828,6 +1831,7 @@ abstract class Closure implements Function {
isStatic ? stub : forwardTo(receiver, stub));
}
+ // Add "catch-all" stub. See [CachedCatchAllInvocation].
JS('', '#["call*"] = #', closure, function);
return closure;
@@ -2373,6 +2377,9 @@ abstract class RuntimeType {
toRti();
}
+/// Tell type inferrer it can't infer the type of [expression].
+obfuscate(expression) => JS('', '#', expression);
+
class RuntimeFunctionType extends RuntimeType {
final RuntimeType returnType;
final List<RuntimeType> parameterTypes;
@@ -2399,18 +2406,14 @@ class RuntimeFunctionType extends RuntimeType {
}
@NoInline() @NoSideEffects()
- _asCheck(expression) {
- // Type inferrer doesn't think this is called with dynamic arguments.
- return _check(JS('', '#', expression), true);
- }
+ _asCheck(expression) => _check(obfuscate(expression), true);
@NoInline() @NoSideEffects()
_assertCheck(expression) {
if (inAssert) return;
inAssert = true; // Don't try to check this library itself.
try {
- // Type inferrer don't think this is called with dynamic arguments.
- return _check(JS('', '#', expression), false);
+ return _check(obfuscate(expression), false);
} finally {
inAssert = false;
}

Powered by Google App Engine
This is Rietveld 408576698