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

Side by Side Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Functions for asserting equivalence across serialization. 5 /// Functions for asserting equivalence across serialization.
6 6
7 library dart2js.serialization.equivalence; 7 library dart2js.serialization.equivalence;
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common/resolution.dart'; 10 import '../common/resolution.dart';
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 testTokens(node1, node2, 'finallyKeyword', node1.finallyKeyword, 2037 testTokens(node1, node2, 'finallyKeyword', node1.finallyKeyword,
2038 node2.finallyKeyword) && 2038 node2.finallyKeyword) &&
2039 testNodes(node1, node2, 'tryBlock', node1.tryBlock, node2.tryBlock) && 2039 testNodes(node1, node2, 'tryBlock', node1.tryBlock, node2.tryBlock) &&
2040 testNodes(node1, node2, 'catchBlocks', node1.catchBlocks, 2040 testNodes(node1, node2, 'catchBlocks', node1.catchBlocks,
2041 node2.catchBlocks) && 2041 node2.catchBlocks) &&
2042 testNodes(node1, node2, 'finallyBlock', node1.finallyBlock, 2042 testNodes(node1, node2, 'finallyBlock', node1.finallyBlock,
2043 node2.finallyBlock); 2043 node2.finallyBlock);
2044 } 2044 }
2045 2045
2046 @override 2046 @override
2047 bool visitTypeAnnotation(TypeAnnotation node1, TypeAnnotation node2) { 2047 bool visitNominalTypeAnnotation(
2048 NominalTypeAnnotation node1, NominalTypeAnnotation node2) {
2048 return testNodes( 2049 return testNodes(
2049 node1, node2, 'typeName', node1.typeName, node2.typeName) && 2050 node1, node2, 'typeName', node1.typeName, node2.typeName) &&
2050 testNodes(node1, node2, 'typeArguments', node1.typeArguments, 2051 testNodes(node1, node2, 'typeArguments', node1.typeArguments,
2051 node2.typeArguments); 2052 node2.typeArguments);
2052 } 2053 }
2053 2054
2054 @override 2055 @override
2056 bool visitFunctionTypeAnnotation(
2057 FunctionTypeAnnotation node1, FunctionTypeAnnotation node2) {
2058 return testNodes(
2059 node1, node2, 'returnType', node1.returnType, node2.returnType) &&
2060 testNodes(node1, node2, 'formals', node1.formals, node2.formals) &&
2061 testNodes(node1, node2, 'typeParameters', node1.typeParameters,
2062 node2.typeParameters);
2063 }
2064
2065 @override
2055 bool visitTypeVariable(TypeVariable node1, TypeVariable node2) { 2066 bool visitTypeVariable(TypeVariable node1, TypeVariable node2) {
2056 return testNodes(node1, node2, 'name', node1.name, node2.name) && 2067 return testNodes(node1, node2, 'name', node1.name, node2.name) &&
2057 testNodes(node1, node2, 'bound', node1.bound, node2.bound); 2068 testNodes(node1, node2, 'bound', node1.bound, node2.bound);
2058 } 2069 }
2059 2070
2060 @override 2071 @override
2061 bool visitTypedef(Typedef node1, Typedef node2) { 2072 bool visitTypedef(Typedef node1, Typedef node2) {
2062 return testTokens(node1, node2, 'typedefKeyword', node1.typedefKeyword, 2073 return testTokens(node1, node2, 'typedefKeyword', node1.typedefKeyword,
2063 node2.typedefKeyword) && 2074 node2.typedefKeyword) &&
2064 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && 2075 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) &&
2065 testNodes( 2076 testNodes(
2066 node1, node2, 'returnType', node1.returnType, node2.returnType) && 2077 node1, node2, 'returnType', node1.returnType, node2.returnType) &&
2067 testNodes(node1, node2, 'name', node1.name, node2.name) && 2078 testNodes(node1, node2, 'name', node1.name, node2.name) &&
2068 testNodes(node1, node2, 'typeParameters', node1.typeParameters, 2079 testNodes(node1, node2, 'typeParameters', node1.templateParameters,
2069 node2.typeParameters) && 2080 node2.templateParameters) &&
2070 testNodes(node1, node2, 'formals', node1.formals, node2.formals); 2081 testNodes(node1, node2, 'formals', node1.formals, node2.formals);
2071 } 2082 }
2072 2083
2073 @override 2084 @override
2074 bool visitVariableDefinitions( 2085 bool visitVariableDefinitions(
2075 VariableDefinitions node1, VariableDefinitions node2) { 2086 VariableDefinitions node1, VariableDefinitions node2) {
2076 return testNodes( 2087 return testNodes(
2077 node1, node2, 'metadata', node1.metadata, node2.metadata) && 2088 node1, node2, 'metadata', node1.metadata, node2.metadata) &&
2078 testNodes(node1, node2, 'type', node1.type, node2.type) && 2089 testNodes(node1, node2, 'type', node1.type, node2.type) &&
2079 testNodes( 2090 testNodes(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 2125
2115 @override 2126 @override
2116 bool visitStatement(Statement node1, Statement node2) { 2127 bool visitStatement(Statement node1, Statement node2) {
2117 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); 2128 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2');
2118 } 2129 }
2119 2130
2120 @override 2131 @override
2121 bool visitStringNode(StringNode node1, StringNode node2) { 2132 bool visitStringNode(StringNode node1, StringNode node2) {
2122 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); 2133 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2');
2123 } 2134 }
2135
2136 @override
2137 bool visitTypeAnnotation(TypeAnnotation node1, TypeAnnotation node2) {
2138 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2');
2139 }
2124 } 2140 }
2125 2141
2126 bool areMetadataAnnotationsEquivalent( 2142 bool areMetadataAnnotationsEquivalent(
2127 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { 2143 MetadataAnnotation metadata1, MetadataAnnotation metadata2) {
2128 if (metadata1 == metadata2) return true; 2144 if (metadata1 == metadata2) return true;
2129 if (metadata1 == null || metadata2 == null) return false; 2145 if (metadata1 == null || metadata2 == null) return false;
2130 return areElementsEquivalent( 2146 return areElementsEquivalent(
2131 metadata1.annotatedElement, metadata2.annotatedElement) && 2147 metadata1.annotatedElement, metadata2.annotatedElement) &&
2132 areConstantsEquivalent(metadata1.constant, metadata2.constant); 2148 areConstantsEquivalent(metadata1.constant, metadata2.constant);
2133 } 2149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698