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

Side by Side Diff: pkg/analyzer/test/generated/declaration_resolver_test.dart

Issue 1710763002: Support for 'unary-' in DeclarationResolver. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.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 engine.declaration_resolver_test; 5 library engine.declaration_resolver_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/dart/ast/ast.dart'; 9 import 'package:analyzer/src/dart/ast/ast.dart';
10 import 'package:analyzer/src/dart/ast/utilities.dart'; 10 import 'package:analyzer/src/dart/ast/utilities.dart';
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 main(List<String> items) { 307 main(List<String> items) {
308 items.forEach((item) {}); 308 items.forEach((item) {});
309 } 309 }
310 '''; 310 ''';
311 CompilationUnit unit = resolveSource(code); 311 CompilationUnit unit = resolveSource(code);
312 // re-resolve 312 // re-resolve
313 _cloneResolveUnit(unit); 313 _cloneResolveUnit(unit);
314 // no other validations than built into DeclarationResolver 314 // no other validations than built into DeclarationResolver
315 } 315 }
316 316
317 void test_visitMethodDeclaration_unaryMinus() {
318 String code = r'''
319 class C {
320 C operator -() => null;
321 C operator -(C other) => null;
322 }
323 ''';
324 CompilationUnit unit = resolveSource(code);
325 // re-resolve
326 _cloneResolveUnit(unit);
327 // no other validations than built into DeclarationResolver
328 }
329
317 void test_visitMethodDeclaration_getter_duplicate() { 330 void test_visitMethodDeclaration_getter_duplicate() {
318 String code = r''' 331 String code = r'''
319 class C { 332 class C {
320 int get zzz => 1; 333 int get zzz => 1;
321 String get zzz => null; 334 String get zzz => null;
322 } 335 }
323 '''; 336 ''';
324 CompilationUnit unit = resolveSource(code); 337 CompilationUnit unit = resolveSource(code);
325 PropertyAccessorElement firstElement = 338 PropertyAccessorElement firstElement =
326 _findSimpleIdentifier(unit, code, 'zzz => 1').staticElement; 339 _findSimpleIdentifier(unit, code, 'zzz => 1').staticElement;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 expect(element.type.toString(), "<T>(T, T) → T"); 460 expect(element.type.toString(), "<T>(T, T) → T");
448 expect(t.element, same(tElement)); 461 expect(t.element, same(tElement));
449 462
450 // re-resolve 463 // re-resolve
451 CompilationUnit unit2 = _cloneResolveUnit(unit); 464 CompilationUnit unit2 = _cloneResolveUnit(unit);
452 node = _findSimpleIdentifier(unit2, code, 'max').parent; 465 node = _findSimpleIdentifier(unit2, code, 'max').parent;
453 t = node.typeParameters.typeParameters[0]; 466 t = node.typeParameters.typeParameters[0];
454 expect(t.element, same(tElement)); 467 expect(t.element, same(tElement));
455 } 468 }
456 } 469 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698