use of com.google.javascript.rhino.NominalTypeBuilder in project closure-compiler by google.
the class TypedScopeCreator method createScopeInternal.
private TypedScope createScopeInternal(Node root, TypedScope typedParent) {
// Constructing the global scope is very different than constructing
// inner scopes, because only global scopes can contain named classes that
// show up in the type registry.
TypedScope newScope = null;
AbstractScopeBuilder scopeBuilder = null;
if (typedParent == null) {
JSType globalThis = typeRegistry.getNativeObjectType(JSTypeNative.GLOBAL_THIS);
// Mark the main root, the externs root, and the src root
// with the global this type.
root.setJSType(globalThis);
root.getFirstChild().setJSType(globalThis);
root.getLastChild().setJSType(globalThis);
// Run a first-order analysis over the syntax tree.
new FirstOrderFunctionAnalyzer().process(root.getFirstChild(), root.getLastChild());
// Find all the classes in the global scope.
newScope = createInitialScope(root);
scopeBuilder = new GlobalScopeBuilder(newScope);
} else {
newScope = new TypedScope(typedParent, root);
scopeBuilder = new LocalScopeBuilder(newScope);
}
scopeBuilder.build();
scopeBuilder.resolveStubDeclarations();
if (typedParent == null) {
List<NominalTypeBuilder> delegateProxies = new ArrayList<>();
for (FunctionType delegateProxyCtor : delegateProxyCtors) {
delegateProxies.add(new NominalTypeBuilderOti(delegateProxyCtor, delegateProxyCtor.getInstanceType()));
}
codingConvention.defineDelegateProxyPrototypeProperties(typeRegistry, delegateProxies, delegateCallingConventions);
}
newScope.setTypeResolver(scopeBuilder);
return newScope;
}
Aggregations