| OLD | NEW |
| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| 11 import 'dart:async'; | 11 import 'dart:async'; |
| 12 import 'dart:collection'; | 12 import 'dart:collection'; |
| 13 | 13 |
| 14 import 'package:analyzer/src/task/task_dart.dart'; | 14 import 'package:analyzer/src/task/task_dart.dart'; |
| 15 | 15 |
| 16 import 'ast.dart'; | 16 import 'ast.dart'; |
| 17 import 'constant.dart'; | 17 import 'constant.dart'; |
| 18 import 'element.dart'; | 18 import 'element.dart'; |
| 19 import 'error.dart'; | 19 import 'error.dart'; |
| 20 import 'error_verifier.dart'; | 20 import 'error_verifier.dart'; |
| 21 import 'html.dart' as ht; | 21 import 'html.dart' as ht; |
| 22 import 'incremental_scanner.dart'; | |
| 23 import 'incremental_resolver.dart' show IncrementalResolver, | 22 import 'incremental_resolver.dart' show IncrementalResolver, |
| 24 poorMansIncrementalResolution; | 23 poorMansIncrementalResolution; |
| 24 import 'incremental_scanner.dart'; |
| 25 import 'instrumentation.dart'; | 25 import 'instrumentation.dart'; |
| 26 import 'java_core.dart'; | 26 import 'java_core.dart'; |
| 27 import 'java_engine.dart'; | 27 import 'java_engine.dart'; |
| 28 import 'parser.dart' show Parser, IncrementalParser; | 28 import 'parser.dart' show Parser, IncrementalParser; |
| 29 import 'resolver.dart'; | 29 import 'resolver.dart'; |
| 30 import 'scanner.dart'; | 30 import 'scanner.dart'; |
| 31 import 'sdk.dart' show DartSdk; | 31 import 'sdk.dart' show DartSdk; |
| 32 import 'source.dart'; | 32 import 'source.dart'; |
| 33 import 'utilities_collection.dart'; | 33 import 'utilities_collection.dart'; |
| 34 import 'utilities_general.dart'; | 34 import 'utilities_general.dart'; |
| (...skipping 4879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4914 dartEntry.recordContentError( | 4914 dartEntry.recordContentError( |
| 4915 new CaughtException( | 4915 new CaughtException( |
| 4916 new AnalysisException("This source was marked as being deleted"), | 4916 new AnalysisException("This source was marked as being deleted"), |
| 4917 null)); | 4917 null)); |
| 4918 } | 4918 } |
| 4919 _workManager.remove(source); | 4919 _workManager.remove(source); |
| 4920 _removeFromPriorityOrder(source); | 4920 _removeFromPriorityOrder(source); |
| 4921 } | 4921 } |
| 4922 | 4922 |
| 4923 /** | 4923 /** |
| 4924 * TODO(scheglov) A hackish, limited incremental resolution implementation. | |
| 4925 */ | |
| 4926 bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) { | |
| 4927 List<Source> librarySources = getLibrariesContaining(unitSource); | |
| 4928 if (librarySources.length != 1) { | |
| 4929 return false; | |
| 4930 } | |
| 4931 CompilationUnit oldUnit = | |
| 4932 getResolvedCompilationUnit2(unitSource, librarySources[0]); | |
| 4933 bool success = poorMansIncrementalResolution(typeProvider, oldUnit, newCode)
; | |
| 4934 if (!success) { | |
| 4935 return false; | |
| 4936 } | |
| 4937 ChangeNoticeImpl notice = _getNotice(unitSource); | |
| 4938 notice.compilationUnit = oldUnit; | |
| 4939 // TODO(scheglov) apply updated errors | |
| 4940 { | |
| 4941 LineInfo lineInfo = getLineInfo(unitSource); | |
| 4942 DartEntry dartEntry = _cache.get(unitSource); | |
| 4943 notice.setErrors(dartEntry.allErrors, lineInfo); | |
| 4944 } | |
| 4945 return true; | |
| 4946 } | |
| 4947 | |
| 4948 /** | |
| 4949 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 4924 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 4950 * | 4925 * |
| 4951 * @param source the source that has been removed | 4926 * @param source the source that has been removed |
| 4952 */ | 4927 */ |
| 4953 void _sourceRemoved(Source source) { | 4928 void _sourceRemoved(Source source) { |
| 4954 SourceEntry sourceEntry = _cache.get(source); | 4929 SourceEntry sourceEntry = _cache.get(source); |
| 4955 if (sourceEntry is HtmlEntry) { | 4930 if (sourceEntry is HtmlEntry) { |
| 4956 _invalidateAngularResolution(sourceEntry); | 4931 _invalidateAngularResolution(sourceEntry); |
| 4957 } else if (sourceEntry is DartEntry) { | 4932 } else if (sourceEntry is DartEntry) { |
| 4958 HashSet<Source> libraries = new HashSet<Source>(); | 4933 HashSet<Source> libraries = new HashSet<Source>(); |
| 4959 for (Source librarySource in getLibrariesContaining(source)) { | 4934 for (Source librarySource in getLibrariesContaining(source)) { |
| 4960 libraries.add(librarySource); | 4935 libraries.add(librarySource); |
| 4961 for (Source dependentLibrary in getLibrariesDependingOn( | 4936 for (Source dependentLibrary in getLibrariesDependingOn( |
| 4962 librarySource)) { | 4937 librarySource)) { |
| 4963 libraries.add(dependentLibrary); | 4938 libraries.add(dependentLibrary); |
| 4964 } | 4939 } |
| 4965 } | 4940 } |
| 4966 for (Source librarySource in libraries) { | 4941 for (Source librarySource in libraries) { |
| 4967 _invalidateLibraryResolution(librarySource); | 4942 _invalidateLibraryResolution(librarySource); |
| 4968 } | 4943 } |
| 4969 } | 4944 } |
| 4970 _cache.remove(source); | 4945 _cache.remove(source); |
| 4971 _workManager.remove(source); | 4946 _workManager.remove(source); |
| 4972 _removeFromPriorityOrder(source); | 4947 _removeFromPriorityOrder(source); |
| 4973 } | 4948 } |
| 4974 | 4949 |
| 4975 /** | 4950 /** |
| 4951 * TODO(scheglov) A hackish, limited incremental resolution implementation. |
| 4952 */ |
| 4953 bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) { |
| 4954 List<Source> librarySources = getLibrariesContaining(unitSource); |
| 4955 if (librarySources.length != 1) { |
| 4956 return false; |
| 4957 } |
| 4958 CompilationUnit oldUnit = |
| 4959 getResolvedCompilationUnit2(unitSource, librarySources[0]); |
| 4960 bool success = |
| 4961 poorMansIncrementalResolution(typeProvider, oldUnit, newCode); |
| 4962 if (!success) { |
| 4963 return false; |
| 4964 } |
| 4965 ChangeNoticeImpl notice = _getNotice(unitSource); |
| 4966 notice.compilationUnit = oldUnit; |
| 4967 // TODO(scheglov) apply updated errors |
| 4968 { |
| 4969 LineInfo lineInfo = getLineInfo(unitSource); |
| 4970 DartEntry dartEntry = _cache.get(unitSource); |
| 4971 notice.setErrors(dartEntry.allErrors, lineInfo); |
| 4972 } |
| 4973 return true; |
| 4974 } |
| 4975 |
| 4976 /** |
| 4976 * Check the cache for any invalid entries (entries whose modification time do
es not match the | 4977 * Check the cache for any invalid entries (entries whose modification time do
es not match the |
| 4977 * modification time of the source associated with the entry). Invalid entries
will be marked as | 4978 * modification time of the source associated with the entry). Invalid entries
will be marked as |
| 4978 * invalid so that the source will be re-analyzed. | 4979 * invalid so that the source will be re-analyzed. |
| 4979 * | 4980 * |
| 4980 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 4981 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 4981 * | 4982 * |
| 4982 * @return `true` if at least one entry was invalid | 4983 * @return `true` if at least one entry was invalid |
| 4983 */ | 4984 */ |
| 4984 bool _validateCacheConsistency() { | 4985 bool _validateCacheConsistency() { |
| 4985 int consistencyCheckStart = JavaSystem.nanoTime(); | 4986 int consistencyCheckStart = JavaSystem.nanoTime(); |
| (...skipping 7993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12979 } | 12980 } |
| 12980 | 12981 |
| 12981 @override | 12982 @override |
| 12982 Object visitBinaryExpression(BinaryExpression node) { | 12983 Object visitBinaryExpression(BinaryExpression node) { |
| 12983 node.staticElement = null; | 12984 node.staticElement = null; |
| 12984 node.propagatedElement = null; | 12985 node.propagatedElement = null; |
| 12985 return super.visitBinaryExpression(node); | 12986 return super.visitBinaryExpression(node); |
| 12986 } | 12987 } |
| 12987 | 12988 |
| 12988 @override | 12989 @override |
| 12990 Object visitBreakStatement(BreakStatement node) { |
| 12991 node.target = null; |
| 12992 return super.visitBreakStatement(node); |
| 12993 } |
| 12994 |
| 12995 @override |
| 12989 Object visitCompilationUnit(CompilationUnit node) { | 12996 Object visitCompilationUnit(CompilationUnit node) { |
| 12990 node.element = null; | 12997 node.element = null; |
| 12991 return super.visitCompilationUnit(node); | 12998 return super.visitCompilationUnit(node); |
| 12992 } | 12999 } |
| 12993 | 13000 |
| 12994 @override | 13001 @override |
| 12995 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 13002 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 12996 node.element = null; | 13003 node.element = null; |
| 12997 return super.visitConstructorDeclaration(node); | 13004 return super.visitConstructorDeclaration(node); |
| 12998 } | 13005 } |
| 12999 | 13006 |
| 13000 @override | 13007 @override |
| 13001 Object visitConstructorName(ConstructorName node) { | 13008 Object visitConstructorName(ConstructorName node) { |
| 13002 node.staticElement = null; | 13009 node.staticElement = null; |
| 13003 return super.visitConstructorName(node); | 13010 return super.visitConstructorName(node); |
| 13004 } | 13011 } |
| 13005 | 13012 |
| 13006 @override | 13013 @override |
| 13014 Object visitContinueStatement(ContinueStatement node) { |
| 13015 node.target = null; |
| 13016 return super.visitContinueStatement(node); |
| 13017 } |
| 13018 |
| 13019 @override |
| 13007 Object visitDirective(Directive node) { | 13020 Object visitDirective(Directive node) { |
| 13008 node.element = null; | 13021 node.element = null; |
| 13009 return super.visitDirective(node); | 13022 return super.visitDirective(node); |
| 13010 } | 13023 } |
| 13011 | 13024 |
| 13012 @override | 13025 @override |
| 13013 Object visitExpression(Expression node) { | 13026 Object visitExpression(Expression node) { |
| 13014 node.staticType = null; | 13027 node.staticType = null; |
| 13015 node.propagatedType = null; | 13028 node.propagatedType = null; |
| 13016 return super.visitExpression(node); | 13029 return super.visitExpression(node); |
| (...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14857 | 14870 |
| 14858 @override | 14871 @override |
| 14859 Object visitPolymerTagDartElement(PolymerTagDartElement element) { | 14872 Object visitPolymerTagDartElement(PolymerTagDartElement element) { |
| 14860 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { | 14873 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { |
| 14861 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( | 14874 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( |
| 14862 element as PolymerTagDartElementImpl); | 14875 element as PolymerTagDartElementImpl); |
| 14863 } | 14876 } |
| 14864 return null; | 14877 return null; |
| 14865 } | 14878 } |
| 14866 } | 14879 } |
| OLD | NEW |