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

Side by Side Diff: pkg/analysis_server/test/computer/element_test.dart

Issue 578673002: convert engine element setter to completion element setter (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/computer/element.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 test.computer.element; 5 library test.computer.element;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart' as engine; 9 import 'package:analyzer/src/generated/element.dart' as engine;
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 expect(location.offset, 32); 276 expect(location.offset, 32);
277 expect(location.length, 'myGetter'.length); 277 expect(location.length, 'myGetter'.length);
278 expect(location.startLine, 2); 278 expect(location.startLine, 2);
279 expect(location.startColumn, 23); 279 expect(location.startColumn, 23);
280 } 280 }
281 expect(element.parameters, '(int a, {String b})'); 281 expect(element.parameters, '(int a, {String b})');
282 expect(element.returnType, 'List<String>'); 282 expect(element.returnType, 'List<String>');
283 expect(element.flags, Element.FLAG_STATIC); 283 expect(element.flags, Element.FLAG_STATIC);
284 } 284 }
285 285
286 void test_fromElement_SETTER() {
287 Source source = addSource('/test.dart', '''
288 class A {
289 set mySetter(String x) {}
290 }''');
291 CompilationUnit unit = resolveLibraryUnit(source);
292 engine.FieldElement engineFieldElement =
293 findElementInUnit(unit, 'mySetter', engine.ElementKind.FIELD);
294 engine.PropertyAccessorElement engineElement = engineFieldElement.setter;
295 // create notification Element
296 Element element = new Element.fromEngine(engineElement);
297 expect(element.kind, ElementKind.SETTER);
298 expect(element.name, 'mySetter');
299 {
300 Location location = element.location;
301 expect(location.file, '/test.dart');
302 expect(location.offset, 16);
303 expect(location.length, 'mySetter'.length);
304 expect(location.startLine, 2);
305 expect(location.startColumn, 7);
306 }
307 expect(element.parameters, '(String x)');
308 expect(element.returnType, isNull);
309 expect(element.flags, 0);
310 }
311
286 void test_fromElement_dynamic() { 312 void test_fromElement_dynamic() {
287 var engineElement = engine.DynamicElementImpl.instance; 313 var engineElement = engine.DynamicElementImpl.instance;
288 // create notification Element 314 // create notification Element
289 Element element = new Element.fromEngine(engineElement); 315 Element element = new Element.fromEngine(engineElement);
290 expect(element.kind, ElementKind.UNKNOWN); 316 expect(element.kind, ElementKind.UNKNOWN);
291 expect(element.name, 'dynamic'); 317 expect(element.name, 'dynamic');
292 expect(element.location, isNull); 318 expect(element.location, isNull);
293 expect(element.parameters, isNull); 319 expect(element.parameters, isNull);
294 expect(element.returnType, isNull); 320 expect(element.returnType, isNull);
295 expect(element.flags, 0); 321 expect(element.flags, 0);
296 } 322 }
297 } 323 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698