Chromium Code Reviews| Index: lib/src/codegen/js_codegen.dart |
| diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart |
| index d7c1cc4c58a24725ce6ef624ae066aafd44c4e35..bb434477e1d35dbb53cc0be6f3970d6449e2579a 100644 |
| --- a/lib/src/codegen/js_codegen.dart |
| +++ b/lib/src/codegen/js_codegen.dart |
| @@ -1447,13 +1447,12 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { |
| /// "extension methods". This allows types to be extended without adding |
| /// extensions directly on the prototype. |
| bool _isJSBuiltinType(DartType t) => |
| - rules.isNumType(t) || rules.isStringType(t) || rules.isBoolType(t); |
| + typeIsPrimitiveInJS(t) || rules.isStringType(t); |
| - bool typeIsPrimitiveInJS(DartType t) => !rules.isDynamic(t) && |
| - (rules.isIntType(t) || |
| - rules.isDoubleType(t) || |
| - rules.isBoolType(t) || |
| - rules.isNumType(t)); |
| + bool typeIsPrimitiveInJS(DartType t) => (rules.isIntType(t) || |
|
Jacob
2015/04/13 23:23:16
was !rules.isDynamic(t) never needed?
Jennifer Messerly
2015/04/14 17:44:02
yeah, it didn't make sense to me (how can int/doub
|
| + rules.isDoubleType(t) || |
| + rules.isBoolType(t) || |
| + rules.isNumType(t)); |
| bool typeIsNonNullablePrimitiveInJS(DartType t) => |
| typeIsPrimitiveInJS(t) && rules.isNonNullableType(t); |
| @@ -1486,7 +1485,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { |
| } else if (expr is PostfixExpression) { |
| type = getStaticType(expr.operand); |
| } |
| - if (type != null && typeIsPrimitiveInJS(type)) { |
| + if (type != null && _isJSBuiltinType(type)) { |
| return true; |
| } |
| if (expr is MethodInvocation) { |
| @@ -1544,7 +1543,9 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor { |
| return js.call(code, [_visit(left), _visit(right)]); |
| } |
| - if (binaryOperationIsPrimitive(leftType, rightType)) { |
| + if (binaryOperationIsPrimitive(leftType, rightType) || |
| + rules.isStringType(leftType) && op.type == TokenType.PLUS) { |
| + |
| // special cases where we inline the operation |
| // these values are assumed to be non-null (determined by the checker) |
| // TODO(jmesserly): it would be nice to just inline the method from core, |