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

Side by Side Diff: pkg/analyzer/test/src/summary/summary_test.dart

Issue 1533563003: Fix resynthesis of operator[]= from summary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.test.src.summary.summary_test; 5 library analyzer.test.src.summary.summary_test;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/java_engine_io.dart'; 9 import 'package:analyzer/src/generated/java_engine_io.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 serializeClassText('class C { f() {} }').executables[0]; 1207 serializeClassText('class C { f() {} }').executables[0];
1208 expect(executable.isStatic, isFalse); 1208 expect(executable.isStatic, isFalse);
1209 } 1209 }
1210 1210
1211 test_executable_non_static_top_level() { 1211 test_executable_non_static_top_level() {
1212 // Top level executables are considered non-static. 1212 // Top level executables are considered non-static.
1213 UnlinkedExecutable executable = serializeExecutableText('f() {}'); 1213 UnlinkedExecutable executable = serializeExecutableText('f() {}');
1214 expect(executable.isStatic, isFalse); 1214 expect(executable.isStatic, isFalse);
1215 } 1215 }
1216 1216
1217 test_executable_operator_index() {
1218 UnlinkedExecutable executable =
1219 serializeClassText('class C { bool operator[](int i) => null; }')
1220 .executables[0];
1221 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod);
1222 expect(executable.name, '[]');
1223 expect(executable.hasImplicitReturnType, false);
1224 expect(executable.isAbstract, false);
1225 expect(executable.isConst, false);
1226 expect(executable.isFactory, false);
1227 expect(executable.isStatic, false);
1228 expect(executable.parameters, hasLength(1));
1229 checkTypeRef(executable.returnType, 'dart:core', 'dart:core', 'bool');
1230 expect(executable.typeParameters, isEmpty);
1231 }
1232
1233 test_executable_operator_index_set() {
1234 UnlinkedExecutable executable = serializeClassText(
1235 'class C { void operator[]=(int i, bool v) => null; }').executables[0];
1236 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod);
1237 expect(executable.name, '[]=');
1238 expect(executable.hasImplicitReturnType, false);
1239 expect(executable.isAbstract, false);
1240 expect(executable.isConst, false);
1241 expect(executable.isFactory, false);
1242 expect(executable.isStatic, false);
1243 expect(executable.parameters, hasLength(2));
1244 expect(executable.returnType, isNull);
1245 expect(executable.typeParameters, isEmpty);
1246 }
1247
1217 test_executable_param_function_typed() { 1248 test_executable_param_function_typed() {
1218 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); 1249 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}');
1219 expect(executable.parameters[0].isFunctionTyped, isTrue); 1250 expect(executable.parameters[0].isFunctionTyped, isTrue);
1220 // Since the parameter is function-typed it is considered to have an 1251 // Since the parameter is function-typed it is considered to have an
1221 // explicit type, even though that explicit type itself has an implicit 1252 // explicit type, even though that explicit type itself has an implicit
1222 // return type. 1253 // return type.
1223 expect(executable.parameters[0].hasImplicitType, isFalse); 1254 expect(executable.parameters[0].hasImplicitType, isFalse);
1224 } 1255 }
1225 1256
1226 test_executable_param_function_typed_explicit_return_type() { 1257 test_executable_param_function_typed_explicit_return_type() {
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 serializeClassText('class C { static int i; }').fields[0]; 2018 serializeClassText('class C { static int i; }').fields[0];
1988 expect(variable.isStatic, isTrue); 2019 expect(variable.isStatic, isTrue);
1989 } 2020 }
1990 2021
1991 test_variable_type() { 2022 test_variable_type() {
1992 UnlinkedVariable variable = 2023 UnlinkedVariable variable =
1993 serializeVariableText('int i;', variableName: 'i'); 2024 serializeVariableText('int i;', variableName: 'i');
1994 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); 2025 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int');
1995 } 2026 }
1996 } 2027 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698