<commit_before>package flatomo.macro;

import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Expr.TypeDefinition;
import haxe.macro.Expr.TypeDefKind;
import haxe.macro.ExprTools;
import haxe.macro.MacroStringTools;
import haxe.macro.Printer;
import haxe.macro.Type;
import haxe.macro.TypeTools;
import sys.FileSystem;
import sys.io.File;

using Lambda;

class EmbedAssetUtil {
	
	private static function getStaticFields():Array<ClassField> {
		var classPath:String = Context.definedValue('path');
		var type:Type = Context.getType(classPath);
		var staticFields:Array<ClassField> = TypeTools.getClass(type).statics.get();
		
		var assetFields = staticFields.filter(function (field) {
			return switch (field.meta.get()) {
				case [ { name: ':asset' } ] : 
					switch (field.type) {
						case TType(t, _) if (t.get().name == "Asset") : 
							true;
						case _ :
							Context.fatalError(TypeTools.toString(field.type) + " should be Asset", field.pos);
					}
				case _ :
					false;
			}<commit_msg>[cleanup] `=>`を使ってパターンマッチするように変更<commit_after>package flatomo.macro;

import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Expr.TypeDefinition;
import haxe.macro.Expr.TypeDefKind;
import haxe.macro.ExprTools;
import haxe.macro.MacroStringTools;
import haxe.macro.Printer;
import haxe.macro.Type;
import haxe.macro.TypeTools;
import sys.FileSystem;
import sys.io.File;

using Lambda;

class EmbedAssetUtil {
	
	private static function getStaticFields():Array<ClassField> {
		var classPath:String = Context.definedValue('path');
		var type:Type = Context.getType(classPath);
		var staticFields:Array<ClassField> = TypeTools.getClass(type).statics.get();
		
		var assetFields = staticFields.filter(function (field) {
			return switch (field.meta.get()) {
				case [ { name: ':asset' } ] : 
					switch (field.type) {
						case TType(_.get().name => "Asset", _) : 
							true;
						case _ :
							Context.fatalError(TypeTools.toString(field.type) + " should be Asset", field.pos);
					}
				case _ :
					false;
			}
{'fraction_non_alphanumeric': 0.12985781990521328, 'fraction_numerical': 0.0, 'mean_word_length': 4.074519230769231, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6877905', 'n_tokens_mistral': 851, 'n_tokens_neox': 692, 'n_words': 137}