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

Unified Diff: lib/src/compiler/reify_coercions.dart

Issue 1649583002: allow JS builtin to be typed as needed (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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/compiler/reify_coercions.dart
diff --git a/lib/src/compiler/reify_coercions.dart b/lib/src/compiler/reify_coercions.dart
index 59f97147bdcb416612f104204e867880b6aa2cf6..87ea5e00003851ba9b1cf15a86ea8f7ec027405a 100644
--- a/lib/src/compiler/reify_coercions.dart
+++ b/lib/src/compiler/reify_coercions.dart
@@ -4,15 +4,17 @@
import 'package:analyzer/analyzer.dart' as analyzer;
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/dart/element/type.dart' show DartType;
import 'package:analyzer/src/dart/ast/ast.dart' show FunctionBodyImpl;
import 'package:analyzer/src/dart/ast/utilities.dart' show NodeReplacer;
import 'package:analyzer/src/dart/element/type.dart' show DynamicTypeImpl;
import 'package:analyzer/src/generated/parser.dart' show ResolutionCopier;
-import 'package:analyzer/src/task/strong/info.dart';
+import 'package:analyzer/src/task/strong/info.dart'
+ show CoercionInfo, DownCast, DynamicInvoke;
import 'package:logging/logging.dart' as logger;
-import 'ast_builder.dart';
+import 'ast_builder.dart' show AstBuilder, RawAstBuilder;
+import 'element_helpers.dart' show isInlineJS;
final _log = new logger.Logger('dev_compiler.reify_coercions');
@@ -90,6 +92,10 @@ class CoercionReifier extends analyzer.GeneralizingAstVisitor<Object> {
Expression inner = coerceExpression(e.expression, node);
return new NamedExpression(e.name, inner);
}
+ if (e is MethodInvocation && isInlineJS(e.methodName.staticElement)) {
+ // Inline JS code should not need casts.
+ return e;
+ }
return _castExpression(e, node.convertedType);
}

Powered by Google App Engine
This is Rietveld 408576698