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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/context/AnalysisContextFactory.java

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 SourceFactory sourceFactory = sdkContext.getSourceFactory(); 58 SourceFactory sourceFactory = sdkContext.getSourceFactory();
59 // 59 //
60 // dart:core 60 // dart:core
61 // 61 //
62 TestTypeProvider provider = new TestTypeProvider(); 62 TestTypeProvider provider = new TestTypeProvider();
63 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d art"); 63 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d art");
64 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); 64 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE);
65 sdkContext.setContents(coreSource, ""); 65 sdkContext.setContents(coreSource, "");
66 coreUnit.setSource(coreSource); 66 coreUnit.setSource(coreSource);
67 coreUnit.setTypes(new ClassElement[] { 67 coreUnit.setTypes(new ClassElement[] {
68 provider.getBoolType().getElement(), provider.getDoubleType().getElement (), 68 provider.getBoolType().getElement(), provider.getDeprecatedType().getEle ment(),
69 provider.getFunctionType().getElement(), provider.getIntType().getElemen t(), 69 provider.getDoubleType().getElement(), provider.getFunctionType().getEle ment(),
70 provider.getListType().getElement(), provider.getMapType().getElement(), 70 provider.getIntType().getElement(), provider.getListType().getElement(),
71 provider.getNullType().getElement(), provider.getNumType().getElement(), 71 provider.getMapType().getElement(), provider.getNullType().getElement(),
72 provider.getObjectType().getElement(), provider.getStackTraceType().getE lement(), 72 provider.getNumType().getElement(), provider.getObjectType().getElement( ),
73 provider.getStringType().getElement(), provider.getSymbolType().getEleme nt(), 73 provider.getStackTraceType().getElement(), provider.getStringType().getE lement(),
74 provider.getTypeType().getElement()}); 74 provider.getSymbolType().getElement(), provider.getTypeType().getElement ()});
75 coreUnit.setFunctions(new FunctionElement[] {functionElement( 75 coreUnit.setFunctions(new FunctionElement[] {functionElement(
76 "identical", 76 "identical",
77 provider.getBoolType().getElement(), 77 provider.getBoolType().getElement(),
78 new ClassElement[] { 78 new ClassElement[] {
79 provider.getObjectType().getElement(), provider.getObjectType().getE lement()}, 79 provider.getObjectType().getElement(), provider.getObjectType().getE lement()},
80 null)}); 80 null)});
81 TopLevelVariableElement proxyTopLevelVariableElt = topLevelVariableElement(
82 "proxy",
83 true,
84 false,
85 classElement("_Proxy").getType());
86 TopLevelVariableElement deprecatedTopLevelVariableElt = topLevelVariableElem ent(
87 "deprecated",
88 true,
89 false,
90 provider.getDeprecatedType());
91 coreUnit.setAccessors(new PropertyAccessorElement[] {
92 proxyTopLevelVariableElt.getGetter(), proxyTopLevelVariableElt.getSetter (),
93 deprecatedTopLevelVariableElt.getGetter(), deprecatedTopLevelVariableElt .getSetter()});
94 coreUnit.setTopLevelVariables(new TopLevelVariableElement[] {
95 proxyTopLevelVariableElt, deprecatedTopLevelVariableElt});
81 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, libraryI dentifier( 96 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, libraryI dentifier(
82 "dart", 97 "dart",
83 "core")); 98 "core"));
84 coreLibrary.setDefiningCompilationUnit(coreUnit); 99 coreLibrary.setDefiningCompilationUnit(coreUnit);
85 // 100 //
86 // dart:html 101 // dart:html
87 // 102 //
88 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d artium.dart"); 103 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d artium.dart");
89 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); 104 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML);
90 sdkContext.setContents(htmlSource, ""); 105 sdkContext.setContents(htmlSource, "");
(...skipping 11 matching lines...) Expand all
102 classElement("ButtonElement", elementType), classElement("DivElement", e lementType), 117 classElement("ButtonElement", elementType), classElement("DivElement", e lementType),
103 documentElement, elementElement, htmlDocumentElement, 118 documentElement, elementElement, htmlDocumentElement,
104 classElement("InputElement", elementType), classElement("SelectElement", elementType),}); 119 classElement("InputElement", elementType), classElement("SelectElement", elementType),});
105 htmlUnit.setFunctions(new FunctionElement[] {functionElement( 120 htmlUnit.setFunctions(new FunctionElement[] {functionElement(
106 "query", 121 "query",
107 elementElement, 122 elementElement,
108 new ClassElement[] {provider.getStringType().getElement()}, 123 new ClassElement[] {provider.getStringType().getElement()},
109 ClassElementImpl.EMPTY_ARRAY)}); 124 ClassElementImpl.EMPTY_ARRAY)});
110 TopLevelVariableElementImpl document = topLevelVariableElement( 125 TopLevelVariableElementImpl document = topLevelVariableElement(
111 "document", 126 "document",
127 false,
112 true, 128 true,
113 htmlDocumentElement.getType()); 129 htmlDocumentElement.getType());
114 htmlUnit.setTopLevelVariables(new TopLevelVariableElement[] {document}); 130 htmlUnit.setTopLevelVariables(new TopLevelVariableElement[] {document});
115 htmlUnit.setAccessors(new PropertyAccessorElement[] {document.getGetter()}); 131 htmlUnit.setAccessors(new PropertyAccessorElement[] {document.getGetter()});
116 LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, libraryI dentifier( 132 LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, libraryI dentifier(
117 "dart", 133 "dart",
118 "dom", 134 "dom",
119 "html")); 135 "html"));
120 htmlLibrary.setDefiningCompilationUnit(htmlUnit); 136 htmlLibrary.setDefiningCompilationUnit(htmlUnit);
121 137
122 HashMap<Source, LibraryElement> elementMap = new HashMap<Source, LibraryElem ent>(); 138 HashMap<Source, LibraryElement> elementMap = new HashMap<Source, LibraryElem ent>();
123 elementMap.put(coreSource, coreLibrary); 139 elementMap.put(coreSource, coreLibrary);
124 elementMap.put(htmlSource, htmlLibrary); 140 elementMap.put(htmlSource, htmlLibrary);
125 ((AnalysisContextImpl) sdkContext).recordLibraryElements(elementMap); 141 ((AnalysisContextImpl) sdkContext).recordLibraryElements(elementMap);
126 142
127 AnalysisContextImpl context = new DelegatingAnalysisContextImpl(); 143 AnalysisContextImpl context = new DelegatingAnalysisContextImpl();
128 sourceFactory = new SourceFactory(new DartUriResolver( 144 sourceFactory = new SourceFactory(new DartUriResolver(
129 sdkContext.getSourceFactory().getDartSdk()), new FileUriResolver()); 145 sdkContext.getSourceFactory().getDartSdk()), new FileUriResolver());
130 context.setSourceFactory(sourceFactory); 146 context.setSourceFactory(sourceFactory);
131 return context; 147 return context;
132 } 148 }
133 149
134 /** 150 /**
135 * Prevent the creation of instances of this class. 151 * Prevent the creation of instances of this class.
136 */ 152 */
137 private AnalysisContextFactory() { 153 private AnalysisContextFactory() {
138 } 154 }
139 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698