001/* 002 * Copyright (c) 2012-2021 Institut National des Sciences Appliquées de Lyon (INSA Lyon) and others 003 * 004 * This program and the accompanying materials are made available under the 005 * terms of the Eclipse Public License 2.0 which is available at 006 * http://www.eclipse.org/legal/epl-2.0. 007 * 008 * SPDX-License-Identifier: EPL-2.0 009 */ 010 011package gololang.ir; 012 013import org.eclipse.golo.compiler.PackageAndClass; 014 015public abstract class GoloType<T extends GoloType<T>> extends GoloElement<T> implements NamedElement { 016 017 private final String name; 018 019 GoloType(String name) { 020 super(); 021 this.name = name; 022 } 023 024 @Override 025 public String getName() { 026 return name; 027 } 028 029 String getFullName() { 030 return getPackageAndClass().toString(); 031 } 032 033 public PackageAndClass getPackageAndClass() { 034 GoloModule m = enclosingModule(); 035 if (m == null) { 036 return PackageAndClass.of(getName()); 037 } 038 return m.getTypesPackage().createSubPackage(getName()); 039 } 040 041}