Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0b3a7cb5ec50b54f0198b0a653d2555af9d18e76 (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
package org.eclipse.jdt.internal.compiler.ast;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
import org.eclipse.jdt.internal.compiler.impl.*;
import org.eclipse.jdt.internal.compiler.lookup.*;

public class Argument extends LocalDeclaration {
public Argument(char[] name , long posNom , TypeReference tr , int modifiers){
	super(null,name, (int) (posNom >>> 32), (int) (posNom & 0xFFFFFFFFL));
	this.modifiers = modifiers;
	type = tr;
}
public void resolve(BlockScope scope) {
	// an argument may be final ==> cannot be assigned

	super.resolve(scope);
	binding.isArgument = true;
	binding.used = true;
}
public TypeBinding resolveForCatch(BlockScope scope) {
	// resolution on an argument of a catch clause
	// provide the scope with a side effect : insertion of a LOCAL
	// that represents the argument. The type must be from JavaThrowable

	TypeBinding tb = type.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
	if (tb == null)
		return null;
	if ((binding = scope.duplicateName(name)) != null) {
		// the name already exists....may carry on with the first binding ....
		scope.problemReporter().redefineArgument(this);
		return null;
	}
	binding = new LocalVariableBinding(this, tb, modifiers);
	scope.addLocalVariable(binding);
	binding.constant = NotAConstant;
	return tb;
}
public String toString(int tab){
	/* slow code */
	
	String s = ""/*nonNLS*/;
	if (modifiers != AccDefault){
		s += modifiersString(modifiers);
	}
	if (type == null){
		s += "<no type> "/*nonNLS*/;
	} else {
		s += type.toString(tab) + " "/*nonNLS*/;
	}
	s += new String(name);
	return s;
}
public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
	if (visitor.visit(this, scope)) {
		if (type != null) type.traverse(visitor, scope);
		if (initialization != null) initialization.traverse(visitor, scope);
	}
	visitor.endVisit(this, scope);
}
}

Back to the top