| OLD | NEW |
| 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.task.incremental_element_builder_test; | 5 library analyzer.test.src.task.incremental_element_builder_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/dart/element/visitor.dart'; | 9 import 'package:analyzer/dart/element/visitor.dart'; |
| 10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| (...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 analysisOptions.finerGrainedInvalidation = false; | 1994 analysisOptions.finerGrainedInvalidation = false; |
| 1995 try { | 1995 try { |
| 1996 context.setContents(source, newCode); | 1996 context.setContents(source, newCode); |
| 1997 newUnit = context.parseCompilationUnit(source); | 1997 newUnit = context.parseCompilationUnit(source); |
| 1998 IncrementalCompilationUnitElementBuilder builder = | 1998 IncrementalCompilationUnitElementBuilder builder = |
| 1999 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); | 1999 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); |
| 2000 builder.build(); | 2000 builder.build(); |
| 2001 unitDelta = builder.unitDelta; | 2001 unitDelta = builder.unitDelta; |
| 2002 expect(newUnit.element, unitElement); | 2002 expect(newUnit.element, unitElement); |
| 2003 // Flush all tokens, ASTs and elements. | 2003 // Flush all tokens, ASTs and elements. |
| 2004 context.analysisCache.flush((target, result) { | 2004 context.analysisCache.flush((target) => true, (target, result) { |
| 2005 return result == TOKEN_STREAM || | 2005 return result == TOKEN_STREAM || |
| 2006 result == PARSED_UNIT || | 2006 result == PARSED_UNIT || |
| 2007 RESOLVED_UNIT_RESULTS.contains(result) || | 2007 RESOLVED_UNIT_RESULTS.contains(result) || |
| 2008 LIBRARY_ELEMENT_RESULTS.contains(result); | 2008 LIBRARY_ELEMENT_RESULTS.contains(result); |
| 2009 }); | 2009 }); |
| 2010 // Compute a new AST with built elements. | 2010 // Compute a new AST with built elements. |
| 2011 CompilationUnit newUnitFull = context.computeResult( | 2011 CompilationUnit newUnitFull = context.computeResult( |
| 2012 new LibrarySpecificUnit(source, source), RESOLVED_UNIT1); | 2012 new LibrarySpecificUnit(source, source), RESOLVED_UNIT1); |
| 2013 expect(newUnitFull, isNot(same(newUnit))); | 2013 expect(newUnitFull, isNot(same(newUnit))); |
| 2014 new _BuiltElementsValidator().isEqualNodes(newUnitFull, newUnit); | 2014 new _BuiltElementsValidator().isEqualNodes(newUnitFull, newUnit); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 unitMember is ClassDeclaration && unitMember.name.name == name); | 2219 unitMember is ClassDeclaration && unitMember.name.name == name); |
| 2220 } | 2220 } |
| 2221 | 2221 |
| 2222 class _MaterializeLazyElementsVisitor extends GeneralizingElementVisitor { | 2222 class _MaterializeLazyElementsVisitor extends GeneralizingElementVisitor { |
| 2223 @override | 2223 @override |
| 2224 visitExecutableElement(ExecutableElement element) { | 2224 visitExecutableElement(ExecutableElement element) { |
| 2225 element.parameters; | 2225 element.parameters; |
| 2226 super.visitExecutableElement(element); | 2226 super.visitExecutableElement(element); |
| 2227 } | 2227 } |
| 2228 } | 2228 } |
| OLD | NEW |