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

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

Issue 2096763004: Remove DeclarationMarcher - incrementally resolve only BlockFunctionBody. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/generated/incremental_resolver.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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 /** 344 /**
345 * Initialize a newly created element builder to build the elements for a 345 * Initialize a newly created element builder to build the elements for a
346 * compilation unit. The [initialHolder] is the element holder to which the 346 * compilation unit. The [initialHolder] is the element holder to which the
347 * children of the visited compilation unit node will be added. 347 * children of the visited compilation unit node will be added.
348 */ 348 */
349 ElementBuilder(ElementHolder initialHolder, this.compilationUnitElement) { 349 ElementBuilder(ElementHolder initialHolder, this.compilationUnitElement) {
350 _currentHolder = initialHolder; 350 _currentHolder = initialHolder;
351 } 351 }
352 352
353 /**
354 * Prepares for incremental resolution of a function body.
355 */
356 void initForFunctionBodyIncrementalResolution() {
357 _inFunction = true;
358 }
359
353 @override 360 @override
354 Object visitAnnotation(Annotation node) { 361 Object visitAnnotation(Annotation node) {
355 // Although it isn't valid to do so because closures are not constant 362 // Although it isn't valid to do so because closures are not constant
356 // expressions, it's possible for one of the arguments to the constructor to 363 // expressions, it's possible for one of the arguments to the constructor to
357 // contain a closure. Wrapping the processing of the annotation this way 364 // contain a closure. Wrapping the processing of the annotation this way
358 // prevents these closures from being added to the list of functions in the 365 // prevents these closures from being added to the list of functions in the
359 // annotated declaration. 366 // annotated declaration.
360 ElementHolder holder = new ElementHolder(); 367 ElementHolder holder = new ElementHolder();
361 ElementHolder previousHolder = _currentHolder; 368 ElementHolder previousHolder = _currentHolder;
362 _currentHolder = holder; 369 _currentHolder = holder;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 e.type = new FunctionTypeImpl(e); 445 e.type = new FunctionTypeImpl(e);
439 } 446 }
440 _functionTypesToFix = null; 447 _functionTypesToFix = null;
441 _currentHolder.addType(element); 448 _currentHolder.addType(element);
442 className.staticElement = element; 449 className.staticElement = element;
443 _fieldMap = null; 450 _fieldMap = null;
444 holder.validate(); 451 holder.validate();
445 return null; 452 return null;
446 } 453 }
447 454
448 /**
449 * Implementation of this method should be synchronized with
450 * [visitClassDeclaration].
451 */
452 void visitClassDeclarationIncrementally(ClassDeclaration node) {
453 //
454 // Process field declarations before constructors and methods so that field
455 // formal parameters can be correctly resolved to their fields.
456 //
457 ClassElement classElement = node.element;
458 _buildFieldMap(classElement.fields);
459 }
460
461 @override 455 @override
462 Object visitClassTypeAlias(ClassTypeAlias node) { 456 Object visitClassTypeAlias(ClassTypeAlias node) {
463 ElementHolder holder = new ElementHolder(); 457 ElementHolder holder = new ElementHolder();
464 _visitChildren(holder, node); 458 _visitChildren(holder, node);
465 SimpleIdentifier className = node.name; 459 SimpleIdentifier className = node.name;
466 ClassElementImpl element = new ClassElementImpl.forNode(className); 460 ClassElementImpl element = new ClassElementImpl.forNode(className);
467 _setCodeRange(element, node); 461 _setCodeRange(element, node);
468 element.metadata = _createElementAnnotations(node.metadata); 462 element.metadata = _createElementAnnotations(node.metadata);
469 element.abstract = node.abstractKeyword != null; 463 element.abstract = node.abstractKeyword != null;
470 element.mixinApplication = true; 464 element.mixinApplication = true;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 return null; 1457 return null;
1464 } 1458 }
1465 1459
1466 /** 1460 /**
1467 * Return the lexical identifiers associated with the given [identifiers]. 1461 * Return the lexical identifiers associated with the given [identifiers].
1468 */ 1462 */
1469 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { 1463 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) {
1470 return identifiers.map((identifier) => identifier.name).toList(); 1464 return identifiers.map((identifier) => identifier.name).toList();
1471 } 1465 }
1472 } 1466 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698