// Path: src/mgi/tools/jagdecs2/CodePrinter.java
// public class CodePrinter {
// 
// 	protected StringWriter writer;
// 	private int tabs;
// 	
// 	
// 	public CodePrinter() {
// 		writer = new StringWriter();
// 		tabs = 0;
// 	}
// 	
// 	/**
// 	 * Method , unused by default that notifies that specific node is
// 	 * about to be printed.
// 	 */
// 	public void beginPrinting(AbstractCodeNode node) { }
// 	
// 	/**
// 	 * Method, unused by default that notifies that specific node was
// 	 * printed.
// 	 */
// 	public void endPrinting(AbstractCodeNode node) { }
// 	
// 	
// 	public void print(CharSequence str) {
// 		for (int i = 0; i < str.length(); i++)
// 			print(str.charAt(i));
// 	}
// 	
// 	public void print(char c) {
// 		writer.append(c);
// 		if (c == '\n')
// 			writer.append(getTabs());
// 	}
// 	
// 	protected String getTabs() {
// 		StringBuilder tabs = new StringBuilder();
// 		for (int i = 0; i < this.tabs; i++)
// 			tabs.append('\t');
// 		return tabs.toString();
// 	}
// 	
// 	public void tab() {
// 		tabs++;
// 	}
// 	
// 	public void untab() {
// 		if (tabs <= 0)
// 			throw new RuntimeException("Not tabbed!");
// 		tabs--;
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		writer.flush();
// 		return writer.toString();
// 	}
// 	
// 	public static String print(AbstractCodeNode node) {
// 		CodePrinter printer = new CodePrinter();
// 		node.print(printer);
// 		return printer.toString();
// 	}
// 	
// }
// 
// Path: src/mgi/tools/jagdecs2/util/FunctionInfo.java
// public class FunctionInfo {
// 
// 	private String name;
// 	private CS2Type returnType;
// 	private CS2Type[] argumentTypes;
// 	private String[] argumentNames;
// 
// 	
// 	public FunctionInfo(String name,CS2Type[] argTypes,CS2Type returnType, String[] argNames) {
// 		this.name = name;
// 		this.argumentTypes = argTypes;
// 		this.returnType = returnType;
// 		this.argumentNames = argNames;
// 	}
// 	
// 	
// 	
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public CS2Type[] getArgumentTypes() {
// 		return argumentTypes;
// 	}
// 
// 	public CS2Type getReturnType() {
// 		return returnType;
// 	}
// 
// 	public String[] getArgumentNames() {
// 		return argumentNames;
// 	}
// 	
// 	public String toString() {
// 		StringBuilder bld = new StringBuilder();
// 		bld.append(returnType);
// 		bld.append(' ');
// 		bld.append(name);
// 		bld.append('(');
// 		for (int i = 0; i < argumentTypes.length; i++) {
// 			bld.append(argumentTypes[i].toString() + " " + argumentNames[i]);
// 			if ((i + 1) < argumentTypes.length)
// 				bld.append(',');
// 		}
// 		bld.append(')');
// 		bld.append(';');
// 		return bld.toString();
// 	}
// }


import mgi.tools.jagdecs2.CS2Type;
import mgi.tools.jagdecs2.CodePrinter;
import mgi.tools.jagdecs2.util.FunctionInfo;

/*
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


package mgi.tools.jagdecs2.ast;


public class CallExpressionNode extends ExpressionNode  {

	private FunctionInfo info;
    private ExpressionNode[] arguments;
    
    
    public CallExpressionNode(FunctionInfo info,ExpressionNode[] arguments) {
    	this.info = info;
    	this.arguments = arguments;
    	for (int i = 0; i < arguments.length; i++) {
    		this.write(arguments[i]);
    		arguments[i].setParent(this);
    	}
    }
    
    @Override
    public int getPriority() {
    	return ExpressionNode.PRIORITY_CALL;
    }
    
    @Override
    public CS2Type getType() {
    	return info.getReturnType();
    }


	@Override
	public ExpressionNode copy() {
		ExpressionNode[] argsCopy = new ExpressionNode[arguments.length];
		for (int i = 0; i < arguments.length; i++)
			argsCopy[i] = arguments[i].copy();
		return new CallExpressionNode(this.info,argsCopy);
	}


// Path: src/mgi/tools/jagdecs2/CodePrinter.java
// public class CodePrinter {
// 
// 	protected StringWriter writer;
// 	private int tabs;
// 	
// 	
// 	public CodePrinter() {
// 		writer = new StringWriter();
// 		tabs = 0;
// 	}
// 	
// 	/**
// 	 * Method , unused by default that notifies that specific node is
// 	 * about to be printed.
// 	 */
// 	public void beginPrinting(AbstractCodeNode node) { }
// 	
// 	/**
// 	 * Method, unused by default that notifies that specific node was
// 	 * printed.
// 	 */
// 	public void endPrinting(AbstractCodeNode node) { }
// 	
// 	
// 	public void print(CharSequence str) {
// 		for (int i = 0; i < str.length(); i++)
// 			print(str.charAt(i));
// 	}
// 	
// 	public void print(char c) {
// 		writer.append(c);
// 		if (c == '\n')
// 			writer.append(getTabs());
// 	}
// 	
// 	protected String getTabs() {
// 		StringBuilder tabs = new StringBuilder();
// 		for (int i = 0; i < this.tabs; i++)
// 			tabs.append('\t');
// 		return tabs.toString();
// 	}
// 	
// 	public void tab() {
// 		tabs++;
// 	}
// 	
// 	public void untab() {
// 		if (tabs <= 0)
// 			throw new RuntimeException("Not tabbed!");
// 		tabs--;
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		writer.flush();
// 		return writer.toString();
// 	}
// 	
// 	public static String print(AbstractCodeNode node) {
// 		CodePrinter printer = new CodePrinter();
// 		node.print(printer);
// 		return printer.toString();
// 	}
// 	
// }
// 
// Path: src/mgi/tools/jagdecs2/util/FunctionInfo.java
// public class FunctionInfo {
// 
// 	private String name;
// 	private CS2Type returnType;
// 	private CS2Type[] argumentTypes;
// 	private String[] argumentNames;
// 
// 	
// 	public FunctionInfo(String name,CS2Type[] argTypes,CS2Type returnType, String[] argNames) {
// 		this.name = name;
// 		this.argumentTypes = argTypes;
// 		this.returnType = returnType;
// 		this.argumentNames = argNames;
// 	}
// 	
// 	
// 	
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public CS2Type[] getArgumentTypes() {
// 		return argumentTypes;
// 	}
// 
// 	public CS2Type getReturnType() {
// 		return returnType;
// 	}
// 
// 	public String[] getArgumentNames() {
// 		return argumentNames;
// 	}
// 	
// 	public String toString() {
// 		StringBuilder bld = new StringBuilder();
// 		bld.append(returnType);
// 		bld.append(' ');
// 		bld.append(name);
// 		bld.append('(');
// 		for (int i = 0; i < argumentTypes.length; i++) {
// 			bld.append(argumentTypes[i].toString() + " " + argumentNames[i]);
// 			if ((i + 1) < argumentTypes.length)
// 				bld.append(',');
// 		}
// 		bld.append(')');
// 		bld.append(';');
// 		return bld.toString();
// 	}
// }


// Path: src/mgi/tools/jagdecs2/ast/CallExpressionNode.java
import mgi.tools.jagdecs2.CS2Type;
import mgi.tools.jagdecs2.CodePrinter;
import mgi.tools.jagdecs2.util.FunctionInfo;

/*
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


package mgi.tools.jagdecs2.ast;


public class CallExpressionNode extends ExpressionNode  {

	private FunctionInfo info;
    private ExpressionNode[] arguments;
    
    
    public CallExpressionNode(FunctionInfo info,ExpressionNode[] arguments) {
    	this.info = info;
    	this.arguments = arguments;
    	for (int i = 0; i < arguments.length; i++) {
    		this.write(arguments[i]);
    		arguments[i].setParent(this);
    	}
    }
    
    @Override
    public int getPriority() {
    	return ExpressionNode.PRIORITY_CALL;
    }
    
    @Override
    public CS2Type getType() {
    	return info.getReturnType();
    }


	@Override
	public ExpressionNode copy() {
		ExpressionNode[] argsCopy = new ExpressionNode[arguments.length];
		for (int i = 0; i < arguments.length; i++)
			argsCopy[i] = arguments[i].copy();
		return new CallExpressionNode(this.info,argsCopy);
	}


	@Override
