Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7ed4f1eae9bd59f1e96bb884303718d15a18966d (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
/*******************************************************************************
 * Copyright (c) 2010, 2011 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.jsdt.debug.internal.crossfire.jsdi;

import java.util.Map;

import org.eclipse.wst.jsdt.debug.core.jsdi.FunctionReference;
import org.eclipse.wst.jsdt.debug.core.jsdi.Value;

/**
 * Default implementation of {@link FunctionReference} for Crossfire
 * 
 * @since 1.0
 */
public class CFFunctionReference extends CFObjectReference implements FunctionReference {

	/**
	 * The "function" type
	 */
	public static final String FUNCTION = "function"; //$NON-NLS-1$
	
	private String funcname = null;
	
	
	/**
	 * Constructor
	 * @param vm
	 * @param frame
	 * @param body
	 */
	public CFFunctionReference(CFVirtualMachine vm, CFStackFrame frame, Map body) {
		super(vm, frame, body);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.wst.jsdt.debug.core.jsdi.FunctionReference#functionName()
	 */
	public String functionName() {
		synchronized (frame()) {
			if(funcname == null) {
				Value val = frame().lookup(id());
				System.out.println(val);
			}
		}
		return funcname;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.wst.jsdt.debug.core.jsdi.FunctionReference#functionBody()
	 */
	public String functionBody() {
		return source();
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.wst.jsdt.debug.internal.crossfire.jsdi.CFObjectReference#valueString()
	 */
	public String valueString() {
		if(source() != null) {
			return source();
		}
		return FUNCTION;
	}
}

Back to the top