Package dtool.ast.references

Source Code of dtool.ast.references.RefModuleQualified

/*******************************************************************************
* Copyright (c) 2011, 2014 Bruno Medeiros and other Contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     Bruno Medeiros - initial API and implementation
*******************************************************************************/
package dtool.ast.references;

import java.util.Collection;
import java.util.Collections;

import dtool.ast.ASTCodePrinter;
import dtool.ast.ASTNodeTypes;
import dtool.ast.IASTVisitor;
import dtool.ast.definitions.INamedElement;
import dtool.ast.definitions.Module;
import dtool.ast.util.NodeUtil;
import dtool.engine.modules.IModuleResolver;

/** An entity reference starting at module scope.
* Example: "a = .foo;"
*/
public class RefModuleQualified extends CommonQualifiedReference {
 
  public RefModuleQualified(RefIdentifier qualifiedId) {
    super(qualifiedId);
  }
 
  @Override
  public ASTNodeTypes getNodeType() {
    return ASTNodeTypes.REF_MODULE_QUALIFIED;
  }
 
  @Override
  public void visitChildren(IASTVisitor visitor) {
    acceptVisitor(visitor, qualifiedId);
  }
 
  @Override
  public void toStringAsCode(ASTCodePrinter cp) {
    cp.append(".");
    cp.appendNodeOrNullAlt(qualifiedId, "/*MISSING*/");
  }
 
  @Override
  public int getDotOffset() {
    return getStartPos();
  }
 
  @Override
  public Collection<INamedElement> findRootDefUnits(IModuleResolver moduleResolver) {
    final Module module = NodeUtil.getParentModule(this);
    return Collections.<INamedElement>singletonList(module);
  }
 
}
TOP

Related Classes of dtool.ast.references.RefModuleQualified

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.