@@ -1484,7 +1484,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
1484
1484
id = lhs.identifier;
1485
1485
}
1486
1486
1487
- if (target != null && rules. isDynamicTarget (target)) {
1487
+ if (target != null && DynamicInvoke . get (target)) {
1488
1488
return js.call ('dart.$DPUT (#, #, #)' , [
1489
1489
_visit (target),
1490
1490
_emitMemberName (id.name, type: getStaticType (target)),
@@ -1525,7 +1525,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
1525
1525
1526
1526
String code;
1527
1527
if (target == null || isLibraryPrefix (target)) {
1528
- if (rules. isDynamicCall (node.methodName)) {
1528
+ if (DynamicInvoke . get (node.methodName)) {
1529
1529
code = 'dart.$DCALL (#, #)' ;
1530
1530
} else {
1531
1531
code = '#(#)' ;
@@ -1540,9 +1540,9 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
1540
1540
bool isStatic = element is ExecutableElement && element.isStatic;
1541
1541
var memberName = _emitMemberName (name, type: type, isStatic: isStatic);
1542
1542
1543
- if (rules. isDynamicTarget (target)) {
1543
+ if (DynamicInvoke . get (target)) {
1544
1544
code = 'dart.$DSEND (#, #, #)' ;
1545
- } else if (rules. isDynamicCall (node.methodName)) {
1545
+ } else if (DynamicInvoke . get (node.methodName)) {
1546
1546
// This is a dynamic call to a statically know target. For example:
1547
1547
// class Foo { Function bar; }
1548
1548
// new Foo().bar(); // dynamic call
@@ -1584,7 +1584,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
1584
1584
JS .Expression visitFunctionExpressionInvocation (
1585
1585
FunctionExpressionInvocation node) {
1586
1586
var code;
1587
- if (rules. isDynamicCall (node.function)) {
1587
+ if (DynamicInvoke . get (node.function)) {
1588
1588
code = 'dart.$DCALL (#, #)' ;
1589
1589
} else {
1590
1590
code = '#(#)' ;
@@ -1995,6 +1995,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
1995
1995
new SimpleIdentifier (new StringToken (TokenType .IDENTIFIER , name, - 1 ));
1996
1996
id.staticElement = new TemporaryVariableElement .forNode (id);
1997
1997
id.staticType = type;
1998
+ DynamicInvoke .set (id, type.isDynamic);
1998
1999
return id;
1999
2000
}
2000
2001
@@ -2022,25 +2023,30 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
2022
2023
/// needed.
2023
2024
Expression _bindLeftHandSide (
2024
2025
Map <String , JS .Expression > scope, Expression expr, {Expression context}) {
2026
+ Expression result;
2025
2027
if (expr is IndexExpression ) {
2026
2028
IndexExpression index = expr;
2027
- return new IndexExpression .forTarget (
2029
+ result = new IndexExpression .forTarget (
2028
2030
_bindValue (scope, 'o' , index.target, context: context),
2029
2031
index.leftBracket,
2030
2032
_bindValue (scope, 'i' , index.index, context: context),
2031
- index.rightBracket)..staticType = expr.staticType ;
2033
+ index.rightBracket);
2032
2034
} else if (expr is PropertyAccess ) {
2033
2035
PropertyAccess prop = expr;
2034
- return new PropertyAccess (
2036
+ result = new PropertyAccess (
2035
2037
_bindValue (scope, 'o' , _getTarget (prop), context: context),
2036
- prop.operator , prop.propertyName)..staticType = expr.staticType ;
2038
+ prop.operator , prop.propertyName);
2037
2039
} else if (expr is PrefixedIdentifier ) {
2038
2040
PrefixedIdentifier ident = expr;
2039
- return new PrefixedIdentifier (
2041
+ result = new PrefixedIdentifier (
2040
2042
_bindValue (scope, 'o' , ident.prefix, context: context), ident.period,
2041
- ident.identifier)..staticType = expr.staticType;
2043
+ ident.identifier);
2044
+ } else {
2045
+ return expr as SimpleIdentifier ;
2042
2046
}
2043
- return expr as SimpleIdentifier ;
2047
+ result.staticType = expr.staticType;
2048
+ DynamicInvoke .set (result, DynamicInvoke .get (expr));
2049
+ return result;
2044
2050
}
2045
2051
2046
2052
/// Creates a temporary to contain the value of [expr] . The temporary can be
@@ -2216,7 +2222,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
2216
2222
}
2217
2223
var name = _emitMemberName (memberId.name,
2218
2224
type: getStaticType (target), isStatic: isStatic);
2219
- if (rules. isDynamicTarget (target)) {
2225
+ if (DynamicInvoke . get (target)) {
2220
2226
return js.call ('dart.$DLOAD (#, #)' , [_visit (target), name]);
2221
2227
}
2222
2228
@@ -2246,7 +2252,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
2246
2252
Expression target, String name, List <Expression > args) {
2247
2253
var type = getStaticType (target);
2248
2254
var memberName = _emitMemberName (name, unary: args.isEmpty, type: type);
2249
- if (rules. isDynamicTarget (target)) {
2255
+ if (DynamicInvoke . get (target)) {
2250
2256
// dynamic dispatch
2251
2257
var dynamicHelper = const {'[]' : DINDEX , '[]=' : DSETINDEX }[name];
2252
2258
if (dynamicHelper != null ) {
0 commit comments