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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/builder.dart

Issue 1668483003: Create ElementAnnotation objects prior to resolution. (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 | « no previous file | pkg/analyzer/lib/src/dart/element/element.dart » ('j') | 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 analyzer.src.dart.element.builder; 5 library analyzer.src.dart.element.builder;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 21 matching lines...) Expand all
32 * if the element could not be built. [librarySource] is the source for the 32 * if the element could not be built. [librarySource] is the source for the
33 * containing library. 33 * containing library.
34 */ 34 */
35 CompilationUnitElementImpl buildCompilationUnit( 35 CompilationUnitElementImpl buildCompilationUnit(
36 Source source, CompilationUnit unit, Source librarySource) { 36 Source source, CompilationUnit unit, Source librarySource) {
37 return PerformanceStatistics.resolve.makeCurrentWhile(() { 37 return PerformanceStatistics.resolve.makeCurrentWhile(() {
38 if (unit == null) { 38 if (unit == null) {
39 return null; 39 return null;
40 } 40 }
41 ElementHolder holder = new ElementHolder(); 41 ElementHolder holder = new ElementHolder();
42 ElementBuilder builder = new ElementBuilder(holder);
43 unit.accept(builder);
44 CompilationUnitElementImpl element = 42 CompilationUnitElementImpl element =
45 new CompilationUnitElementImpl(source.shortName); 43 new CompilationUnitElementImpl(source.shortName);
44 ElementBuilder builder = new ElementBuilder(holder, element);
45 unit.accept(builder);
46 element.accessors = holder.accessors; 46 element.accessors = holder.accessors;
47 element.enums = holder.enums; 47 element.enums = holder.enums;
48 element.functions = holder.functions; 48 element.functions = holder.functions;
49 element.source = source; 49 element.source = source;
50 element.librarySource = librarySource; 50 element.librarySource = librarySource;
51 element.typeAliases = holder.typeAliases; 51 element.typeAliases = holder.typeAliases;
52 element.types = holder.types; 52 element.types = holder.types;
53 element.topLevelVariables = holder.topLevelVariables; 53 element.topLevelVariables = holder.topLevelVariables;
54 unit.element = element; 54 unit.element = element;
55 holder.validate(); 55 holder.validate();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 @override 161 @override
162 Object visitExportDirective(ExportDirective node) { 162 Object visitExportDirective(ExportDirective node) {
163 Source exportedSource = node.source; 163 Source exportedSource = node.source;
164 if (exportedSource != null && context.exists(exportedSource)) { 164 if (exportedSource != null && context.exists(exportedSource)) {
165 // The exported source will be null if the URI in the export 165 // The exported source will be null if the URI in the export
166 // directive was invalid. 166 // directive was invalid.
167 LibraryElement exportedLibrary = exportLibraryMap[exportedSource]; 167 LibraryElement exportedLibrary = exportLibraryMap[exportedSource];
168 if (exportedLibrary != null) { 168 if (exportedLibrary != null) {
169 ExportElementImpl exportElement = new ExportElementImpl(node.offset); 169 ExportElementImpl exportElement = new ExportElementImpl(node.offset);
170 exportElement.metadata = _getElementAnnotations(node.metadata);
170 StringLiteral uriLiteral = node.uri; 171 StringLiteral uriLiteral = node.uri;
171 if (uriLiteral != null) { 172 if (uriLiteral != null) {
172 exportElement.uriOffset = uriLiteral.offset; 173 exportElement.uriOffset = uriLiteral.offset;
173 exportElement.uriEnd = uriLiteral.end; 174 exportElement.uriEnd = uriLiteral.end;
174 } 175 }
175 exportElement.uri = node.uriContent; 176 exportElement.uri = node.uriContent;
176 exportElement.combinators = _buildCombinators(node); 177 exportElement.combinators = _buildCombinators(node);
177 exportElement.exportedLibrary = exportedLibrary; 178 exportElement.exportedLibrary = exportedLibrary;
178 _setDoc(exportElement, node); 179 _setDoc(exportElement, node);
179 node.element = exportElement; 180 node.element = exportElement;
(...skipping 20 matching lines...) Expand all
200 Source importedSource = node.source; 201 Source importedSource = node.source;
201 if (importedSource != null && context.exists(importedSource)) { 202 if (importedSource != null && context.exists(importedSource)) {
202 // The imported source will be null if the URI in the import 203 // The imported source will be null if the URI in the import
203 // directive was invalid. 204 // directive was invalid.
204 LibraryElement importedLibrary = importLibraryMap[importedSource]; 205 LibraryElement importedLibrary = importLibraryMap[importedSource];
205 if (importedLibrary != null) { 206 if (importedLibrary != null) {
206 if (importedLibrary.isDartCore) { 207 if (importedLibrary.isDartCore) {
207 explicitlyImportsCore = true; 208 explicitlyImportsCore = true;
208 } 209 }
209 ImportElementImpl importElement = new ImportElementImpl(node.offset); 210 ImportElementImpl importElement = new ImportElementImpl(node.offset);
211 importElement.metadata = _getElementAnnotations(node.metadata);
210 StringLiteral uriLiteral = node.uri; 212 StringLiteral uriLiteral = node.uri;
211 if (uriLiteral != null) { 213 if (uriLiteral != null) {
212 importElement.uriOffset = uriLiteral.offset; 214 importElement.uriOffset = uriLiteral.offset;
213 importElement.uriEnd = uriLiteral.end; 215 importElement.uriEnd = uriLiteral.end;
214 } 216 }
215 importElement.uri = uriContent; 217 importElement.uri = uriContent;
216 importElement.deferred = node.deferredKeyword != null; 218 importElement.deferred = node.deferredKeyword != null;
217 importElement.combinators = _buildCombinators(node); 219 importElement.combinators = _buildCombinators(node);
218 importElement.importedLibrary = importedLibrary; 220 importElement.importedLibrary = importedLibrary;
219 _setDoc(importElement, node); 221 _setDoc(importElement, node);
(...skipping 16 matching lines...) Expand all
236 ? StaticWarningCode.IMPORT_OF_NON_LIBRARY 238 ? StaticWarningCode.IMPORT_OF_NON_LIBRARY
237 : CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY); 239 : CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY);
238 errors.add(new AnalysisError(importedSource, uriLiteral.offset, 240 errors.add(new AnalysisError(importedSource, uriLiteral.offset,
239 uriLiteral.length, errorCode, [uriLiteral.toSource()])); 241 uriLiteral.length, errorCode, [uriLiteral.toSource()]));
240 } 242 }
241 } 243 }
242 } 244 }
243 return null; 245 return null;
244 } 246 }
245 247
248 @override
249 Object visitLibraryDirective(LibraryDirective node) {
250 (node.element as LibraryElementImpl)?.metadata =
251 _getElementAnnotations(node.metadata);
252 return null;
253 }
254
255 @override
256 Object visitPartDirective(PartDirective node) {
257 (node.element as CompilationUnitElementImpl)?.metadata =
258 _getElementAnnotations(node.metadata);
259 return null;
260 }
261
262 /**
263 * Gather a list of the [ElementAnnotation]s referred to by the [Annotation]s
264 * in [metadata].
265 */
266 List<ElementAnnotation> _getElementAnnotations(
267 NodeList<Annotation> metadata) {
268 if (metadata.isEmpty) {
269 return ElementAnnotation.EMPTY_LIST;
270 }
271 return metadata.map((Annotation a) => a.elementAnnotation).toList();
272 }
273
246 /** 274 /**
247 * If the given [node] has a documentation comment, remember its content 275 * If the given [node] has a documentation comment, remember its content
248 * and range into the given [element]. 276 * and range into the given [element].
249 */ 277 */
250 void _setDoc(ElementImpl element, AnnotatedNode node) { 278 void _setDoc(ElementImpl element, AnnotatedNode node) {
251 Comment comment = node.documentationComment; 279 Comment comment = node.documentationComment;
252 if (comment != null && comment.isDocumentation) { 280 if (comment != null && comment.isDocumentation) {
253 element.documentationComment = 281 element.documentationComment =
254 comment.tokens.map((Token t) => t.lexeme).join('\n'); 282 comment.tokens.map((Token t) => t.lexeme).join('\n');
255 element.setDocRange(comment.offset, comment.length); 283 element.setDocRange(comment.offset, comment.length);
(...skipping 14 matching lines...) Expand all
270 return namespaceCombinatorBuilder.combinators; 298 return namespaceCombinatorBuilder.combinators;
271 } 299 }
272 } 300 }
273 301
274 /** 302 /**
275 * Instances of the class `ElementBuilder` traverse an AST structure and build t he element 303 * Instances of the class `ElementBuilder` traverse an AST structure and build t he element
276 * model representing the AST structure. 304 * model representing the AST structure.
277 */ 305 */
278 class ElementBuilder extends RecursiveAstVisitor<Object> { 306 class ElementBuilder extends RecursiveAstVisitor<Object> {
279 /** 307 /**
308 * The compilation unit element into which the elements being built will be
309 * stored.
310 */
311 final CompilationUnitElement compilationUnitElement;
312
313 /**
280 * The element holder associated with the element that is currently being buil t. 314 * The element holder associated with the element that is currently being buil t.
281 */ 315 */
282 ElementHolder _currentHolder; 316 ElementHolder _currentHolder;
283 317
284 /** 318 /**
285 * A flag indicating whether a variable declaration is in the context of a fie ld declaration. 319 * A flag indicating whether a variable declaration is in the context of a fie ld declaration.
286 */ 320 */
287 bool _inFieldContext = false; 321 bool _inFieldContext = false;
288 322
289 /** 323 /**
(...skipping 13 matching lines...) Expand all
303 * A table mapping field names to field elements for the fields defined in the current class, or 337 * A table mapping field names to field elements for the fields defined in the current class, or
304 * `null` if we are not in the scope of a class. 338 * `null` if we are not in the scope of a class.
305 */ 339 */
306 HashMap<String, FieldElement> _fieldMap; 340 HashMap<String, FieldElement> _fieldMap;
307 341
308 /** 342 /**
309 * Initialize a newly created element builder to build the elements for a comp ilation unit. 343 * Initialize a newly created element builder to build the elements for a comp ilation unit.
310 * 344 *
311 * @param initialHolder the element holder associated with the compilation uni t being built 345 * @param initialHolder the element holder associated with the compilation uni t being built
312 */ 346 */
313 ElementBuilder(ElementHolder initialHolder) { 347 ElementBuilder(ElementHolder initialHolder, this.compilationUnitElement) {
314 _currentHolder = initialHolder; 348 _currentHolder = initialHolder;
315 } 349 }
316 350
317 @override 351 @override
318 Object visitBlock(Block node) { 352 Object visitBlock(Block node) {
319 bool wasInField = _inFieldContext; 353 bool wasInField = _inFieldContext;
320 _inFieldContext = false; 354 _inFieldContext = false;
321 try { 355 try {
322 node.visitChildren(this); 356 node.visitChildren(this);
323 } finally { 357 } finally {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 _buildFieldMap(holder.fieldsWithoutFlushing); 401 _buildFieldMap(holder.fieldsWithoutFlushing);
368 int count = nonFields.length; 402 int count = nonFields.length;
369 for (int i = 0; i < count; i++) { 403 for (int i = 0; i < count; i++) {
370 nonFields[i].accept(this); 404 nonFields[i].accept(this);
371 } 405 }
372 } finally { 406 } finally {
373 _currentHolder = previousHolder; 407 _currentHolder = previousHolder;
374 } 408 }
375 SimpleIdentifier className = node.name; 409 SimpleIdentifier className = node.name;
376 ClassElementImpl element = new ClassElementImpl.forNode(className); 410 ClassElementImpl element = new ClassElementImpl.forNode(className);
411 element.metadata = _createElementAnnotations(node.metadata);
377 List<TypeParameterElement> typeParameters = holder.typeParameters; 412 List<TypeParameterElement> typeParameters = holder.typeParameters;
378 List<DartType> typeArguments = _createTypeParameterTypes(typeParameters); 413 List<DartType> typeArguments = _createTypeParameterTypes(typeParameters);
379 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element); 414 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element);
380 interfaceType.typeArguments = typeArguments; 415 interfaceType.typeArguments = typeArguments;
381 element.type = interfaceType; 416 element.type = interfaceType;
382 element.typeParameters = typeParameters; 417 element.typeParameters = typeParameters;
383 _setDoc(element, node); 418 _setDoc(element, node);
384 element.abstract = node.isAbstract; 419 element.abstract = node.isAbstract;
385 element.accessors = holder.accessors; 420 element.accessors = holder.accessors;
386 List<ConstructorElement> constructors = holder.constructors; 421 List<ConstructorElement> constructors = holder.constructors;
(...skipping 28 matching lines...) Expand all
415 ClassElement classElement = node.element; 450 ClassElement classElement = node.element;
416 _buildFieldMap(classElement.fields); 451 _buildFieldMap(classElement.fields);
417 } 452 }
418 453
419 @override 454 @override
420 Object visitClassTypeAlias(ClassTypeAlias node) { 455 Object visitClassTypeAlias(ClassTypeAlias node) {
421 ElementHolder holder = new ElementHolder(); 456 ElementHolder holder = new ElementHolder();
422 _visitChildren(holder, node); 457 _visitChildren(holder, node);
423 SimpleIdentifier className = node.name; 458 SimpleIdentifier className = node.name;
424 ClassElementImpl element = new ClassElementImpl.forNode(className); 459 ClassElementImpl element = new ClassElementImpl.forNode(className);
460 element.metadata = _createElementAnnotations(node.metadata);
425 element.abstract = node.abstractKeyword != null; 461 element.abstract = node.abstractKeyword != null;
426 element.mixinApplication = true; 462 element.mixinApplication = true;
427 List<TypeParameterElement> typeParameters = holder.typeParameters; 463 List<TypeParameterElement> typeParameters = holder.typeParameters;
428 element.typeParameters = typeParameters; 464 element.typeParameters = typeParameters;
429 List<DartType> typeArguments = _createTypeParameterTypes(typeParameters); 465 List<DartType> typeArguments = _createTypeParameterTypes(typeParameters);
430 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element); 466 InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element);
431 interfaceType.typeArguments = typeArguments; 467 interfaceType.typeArguments = typeArguments;
432 element.type = interfaceType; 468 element.type = interfaceType;
433 _setDoc(element, node); 469 _setDoc(element, node);
434 _currentHolder.addType(element); 470 _currentHolder.addType(element);
435 className.staticElement = element; 471 className.staticElement = element;
436 holder.validate(); 472 holder.validate();
437 return null; 473 return null;
438 } 474 }
439 475
440 @override 476 @override
441 Object visitConstructorDeclaration(ConstructorDeclaration node) { 477 Object visitConstructorDeclaration(ConstructorDeclaration node) {
442 ElementHolder holder = new ElementHolder(); 478 ElementHolder holder = new ElementHolder();
443 bool wasInFunction = _inFunction; 479 bool wasInFunction = _inFunction;
444 _inFunction = true; 480 _inFunction = true;
445 try { 481 try {
446 _visitChildren(holder, node); 482 _visitChildren(holder, node);
447 } finally { 483 } finally {
448 _inFunction = wasInFunction; 484 _inFunction = wasInFunction;
449 } 485 }
450 FunctionBody body = node.body; 486 FunctionBody body = node.body;
451 SimpleIdentifier constructorName = node.name; 487 SimpleIdentifier constructorName = node.name;
452 ConstructorElementImpl element = 488 ConstructorElementImpl element =
453 new ConstructorElementImpl.forNode(constructorName); 489 new ConstructorElementImpl.forNode(constructorName);
490 element.metadata = _createElementAnnotations(node.metadata);
454 _setDoc(element, node); 491 _setDoc(element, node);
455 if (node.externalKeyword != null) { 492 if (node.externalKeyword != null) {
456 element.external = true; 493 element.external = true;
457 } 494 }
458 if (node.factoryKeyword != null) { 495 if (node.factoryKeyword != null) {
459 element.factory = true; 496 element.factory = true;
460 } 497 }
461 element.functions = holder.functions; 498 element.functions = holder.functions;
462 element.labels = holder.labels; 499 element.labels = holder.labels;
463 element.localVariables = holder.localVariables; 500 element.localVariables = holder.localVariables;
(...skipping 20 matching lines...) Expand all
484 } 521 }
485 holder.validate(); 522 holder.validate();
486 return null; 523 return null;
487 } 524 }
488 525
489 @override 526 @override
490 Object visitDeclaredIdentifier(DeclaredIdentifier node) { 527 Object visitDeclaredIdentifier(DeclaredIdentifier node) {
491 SimpleIdentifier variableName = node.identifier; 528 SimpleIdentifier variableName = node.identifier;
492 LocalVariableElementImpl element = 529 LocalVariableElementImpl element =
493 new LocalVariableElementImpl.forNode(variableName); 530 new LocalVariableElementImpl.forNode(variableName);
531 element.metadata = _createElementAnnotations(node.metadata);
494 ForEachStatement statement = node.parent as ForEachStatement; 532 ForEachStatement statement = node.parent as ForEachStatement;
495 int declarationEnd = node.offset + node.length; 533 int declarationEnd = node.offset + node.length;
496 int statementEnd = statement.offset + statement.length; 534 int statementEnd = statement.offset + statement.length;
497 element.setVisibleRange(declarationEnd, statementEnd - declarationEnd - 1); 535 element.setVisibleRange(declarationEnd, statementEnd - declarationEnd - 1);
498 element.const3 = node.isConst; 536 element.const3 = node.isConst;
499 element.final2 = node.isFinal; 537 element.final2 = node.isFinal;
500 if (node.type == null) { 538 if (node.type == null) {
501 element.hasImplicitType = true; 539 element.hasImplicitType = true;
502 } 540 }
503 _currentHolder.addLocalVariable(element); 541 _currentHolder.addLocalVariable(element);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 parameterName.staticElement = parameter; 586 parameterName.staticElement = parameter;
549 normalParameter.accept(this); 587 normalParameter.accept(this);
550 holder.validate(); 588 holder.validate();
551 return null; 589 return null;
552 } 590 }
553 591
554 @override 592 @override
555 Object visitEnumDeclaration(EnumDeclaration node) { 593 Object visitEnumDeclaration(EnumDeclaration node) {
556 SimpleIdentifier enumName = node.name; 594 SimpleIdentifier enumName = node.name;
557 ClassElementImpl enumElement = new ClassElementImpl.forNode(enumName); 595 ClassElementImpl enumElement = new ClassElementImpl.forNode(enumName);
596 enumElement.metadata = _createElementAnnotations(node.metadata);
558 enumElement.enum2 = true; 597 enumElement.enum2 = true;
559 _setDoc(enumElement, node); 598 _setDoc(enumElement, node);
560 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement); 599 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement);
561 enumElement.type = enumType; 600 enumElement.type = enumType;
562 // The equivalent code for enums in the spec shows a single constructor, 601 // The equivalent code for enums in the spec shows a single constructor,
563 // but that constructor is not callable (since it is a compile-time error 602 // but that constructor is not callable (since it is a compile-time error
564 // to subclass, mix-in, implement, or explicitly instantiate an enum). So 603 // to subclass, mix-in, implement, or explicitly instantiate an enum). So
565 // we represent this as having no constructors. 604 // we represent this as having no constructors.
566 enumElement.constructors = ConstructorElement.EMPTY_LIST; 605 enumElement.constructors = ConstructorElement.EMPTY_LIST;
567 _currentHolder.addEnum(enumElement); 606 _currentHolder.addEnum(enumElement);
568 enumName.staticElement = enumElement; 607 enumName.staticElement = enumElement;
569 return super.visitEnumDeclaration(node); 608 return super.visitEnumDeclaration(node);
570 } 609 }
571 610
572 @override 611 @override
612 Object visitExportDirective(ExportDirective node) {
613 _createElementAnnotations(node.metadata);
614 return super.visitExportDirective(node);
615 }
616
617 @override
573 Object visitFieldDeclaration(FieldDeclaration node) { 618 Object visitFieldDeclaration(FieldDeclaration node) {
574 bool wasInField = _inFieldContext; 619 bool wasInField = _inFieldContext;
575 _inFieldContext = true; 620 _inFieldContext = true;
576 try { 621 try {
577 node.visitChildren(this); 622 node.visitChildren(this);
578 } finally { 623 } finally {
579 _inFieldContext = wasInField; 624 _inFieldContext = wasInField;
580 } 625 }
581 return null; 626 return null;
582 } 627 }
(...skipping 15 matching lines...) Expand all
598 _currentHolder.addParameter(parameter); 643 _currentHolder.addParameter(parameter);
599 parameterName.staticElement = parameter; 644 parameterName.staticElement = parameter;
600 } 645 }
601 // 646 //
602 // The children of this parameter include any parameters defined on the type 647 // The children of this parameter include any parameters defined on the type
603 // of this parameter. 648 // of this parameter.
604 // 649 //
605 ElementHolder holder = new ElementHolder(); 650 ElementHolder holder = new ElementHolder();
606 _visitChildren(holder, node); 651 _visitChildren(holder, node);
607 ParameterElementImpl element = node.element; 652 ParameterElementImpl element = node.element;
653 element.metadata = _createElementAnnotations(node.metadata);
608 element.parameters = holder.parameters; 654 element.parameters = holder.parameters;
609 element.typeParameters = holder.typeParameters; 655 element.typeParameters = holder.typeParameters;
610 holder.validate(); 656 holder.validate();
611 return null; 657 return null;
612 } 658 }
613 659
614 @override 660 @override
615 Object visitFunctionDeclaration(FunctionDeclaration node) { 661 Object visitFunctionDeclaration(FunctionDeclaration node) {
616 FunctionExpression expression = node.functionExpression; 662 FunctionExpression expression = node.functionExpression;
617 if (expression != null) { 663 if (expression != null) {
618 ElementHolder holder = new ElementHolder(); 664 ElementHolder holder = new ElementHolder();
619 bool wasInFunction = _inFunction; 665 bool wasInFunction = _inFunction;
620 _inFunction = true; 666 _inFunction = true;
621 try { 667 try {
622 _visitChildren(holder, node); 668 _visitChildren(holder, node);
623 } finally { 669 } finally {
624 _inFunction = wasInFunction; 670 _inFunction = wasInFunction;
625 } 671 }
626 FunctionBody body = expression.body; 672 FunctionBody body = expression.body;
627 Token property = node.propertyKeyword; 673 Token property = node.propertyKeyword;
628 if (property == null || _inFunction) { 674 if (property == null || _inFunction) {
629 SimpleIdentifier functionName = node.name; 675 SimpleIdentifier functionName = node.name;
630 FunctionElementImpl element = 676 FunctionElementImpl element =
631 new FunctionElementImpl.forNode(functionName); 677 new FunctionElementImpl.forNode(functionName);
678 element.metadata = _createElementAnnotations(node.metadata);
632 _setDoc(element, node); 679 _setDoc(element, node);
633 if (node.externalKeyword != null) { 680 if (node.externalKeyword != null) {
634 element.external = true; 681 element.external = true;
635 } 682 }
636 element.functions = holder.functions; 683 element.functions = holder.functions;
637 element.labels = holder.labels; 684 element.labels = holder.labels;
638 element.localVariables = holder.localVariables; 685 element.localVariables = holder.localVariables;
639 element.parameters = holder.parameters; 686 element.parameters = holder.parameters;
640 element.typeParameters = holder.typeParameters; 687 element.typeParameters = holder.typeParameters;
641 if (body.isAsynchronous) { 688 if (body.isAsynchronous) {
(...skipping 27 matching lines...) Expand all
669 .getTopLevelVariable(propertyName) as TopLevelVariableElementImpl; 716 .getTopLevelVariable(propertyName) as TopLevelVariableElementImpl;
670 if (variable == null) { 717 if (variable == null) {
671 variable = new TopLevelVariableElementImpl(node.name.name, -1); 718 variable = new TopLevelVariableElementImpl(node.name.name, -1);
672 variable.final2 = true; 719 variable.final2 = true;
673 variable.synthetic = true; 720 variable.synthetic = true;
674 _currentHolder.addTopLevelVariable(variable); 721 _currentHolder.addTopLevelVariable(variable);
675 } 722 }
676 if (node.isGetter) { 723 if (node.isGetter) {
677 PropertyAccessorElementImpl getter = 724 PropertyAccessorElementImpl getter =
678 new PropertyAccessorElementImpl.forNode(propertyNameNode); 725 new PropertyAccessorElementImpl.forNode(propertyNameNode);
726 getter.metadata = _createElementAnnotations(node.metadata);
679 _setDoc(getter, node); 727 _setDoc(getter, node);
680 if (node.externalKeyword != null) { 728 if (node.externalKeyword != null) {
681 getter.external = true; 729 getter.external = true;
682 } 730 }
683 getter.functions = holder.functions; 731 getter.functions = holder.functions;
684 getter.labels = holder.labels; 732 getter.labels = holder.labels;
685 getter.localVariables = holder.localVariables; 733 getter.localVariables = holder.localVariables;
686 if (body.isAsynchronous) { 734 if (body.isAsynchronous) {
687 getter.asynchronous = true; 735 getter.asynchronous = true;
688 } 736 }
689 if (body.isGenerator) { 737 if (body.isGenerator) {
690 getter.generator = true; 738 getter.generator = true;
691 } 739 }
692 getter.variable = variable; 740 getter.variable = variable;
693 getter.getter = true; 741 getter.getter = true;
694 getter.static = true; 742 getter.static = true;
695 variable.getter = getter; 743 variable.getter = getter;
696 if (node.returnType == null) { 744 if (node.returnType == null) {
697 getter.hasImplicitReturnType = true; 745 getter.hasImplicitReturnType = true;
698 } 746 }
699 _currentHolder.addAccessor(getter); 747 _currentHolder.addAccessor(getter);
700 expression.element = getter; 748 expression.element = getter;
701 propertyNameNode.staticElement = getter; 749 propertyNameNode.staticElement = getter;
702 } else { 750 } else {
703 PropertyAccessorElementImpl setter = 751 PropertyAccessorElementImpl setter =
704 new PropertyAccessorElementImpl.forNode(propertyNameNode); 752 new PropertyAccessorElementImpl.forNode(propertyNameNode);
753 setter.metadata = _createElementAnnotations(node.metadata);
705 _setDoc(setter, node); 754 _setDoc(setter, node);
706 if (node.externalKeyword != null) { 755 if (node.externalKeyword != null) {
707 setter.external = true; 756 setter.external = true;
708 } 757 }
709 setter.functions = holder.functions; 758 setter.functions = holder.functions;
710 setter.labels = holder.labels; 759 setter.labels = holder.labels;
711 setter.localVariables = holder.localVariables; 760 setter.localVariables = holder.localVariables;
712 setter.parameters = holder.parameters; 761 setter.parameters = holder.parameters;
713 if (body.isAsynchronous) { 762 if (body.isAsynchronous) {
714 setter.asynchronous = true; 763 setter.asynchronous = true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 834
786 @override 835 @override
787 Object visitFunctionTypeAlias(FunctionTypeAlias node) { 836 Object visitFunctionTypeAlias(FunctionTypeAlias node) {
788 ElementHolder holder = new ElementHolder(); 837 ElementHolder holder = new ElementHolder();
789 _visitChildren(holder, node); 838 _visitChildren(holder, node);
790 SimpleIdentifier aliasName = node.name; 839 SimpleIdentifier aliasName = node.name;
791 List<ParameterElement> parameters = holder.parameters; 840 List<ParameterElement> parameters = holder.parameters;
792 List<TypeParameterElement> typeParameters = holder.typeParameters; 841 List<TypeParameterElement> typeParameters = holder.typeParameters;
793 FunctionTypeAliasElementImpl element = 842 FunctionTypeAliasElementImpl element =
794 new FunctionTypeAliasElementImpl.forNode(aliasName); 843 new FunctionTypeAliasElementImpl.forNode(aliasName);
844 element.metadata = _createElementAnnotations(node.metadata);
795 _setDoc(element, node); 845 _setDoc(element, node);
796 element.parameters = parameters; 846 element.parameters = parameters;
797 element.typeParameters = typeParameters; 847 element.typeParameters = typeParameters;
798 _createTypeParameterTypes(typeParameters); 848 _createTypeParameterTypes(typeParameters);
799 element.type = new FunctionTypeImpl.forTypedef(element); 849 element.type = new FunctionTypeImpl.forTypedef(element);
800 _currentHolder.addTypeAlias(element); 850 _currentHolder.addTypeAlias(element);
801 aliasName.staticElement = element; 851 aliasName.staticElement = element;
802 holder.validate(); 852 holder.validate();
803 return null; 853 return null;
804 } 854 }
805 855
806 @override 856 @override
807 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { 857 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
808 if (node.parent is! DefaultFormalParameter) { 858 if (node.parent is! DefaultFormalParameter) {
809 SimpleIdentifier parameterName = node.identifier; 859 SimpleIdentifier parameterName = node.identifier;
810 ParameterElementImpl parameter = 860 ParameterElementImpl parameter =
811 new ParameterElementImpl.forNode(parameterName); 861 new ParameterElementImpl.forNode(parameterName);
812 parameter.parameterKind = node.kind; 862 parameter.parameterKind = node.kind;
813 _setParameterVisibleRange(node, parameter); 863 _setParameterVisibleRange(node, parameter);
814 _currentHolder.addParameter(parameter); 864 _currentHolder.addParameter(parameter);
815 parameterName.staticElement = parameter; 865 parameterName.staticElement = parameter;
816 } 866 }
817 // 867 //
818 // The children of this parameter include any parameters defined on the type 868 // The children of this parameter include any parameters defined on the type
819 //of this parameter. 869 //of this parameter.
820 // 870 //
821 ElementHolder holder = new ElementHolder(); 871 ElementHolder holder = new ElementHolder();
822 _visitChildren(holder, node); 872 _visitChildren(holder, node);
823 ParameterElementImpl element = node.element; 873 ParameterElementImpl element = node.element;
874 element.metadata = _createElementAnnotations(node.metadata);
824 element.parameters = holder.parameters; 875 element.parameters = holder.parameters;
825 element.typeParameters = holder.typeParameters; 876 element.typeParameters = holder.typeParameters;
826 holder.validate(); 877 holder.validate();
827 return null; 878 return null;
828 } 879 }
829 880
830 @override 881 @override
882 Object visitImportDirective(ImportDirective node) {
883 _createElementAnnotations(node.metadata);
884 return super.visitImportDirective(node);
885 }
886
887 @override
831 Object visitLabeledStatement(LabeledStatement node) { 888 Object visitLabeledStatement(LabeledStatement node) {
832 bool onSwitchStatement = node.statement is SwitchStatement; 889 bool onSwitchStatement = node.statement is SwitchStatement;
833 for (Label label in node.labels) { 890 for (Label label in node.labels) {
834 SimpleIdentifier labelName = label.label; 891 SimpleIdentifier labelName = label.label;
835 LabelElementImpl element = 892 LabelElementImpl element =
836 new LabelElementImpl(labelName, onSwitchStatement, false); 893 new LabelElementImpl(labelName, onSwitchStatement, false);
837 _currentHolder.addLabel(element); 894 _currentHolder.addLabel(element);
838 labelName.staticElement = element; 895 labelName.staticElement = element;
839 } 896 }
840 return super.visitLabeledStatement(node); 897 return super.visitLabeledStatement(node);
841 } 898 }
842 899
843 @override 900 @override
901 Object visitLibraryDirective(LibraryDirective node) {
902 _createElementAnnotations(node.metadata);
903 return super.visitLibraryDirective(node);
904 }
905
906 @override
844 Object visitMethodDeclaration(MethodDeclaration node) { 907 Object visitMethodDeclaration(MethodDeclaration node) {
845 try { 908 try {
846 ElementHolder holder = new ElementHolder(); 909 ElementHolder holder = new ElementHolder();
847 bool wasInFunction = _inFunction; 910 bool wasInFunction = _inFunction;
848 _inFunction = true; 911 _inFunction = true;
849 try { 912 try {
850 _visitChildren(holder, node); 913 _visitChildren(holder, node);
851 } finally { 914 } finally {
852 _inFunction = wasInFunction; 915 _inFunction = wasInFunction;
853 } 916 }
854 bool isStatic = node.isStatic; 917 bool isStatic = node.isStatic;
855 Token property = node.propertyKeyword; 918 Token property = node.propertyKeyword;
856 FunctionBody body = node.body; 919 FunctionBody body = node.body;
857 if (property == null) { 920 if (property == null) {
858 SimpleIdentifier methodName = node.name; 921 SimpleIdentifier methodName = node.name;
859 String nameOfMethod = methodName.name; 922 String nameOfMethod = methodName.name;
860 if (nameOfMethod == TokenType.MINUS.lexeme && 923 if (nameOfMethod == TokenType.MINUS.lexeme &&
861 node.parameters.parameters.length == 0) { 924 node.parameters.parameters.length == 0) {
862 nameOfMethod = "unary-"; 925 nameOfMethod = "unary-";
863 } 926 }
864 MethodElementImpl element = 927 MethodElementImpl element =
865 new MethodElementImpl(nameOfMethod, methodName.offset); 928 new MethodElementImpl(nameOfMethod, methodName.offset);
929 element.metadata = _createElementAnnotations(node.metadata);
866 _setDoc(element, node); 930 _setDoc(element, node);
867 element.abstract = node.isAbstract; 931 element.abstract = node.isAbstract;
868 if (node.externalKeyword != null) { 932 if (node.externalKeyword != null) {
869 element.external = true; 933 element.external = true;
870 } 934 }
871 element.functions = holder.functions; 935 element.functions = holder.functions;
872 element.labels = holder.labels; 936 element.labels = holder.labels;
873 element.localVariables = holder.localVariables; 937 element.localVariables = holder.localVariables;
874 element.parameters = holder.parameters; 938 element.parameters = holder.parameters;
875 element.static = isStatic; 939 element.static = isStatic;
(...skipping 17 matching lines...) Expand all
893 if (field == null) { 957 if (field == null) {
894 field = new FieldElementImpl(node.name.name, -1); 958 field = new FieldElementImpl(node.name.name, -1);
895 field.final2 = true; 959 field.final2 = true;
896 field.static = isStatic; 960 field.static = isStatic;
897 field.synthetic = true; 961 field.synthetic = true;
898 _currentHolder.addField(field); 962 _currentHolder.addField(field);
899 } 963 }
900 if (node.isGetter) { 964 if (node.isGetter) {
901 PropertyAccessorElementImpl getter = 965 PropertyAccessorElementImpl getter =
902 new PropertyAccessorElementImpl.forNode(propertyNameNode); 966 new PropertyAccessorElementImpl.forNode(propertyNameNode);
967 getter.metadata = _createElementAnnotations(node.metadata);
903 _setDoc(getter, node); 968 _setDoc(getter, node);
904 if (node.externalKeyword != null) { 969 if (node.externalKeyword != null) {
905 getter.external = true; 970 getter.external = true;
906 } 971 }
907 getter.functions = holder.functions; 972 getter.functions = holder.functions;
908 getter.labels = holder.labels; 973 getter.labels = holder.labels;
909 getter.localVariables = holder.localVariables; 974 getter.localVariables = holder.localVariables;
910 if (body.isAsynchronous) { 975 if (body.isAsynchronous) {
911 getter.asynchronous = true; 976 getter.asynchronous = true;
912 } 977 }
913 if (body.isGenerator) { 978 if (body.isGenerator) {
914 getter.generator = true; 979 getter.generator = true;
915 } 980 }
916 getter.variable = field; 981 getter.variable = field;
917 getter.abstract = node.isAbstract; 982 getter.abstract = node.isAbstract;
918 getter.getter = true; 983 getter.getter = true;
919 getter.static = isStatic; 984 getter.static = isStatic;
920 field.getter = getter; 985 field.getter = getter;
921 if (node.returnType == null) { 986 if (node.returnType == null) {
922 getter.hasImplicitReturnType = true; 987 getter.hasImplicitReturnType = true;
923 } 988 }
924 _currentHolder.addAccessor(getter); 989 _currentHolder.addAccessor(getter);
925 propertyNameNode.staticElement = getter; 990 propertyNameNode.staticElement = getter;
926 } else { 991 } else {
927 PropertyAccessorElementImpl setter = 992 PropertyAccessorElementImpl setter =
928 new PropertyAccessorElementImpl.forNode(propertyNameNode); 993 new PropertyAccessorElementImpl.forNode(propertyNameNode);
994 setter.metadata = _createElementAnnotations(node.metadata);
929 _setDoc(setter, node); 995 _setDoc(setter, node);
930 if (node.externalKeyword != null) { 996 if (node.externalKeyword != null) {
931 setter.external = true; 997 setter.external = true;
932 } 998 }
933 setter.functions = holder.functions; 999 setter.functions = holder.functions;
934 setter.labels = holder.labels; 1000 setter.labels = holder.labels;
935 setter.localVariables = holder.localVariables; 1001 setter.localVariables = holder.localVariables;
936 setter.parameters = holder.parameters; 1002 setter.parameters = holder.parameters;
937 if (body.isAsynchronous) { 1003 if (body.isAsynchronous) {
938 setter.asynchronous = true; 1004 setter.asynchronous = true;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 AnalysisEngine.instance.logger.logError( 1051 AnalysisEngine.instance.logger.logError(
986 buffer.toString(), 1052 buffer.toString(),
987 new CaughtException( 1053 new CaughtException(
988 new AnalysisException(buffer.toString()), null)); 1054 new AnalysisException(buffer.toString()), null));
989 } 1055 }
990 } 1056 }
991 return null; 1057 return null;
992 } 1058 }
993 1059
994 @override 1060 @override
1061 Object visitPartDirective(PartDirective node) {
1062 _createElementAnnotations(node.metadata);
1063 return super.visitPartDirective(node);
1064 }
1065
1066 @override
995 Object visitSimpleFormalParameter(SimpleFormalParameter node) { 1067 Object visitSimpleFormalParameter(SimpleFormalParameter node) {
996 if (node.parent is! DefaultFormalParameter) { 1068 if (node.parent is! DefaultFormalParameter) {
997 SimpleIdentifier parameterName = node.identifier; 1069 SimpleIdentifier parameterName = node.identifier;
998 ParameterElementImpl parameter = 1070 ParameterElementImpl parameter =
999 new ParameterElementImpl.forNode(parameterName); 1071 new ParameterElementImpl.forNode(parameterName);
1000 parameter.const3 = node.isConst; 1072 parameter.const3 = node.isConst;
1001 parameter.final2 = node.isFinal; 1073 parameter.final2 = node.isFinal;
1002 parameter.parameterKind = node.kind; 1074 parameter.parameterKind = node.kind;
1003 _setParameterVisibleRange(node, parameter); 1075 _setParameterVisibleRange(node, parameter);
1004 if (node.type == null) { 1076 if (node.type == null) {
1005 parameter.hasImplicitType = true; 1077 parameter.hasImplicitType = true;
1006 } 1078 }
1007 _currentHolder.addParameter(parameter); 1079 _currentHolder.addParameter(parameter);
1008 parameterName.staticElement = parameter; 1080 parameterName.staticElement = parameter;
1009 } 1081 }
1010 return super.visitSimpleFormalParameter(node); 1082 super.visitSimpleFormalParameter(node);
1083 (node.element as ElementImpl).metadata =
1084 _createElementAnnotations(node.metadata);
1085 return null;
1011 } 1086 }
1012 1087
1013 @override 1088 @override
1014 Object visitSwitchCase(SwitchCase node) { 1089 Object visitSwitchCase(SwitchCase node) {
1015 for (Label label in node.labels) { 1090 for (Label label in node.labels) {
1016 SimpleIdentifier labelName = label.label; 1091 SimpleIdentifier labelName = label.label;
1017 LabelElementImpl element = new LabelElementImpl(labelName, false, true); 1092 LabelElementImpl element = new LabelElementImpl(labelName, false, true);
1018 _currentHolder.addLabel(element); 1093 _currentHolder.addLabel(element);
1019 labelName.staticElement = element; 1094 labelName.staticElement = element;
1020 } 1095 }
1021 return super.visitSwitchCase(node); 1096 return super.visitSwitchCase(node);
1022 } 1097 }
1023 1098
1024 @override 1099 @override
1025 Object visitSwitchDefault(SwitchDefault node) { 1100 Object visitSwitchDefault(SwitchDefault node) {
1026 for (Label label in node.labels) { 1101 for (Label label in node.labels) {
1027 SimpleIdentifier labelName = label.label; 1102 SimpleIdentifier labelName = label.label;
1028 LabelElementImpl element = new LabelElementImpl(labelName, false, true); 1103 LabelElementImpl element = new LabelElementImpl(labelName, false, true);
1029 _currentHolder.addLabel(element); 1104 _currentHolder.addLabel(element);
1030 labelName.staticElement = element; 1105 labelName.staticElement = element;
1031 } 1106 }
1032 return super.visitSwitchDefault(node); 1107 return super.visitSwitchDefault(node);
1033 } 1108 }
1034 1109
1035 @override 1110 @override
1036 Object visitTypeParameter(TypeParameter node) { 1111 Object visitTypeParameter(TypeParameter node) {
1037 SimpleIdentifier parameterName = node.name; 1112 SimpleIdentifier parameterName = node.name;
1038 TypeParameterElementImpl typeParameter = 1113 TypeParameterElementImpl typeParameter =
1039 new TypeParameterElementImpl.forNode(parameterName); 1114 new TypeParameterElementImpl.forNode(parameterName);
1115 typeParameter.metadata = _createElementAnnotations(node.metadata);
1040 TypeParameterTypeImpl typeParameterType = 1116 TypeParameterTypeImpl typeParameterType =
1041 new TypeParameterTypeImpl(typeParameter); 1117 new TypeParameterTypeImpl(typeParameter);
1042 typeParameter.type = typeParameterType; 1118 typeParameter.type = typeParameterType;
1043 _currentHolder.addTypeParameter(typeParameter); 1119 _currentHolder.addTypeParameter(typeParameter);
1044 parameterName.staticElement = typeParameter; 1120 parameterName.staticElement = typeParameter;
1045 return super.visitTypeParameter(node); 1121 return super.visitTypeParameter(node);
1046 } 1122 }
1047 1123
1048 @override 1124 @override
1049 Object visitVariableDeclaration(VariableDeclaration node) { 1125 Object visitVariableDeclaration(VariableDeclaration node) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 parameter.synthetic = true; 1222 parameter.synthetic = true;
1147 parameter.parameterKind = ParameterKind.REQUIRED; 1223 parameter.parameterKind = ParameterKind.REQUIRED;
1148 setter.parameters = <ParameterElement>[parameter]; 1224 setter.parameters = <ParameterElement>[parameter];
1149 _currentHolder.addAccessor(setter); 1225 _currentHolder.addAccessor(setter);
1150 element.setter = setter; 1226 element.setter = setter;
1151 } 1227 }
1152 } 1228 }
1153 return null; 1229 return null;
1154 } 1230 }
1155 1231
1232 @override
1233 Object visitVariableDeclarationList(VariableDeclarationList node) {
1234 super.visitVariableDeclarationList(node);
1235 AstNode parent = node.parent;
1236 List<ElementAnnotation> elementAnnotations;
1237 if (parent is FieldDeclaration) {
1238 elementAnnotations = _createElementAnnotations(parent.metadata);
1239 } else if (parent is TopLevelVariableDeclaration) {
1240 elementAnnotations = _createElementAnnotations(parent.metadata);
1241 } else {
1242 // Local variable declaration
1243 elementAnnotations = _createElementAnnotations(node.metadata);
1244 }
1245 for (VariableDeclaration variableDeclaration in node.variables) {
1246 (variableDeclaration.element as ElementImpl).metadata =
1247 elementAnnotations;
1248 }
1249 return null;
1250 }
1251
1156 /** 1252 /**
1157 * Build the table mapping field names to field elements for the fields define d in the current 1253 * Build the table mapping field names to field elements for the fields define d in the current
1158 * class. 1254 * class.
1159 * 1255 *
1160 * @param fields the field elements defined in the current class 1256 * @param fields the field elements defined in the current class
1161 */ 1257 */
1162 void _buildFieldMap(List<FieldElement> fields) { 1258 void _buildFieldMap(List<FieldElement> fields) {
1163 _fieldMap = new HashMap<String, FieldElement>(); 1259 _fieldMap = new HashMap<String, FieldElement>();
1164 int count = fields.length; 1260 int count = fields.length;
1165 for (int i = 0; i < count; i++) { 1261 for (int i = 0; i < count; i++) {
(...skipping 13 matching lines...) Expand all
1179 ConstructorElementImpl constructor = 1275 ConstructorElementImpl constructor =
1180 new ConstructorElementImpl.forNode(null); 1276 new ConstructorElementImpl.forNode(null);
1181 constructor.synthetic = true; 1277 constructor.synthetic = true;
1182 constructor.returnType = definingClass.type; 1278 constructor.returnType = definingClass.type;
1183 constructor.enclosingElement = definingClass; 1279 constructor.enclosingElement = definingClass;
1184 constructor.type = new FunctionTypeImpl(constructor); 1280 constructor.type = new FunctionTypeImpl(constructor);
1185 return <ConstructorElement>[constructor]; 1281 return <ConstructorElement>[constructor];
1186 } 1282 }
1187 1283
1188 /** 1284 /**
1285 * For each [Annotation] found in [annotations], create a new
1286 * [ElementAnnotation] object and set the [Annotation] to point to it.
1287 */
1288 List<ElementAnnotation> _createElementAnnotations(
1289 NodeList<Annotation> annotations) {
1290 if (annotations.isEmpty) {
1291 return ElementAnnotation.EMPTY_LIST;
1292 }
1293 return annotations.map((Annotation a) {
1294 ElementAnnotationImpl elementAnnotation =
1295 new ElementAnnotationImpl(compilationUnitElement);
1296 a.elementAnnotation = elementAnnotation;
1297 return elementAnnotation;
1298 }).toList();
1299 }
1300
1301 /**
1189 * Create the types associated with the given type parameters, setting the typ e of each type 1302 * Create the types associated with the given type parameters, setting the typ e of each type
1190 * parameter, and return an array of types corresponding to the given paramete rs. 1303 * parameter, and return an array of types corresponding to the given paramete rs.
1191 * 1304 *
1192 * @param typeParameters the type parameters for which types are to be created 1305 * @param typeParameters the type parameters for which types are to be created
1193 * @return an array of types corresponding to the given parameters 1306 * @return an array of types corresponding to the given parameters
1194 */ 1307 */
1195 List<DartType> _createTypeParameterTypes( 1308 List<DartType> _createTypeParameterTypes(
1196 List<TypeParameterElement> typeParameters) { 1309 List<TypeParameterElement> typeParameters) {
1197 int typeParameterCount = typeParameters.length; 1310 int typeParameterCount = typeParameters.length;
1198 List<DartType> typeArguments = new List<DartType>(typeParameterCount); 1311 List<DartType> typeArguments = new List<DartType>(typeParameterCount);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 return null; 1454 return null;
1342 } 1455 }
1343 1456
1344 /** 1457 /**
1345 * Return the lexical identifiers associated with the given [identifiers]. 1458 * Return the lexical identifiers associated with the given [identifiers].
1346 */ 1459 */
1347 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { 1460 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) {
1348 return identifiers.map((identifier) => identifier.name).toList(); 1461 return identifiers.map((identifier) => identifier.name).toList();
1349 } 1462 }
1350 } 1463 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/element/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698