Chromium Code Reviews| Index: pkg/analyzer/lib/src/summary/summarize_const_expr.dart |
| diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart |
| index 6362f01d2f716c430e1075be4e03a247b8a21a6b..d8bf431b6dfb508887c970640a54642370a6bdd4 100644 |
| --- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart |
| +++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart |
| @@ -6,6 +6,7 @@ library serialization.summarize_const_expr; |
| import 'package:analyzer/dart/ast/ast.dart'; |
| import 'package:analyzer/dart/ast/token.dart'; |
| +import 'package:analyzer/dart/element/type.dart' show DartType; |
| import 'package:analyzer/src/summary/format.dart'; |
| import 'package:analyzer/src/summary/idl.dart'; |
| @@ -103,10 +104,10 @@ abstract class AbstractConstExprSerializer { |
| /** |
| * Return [EntityRefBuilder] that corresponds to the constructor having name |
| - * [name] in the class identified by [type]. |
| + * [name] in the class identified by [typeName]. |
|
Paul Berry
2016/05/02 20:35:48
Can you include some documentation of [type] and [
scheglov
2016/05/02 20:55:04
Done.
|
| */ |
| - EntityRefBuilder serializeConstructorName( |
| - TypeName type, SimpleIdentifier name); |
| + EntityRefBuilder serializeConstructorRef(DartType type, Identifier typeName, |
| + TypeArgumentList typeArguments, SimpleIdentifier name); |
| /** |
| * Return [EntityRefBuilder] that corresponds to the given [identifier]. |
| @@ -127,9 +128,19 @@ abstract class AbstractConstExprSerializer { |
| } |
| /** |
| + * Return [EntityRefBuilder] that corresponds to the [name] with the given |
|
Paul Berry
2016/05/02 20:35:48
I think you mean "...to the [type] with the given
scheglov
2016/05/02 20:55:04
Acknowledged.
|
| + * [name] and [arguments]. The parameter [type] might be `null` if the |
| + * type is not resolved. |
| + */ |
| + EntityRefBuilder serializeType( |
| + DartType type, Identifier name, TypeArgumentList arguments); |
| + |
| + /** |
| * Return [EntityRefBuilder] that corresponds to the given [type]. |
| */ |
| - EntityRefBuilder serializeType(TypeName type); |
| + EntityRefBuilder serializeTypeName(TypeName type) { |
| + return serializeType(type?.type, type?.name, type?.typeArguments); |
| + } |
| /** |
| * Return the [UnlinkedConstBuilder] that corresponds to the state of this |
| @@ -226,9 +237,10 @@ abstract class AbstractConstExprSerializer { |
| if (!expr.isConst) { |
| isValidConst = false; |
| } |
| + TypeName typeName = expr.constructorName.type; |
| serializeInstanceCreation( |
| - serializeConstructorName( |
| - expr.constructorName.type, expr.constructorName.name), |
| + serializeConstructorRef(typeName.type, typeName.name, |
| + typeName.typeArguments, expr.constructorName.name), |
| expr.argumentList); |
| } else if (expr is ListLiteral) { |
| _serializeListLiteral(expr); |
| @@ -271,12 +283,12 @@ abstract class AbstractConstExprSerializer { |
| } else if (expr is AsExpression) { |
| isValidConst = false; |
| _serialize(expr.expression); |
| - references.add(serializeType(expr.type)); |
| + references.add(serializeTypeName(expr.type)); |
| operations.add(UnlinkedConstOperation.typeCast); |
| } else if (expr is IsExpression) { |
| isValidConst = false; |
| _serialize(expr.expression); |
| - references.add(serializeType(expr.type)); |
| + references.add(serializeTypeName(expr.type)); |
| operations.add(UnlinkedConstOperation.typeCheck); |
| } else if (expr is ThrowExpression) { |
| isValidConst = false; |
| @@ -408,7 +420,7 @@ abstract class AbstractConstExprSerializer { |
| ints.add(elements.length); |
| if (expr.typeArguments != null && |
| expr.typeArguments.arguments.length == 1) { |
| - references.add(serializeType(expr.typeArguments.arguments[0])); |
| + references.add(serializeTypeName(expr.typeArguments.arguments[0])); |
| operations.add(UnlinkedConstOperation.makeTypedList); |
| } else { |
| operations.add(UnlinkedConstOperation.makeUntypedList); |
| @@ -423,8 +435,8 @@ abstract class AbstractConstExprSerializer { |
| ints.add(expr.entries.length); |
| if (expr.typeArguments != null && |
| expr.typeArguments.arguments.length == 2) { |
| - references.add(serializeType(expr.typeArguments.arguments[0])); |
| - references.add(serializeType(expr.typeArguments.arguments[1])); |
| + references.add(serializeTypeName(expr.typeArguments.arguments[0])); |
| + references.add(serializeTypeName(expr.typeArguments.arguments[1])); |
| operations.add(UnlinkedConstOperation.makeTypedMap); |
| } else { |
| operations.add(UnlinkedConstOperation.makeUntypedMap); |