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

Unified Diff: pkg/analyzer_experimental/test/generated/resolver_test.dart

Issue 23461019: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_experimental/test/generated/resolver_test.dart
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index 7cc689bb3f6d3a676930319e520554382302a0ea..da1e9950cc8880ce105de6cb34657e1f6974ce3a 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -14902,6 +14902,73 @@ class AnalysisContextFactory {
/**
* Create an analysis context that has a fake core library already resolved.
*
+ * Added in order to test AnalysisContextImpl2.
+ *
+ * @return the analysis context that was created
+ */
+ static AnalysisContextImpl2 context2WithCore() {
+ AnalysisContextImpl2 sdkContext = DirectoryBasedDartSdk.defaultSdk2.context as AnalysisContextImpl2;
+ SourceFactory sourceFactory = sdkContext.sourceFactory;
+ TestTypeProvider provider = new TestTypeProvider();
+ CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.dart");
+ Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE);
+ sdkContext.setContents(coreSource, "");
+ coreUnit.source = coreSource;
+ coreUnit.types = <ClassElement> [
+ provider.boolType.element,
+ provider.doubleType.element,
+ provider.functionType.element,
+ provider.intType.element,
+ provider.listType.element,
+ provider.mapType.element,
+ provider.nullType.element,
+ provider.numType.element,
+ provider.objectType.element,
+ provider.stackTraceType.element,
+ provider.stringType.element,
+ provider.typeType.element];
+ LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFactory.libraryIdentifier2(["dart", "core"]));
+ coreLibrary.definingCompilationUnit = coreUnit;
+ CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_dartium.dart");
+ Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML);
+ sdkContext.setContents(htmlSource, "");
+ htmlUnit.source = htmlSource;
+ ClassElementImpl elementElement = ElementFactory.classElement2("Element", []);
+ InterfaceType elementType = elementElement.type;
+ ClassElementImpl documentElement = ElementFactory.classElement("Document", elementType, []);
+ ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocument", documentElement.type, []);
+ htmlDocumentElement.methods = <MethodElement> [ElementFactory.methodElement("query", elementType, <Type2> [provider.stringType])];
+ htmlUnit.types = <ClassElement> [
+ ElementFactory.classElement("AnchorElement", elementType, []),
+ ElementFactory.classElement("BodyElement", elementType, []),
+ ElementFactory.classElement("ButtonElement", elementType, []),
+ ElementFactory.classElement("DivElement", elementType, []),
+ documentElement,
+ elementElement,
+ htmlDocumentElement,
+ ElementFactory.classElement("InputElement", elementType, []),
+ ElementFactory.classElement("SelectElement", elementType, [])];
+ htmlUnit.functions = <FunctionElement> [ElementFactory.functionElement3("query", elementElement, <ClassElement> [provider.stringType.element], ClassElementImpl.EMPTY_ARRAY)];
+ TopLevelVariableElementImpl document = ElementFactory.topLevelVariableElement3("document", true, htmlDocumentElement.type);
+ htmlUnit.topLevelVariables = <TopLevelVariableElement> [document];
+ htmlUnit.accessors = <PropertyAccessorElement> [document.getter];
+ LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, ASTFactory.libraryIdentifier2(["dart", "dom", "html"]));
+ htmlLibrary.definingCompilationUnit = htmlUnit;
+ Map<Source, LibraryElement> elementMap = new Map<Source, LibraryElement>();
+ elementMap[coreSource] = coreLibrary;
+ elementMap[htmlSource] = htmlLibrary;
+ sdkContext.recordLibraryElements(elementMap);
+ AnalysisContextImpl2 context = new DelegatingAnalysisContextImpl2();
+ sourceFactory = new SourceFactory.con2([
+ new DartUriResolver(sdkContext.sourceFactory.dartSdk),
+ new FileUriResolver()]);
+ context.sourceFactory = sourceFactory;
+ return context;
+ }
+
+ /**
+ * Create an analysis context that has a fake core library already resolved.
+ *
* @return the analysis context that was created
*/
static AnalysisContextImpl contextWithCore() {
@@ -16491,7 +16558,7 @@ class EnclosedScopeTest extends ResolverTestCase {
void test_define_duplicate() {
LibraryElement definingLibrary2 = createTestLibrary();
GatheringErrorListener errorListener2 = new GatheringErrorListener();
- Scope rootScope = new Scope_19(definingLibrary2, errorListener2);
+ Scope rootScope = new Scope_23(definingLibrary2, errorListener2);
EnclosedScope scope = new EnclosedScope(rootScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -16502,7 +16569,7 @@ class EnclosedScopeTest extends ResolverTestCase {
void test_define_normal() {
LibraryElement definingLibrary3 = createTestLibrary();
GatheringErrorListener errorListener3 = new GatheringErrorListener();
- Scope rootScope = new Scope_20(definingLibrary3, errorListener3);
+ Scope rootScope = new Scope_24(definingLibrary3, errorListener3);
EnclosedScope outerScope = new EnclosedScope(rootScope);
EnclosedScope innerScope = new EnclosedScope(outerScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -16524,18 +16591,18 @@ class EnclosedScopeTest extends ResolverTestCase {
});
}
}
-class Scope_19 extends Scope {
+class Scope_23 extends Scope {
LibraryElement definingLibrary2;
GatheringErrorListener errorListener2;
- Scope_19(this.definingLibrary2, this.errorListener2) : super();
+ Scope_23(this.definingLibrary2, this.errorListener2) : super();
LibraryElement get definingLibrary => definingLibrary2;
AnalysisErrorListener get errorListener => errorListener2;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
}
-class Scope_20 extends Scope {
+class Scope_24 extends Scope {
LibraryElement definingLibrary3;
GatheringErrorListener errorListener3;
- Scope_20(this.definingLibrary3, this.errorListener3) : super();
+ Scope_24(this.definingLibrary3, this.errorListener3) : super();
LibraryElement get definingLibrary => definingLibrary3;
AnalysisErrorListener get errorListener => errorListener3;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;

Powered by Google App Engine
This is Rietveld 408576698