Search in sources :

Example 1 with FunctionNamespace

use of com.google.javascript.jscomp.newtypes.FunctionNamespace in project closure-compiler by google.

the class NTIScope method addFunNamespace.

void addFunNamespace(Node qnameNode) {
    if (qnameNode.isName()) {
        String varName = qnameNode.getString();
        checkArgument(isDefinedLocally(varName, false));
        checkState(!this.localNamespaces.containsKey(varName));
        NTIScope s = checkNotNull(this.localFunDefs.get(varName));
        this.localNamespaces.put(varName, new FunctionNamespace(this.commonTypes, varName, s, qnameNode));
    } else {
        checkArgument(!isNamespace(qnameNode));
        QualifiedName qname = QualifiedName.fromNode(qnameNode);
        Namespace ns = getNamespace(qname.getLeftmostName());
        NTIScope s = (NTIScope) ns.getDeclaration(qname).getFunctionScope();
        ns.addNamespace(qname.getAllButLeftmost(), new FunctionNamespace(this.commonTypes, qname.toString(), s, qnameNode));
    }
}
Also used : FunctionNamespace(com.google.javascript.jscomp.newtypes.FunctionNamespace) QualifiedName(com.google.javascript.jscomp.newtypes.QualifiedName) Namespace(com.google.javascript.jscomp.newtypes.Namespace) FunctionNamespace(com.google.javascript.jscomp.newtypes.FunctionNamespace)

Aggregations

FunctionNamespace (com.google.javascript.jscomp.newtypes.FunctionNamespace)1 Namespace (com.google.javascript.jscomp.newtypes.Namespace)1 QualifiedName (com.google.javascript.jscomp.newtypes.QualifiedName)1