Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 195f786288d7904ad39662661ec40992213ae5f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*******************************************************************************
 * Copyright (c) 2007, 2012 Symbian Software Systems and others.
 * 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:
 *     Andrew Ferguson (Symbian) - Initial implementation
 *     Sergey Prigogin (Google)
 *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.c;

import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;

class CompositeCFunction extends CompositeCBinding implements IFunction {

	public CompositeCFunction(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
		super(cf, rbinding);
	}

	@Override
	public IScope getFunctionScope() {
		return null;
	}
	
	@Override
	public IParameter[] getParameters() {
		IParameter[] preResult = ((IFunction) rbinding).getParameters();
		IParameter[] result = new IParameter[preResult.length];
		for (int i= 0; i < preResult.length; i++) {
			result[i] = (IParameter) cf.getCompositeBinding((IIndexFragmentBinding) preResult[i]);
		}
		return result;
	}
	
	@Override
	public IFunctionType getType() {
		IType rtype = ((IFunction) rbinding).getType();
		return (IFunctionType) cf.getCompositeType(rtype);
	}

	@Override
	public boolean isAuto() {
		return ((IFunction) rbinding).isAuto();
	}

	@Override
	public boolean isExtern() {
		return ((IFunction) rbinding).isExtern();
	}

	@Override
	public boolean isInline() {
		return ((IFunction) rbinding).isInline();
	}

	@Override
	public boolean isRegister() {
		return ((IFunction) rbinding).isRegister();
	}

	@Override
	public boolean isStatic() {
		return ((IFunction) rbinding).isStatic();
	}

	@Override
	public boolean takesVarArgs() {
		return ((IFunction) rbinding).takesVarArgs();
	}

	@Override
	public boolean isNoReturn() {
		return ((IFunction) rbinding).isNoReturn();
	}
}

Back to the top