blob: ac3db16a9431e02010ee242962505077c3e00584 (
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*******************************************************************************
* Copyright (c) 2015 Google, Inc and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.internal.core.index.IIndexScope;
/**
* Base class for C and C++ global index scopes.
*/
public abstract class PDOMGlobalScope implements IIndexScope {
@Override
public EScopeKind getKind() {
return EScopeKind.eGlobal;
}
@Override
public IBinding[] find(String name, IASTTranslationUnit tu) {
logInvalidCallError();
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
public IBinding[] find(String name) {
logInvalidCallError();
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
public IBinding getBinding(IASTName name, boolean resolve) {
logInvalidCallError();
return null;
}
@Override
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings) {
logInvalidCallError();
return null;
}
@Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) {
logInvalidCallError();
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup,
IIndexFileSet acceptLocalBindings) {
logInvalidCallError();
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
public IBinding[] getBindings(ScopeLookupData lookup) {
logInvalidCallError();
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
public IIndexBinding getScopeBinding() {
return null;
}
@Override
public IIndexScope getParent() {
return null;
}
@Override
public IIndexName getScopeName() {
return null;
}
@Override
public String toString() {
return "<global scope>"; //$NON-NLS-1$
}
private void logInvalidCallError() {
CCorePlugin.log(new UnsupportedOperationException(
"Global index scope has to be mapped to the global scope of a particular translation unit.")); //$NON-NLS-1$
}
}
|