Search in sources :

Example 1 with ImportSpecifierTree

use of com.google.javascript.jscomp.parsing.parser.trees.ImportSpecifierTree in project closure-compiler by google.

the class Parser method parseImportSpecifier.

// ImportSpecifier ::= Identifier ('as' Identifier)?
private ParseTree parseImportSpecifier() {
    SourcePosition start = getTreeStartLocation();
    IdentifierToken importedName = eatIdOrKeywordAsId();
    IdentifierToken destinationName = null;
    if (peekPredefinedString(PredefinedName.AS)) {
        eatPredefinedString(PredefinedName.AS);
        destinationName = eatId();
    } else if (isKeyword(importedName.value)) {
        reportExpectedError(null, PredefinedName.AS);
    }
    return new ImportSpecifierTree(getTreeLocation(start), importedName, destinationName);
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) ImportSpecifierTree(com.google.javascript.jscomp.parsing.parser.trees.ImportSpecifierTree)

Aggregations

ImportSpecifierTree (com.google.javascript.jscomp.parsing.parser.trees.ImportSpecifierTree)1 SourcePosition (com.google.javascript.jscomp.parsing.parser.util.SourcePosition)1