<commit_before>//
//  CallNode.swift
//  Lioness
//
//  Created by <NAME> on 09/10/2016.
//  Copyright © 2016 Silver Fox. All rights reserved.
//

import Foundation

public class CallNode: ASTNode {
	
	public let callee: String
	public let arguments: [ASTNode]
	
	public init(callee: String, arguments: [ASTNode]) {
		self.callee = callee
		self.arguments = arguments
	}
	
	public override func compile(with ctx: BytecodeCompiler) throws -> BytecodeBody {

		var bytecode = BytecodeBody()
		
		let id = ctx.getFunctionId(for: callee)
		
		let invokeInstruction = BytecodeInstruction(label: ctx.nextIndexLabel(), type: .invokeFunc, arguments: [id], comment: "\(callee)")
		
		for arg in arguments {
			
			let argInstructions = try arg.compile(with: ctx)
			bytecode.append(contentsOf: argInstructions)
			
		}
		
		bytecode.append(invokeInstruction)
		
		return bytecode
	}
	
	public override var description: String {
		var str = "CallNode(name: \(callee), argument: "
		
		for a in arguments {
			str += "\n    \(a.description)"
		}
		
		return str + ")"
	}
	
	public override var nodeDescription: String? {
		return callee
	}
	
	public override var childNodes: [ASTChildNode] {
		var children = [ASTChildNode]()
		
		for a in arguments {
			children.append(ASTChildNode(connectionToParent: "argument", node: a))
		}
		
		return children
	}
	
}
<commit_msg>Fixed bytecode labels for function arguments<commit_after>//
//  CallNode.swift
//  Lioness
//
//  Created by <NAME> on 09/10/2016.
//  Copyright © 2016 Silver Fox. All rights reserved.
//

import Foundation

public class CallNode: ASTNode {
	
	public let callee: String
	public let arguments: [ASTNode]
	
	public init(callee: String, arguments: [ASTNode]) {
		self.callee = callee
		self.arguments = arguments
	}
	
	public override func compile(with ctx: BytecodeCompiler) throws -> BytecodeBody {

		var bytecode = BytecodeBody()
		
		let id = ctx.getFunctionId(for: callee)
		
		for arg in arguments {
			
			let argInstructions = try arg.compile(with: ctx)
			bytecode.append(contentsOf: argInstructions)
			
		}
		
		let invokeInstruction = BytecodeInstruction(label: ctx.nextIndexLabel(), type: .invokeFunc, arguments: [id], comment: "\(callee)")

		bytecode.append(invokeInstruction)
		
		return bytecode
	}
	
	public override var description: String {
		var str = "CallNode(name: \(callee), argument: "
		
		for a in arguments {
			str += "\n    \(a.description)"
		}
		
		return str + ")"
	}
	
	public override var nodeDescription: String? {
		return callee
	}
	
	public override var childNodes: [ASTChildNode] {
		var children = [ASTChildNode]()
		
		for a in arguments {
			children.append(ASTChildNode(connectionToParent: "argument", node: a))
		}
		
		return children
	}
	
}

{'fraction_non_alphanumeric': 0.10921004732435384, 'fraction_numerical': 0.008736803785948308, 'mean_word_length': 3.361904761904762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6473509', 'n_tokens_mistral': 993, 'n_tokens_neox': 832, 'n_words': 249}