use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMapping method methodMappingFor_methodName_.
public MethodMapping methodMappingFor_methodName_(final Class _receiverClass, final String _methodName) {
final st.gravel.core.Symbol _sel;
final ClassMapping _classMapping;
_classMapping = this.classMappingForJavaClass_(_receiverClass);
_sel = _selectorConverter.functionNameAsSelector_(_methodName);
return ((MethodMapping) this.methodMappingFrom_selector_(_classMapping, _sel));
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMapping method newClassMappingForJavaClass_.
public ClassMapping newClassMappingForJavaClass_(final Class _receiverClass) {
final Map<st.gravel.core.Symbol, AbstractMethodMapping>[] _methodMappings;
final ClassNode _classNode;
final ClassMapping _superMapping;
final java.util.Set<st.gravel.core.Symbol>[] _allSelectors;
_allSelectors = new java.util.Set[1];
_methodMappings = new Map[1];
_superMapping = this.bestClassMappingFor_(_receiverClass);
_allSelectors[0] = _superMapping.allSelectorsIn_(this);
_methodMappings[0] = new java.util.HashMap<st.gravel.core.Symbol, AbstractMethodMapping>();
_compilerTools.methodNamesIn_do_(_receiverClass, new st.gravel.support.jvm.Block2<Object, String, Integer>() {
@Override
public Object value_value_(final String _methodName, final Integer _numArgs) {
final st.gravel.core.Symbol _sel;
_sel = _selectorConverter.functionNameAsSelector_(_methodName);
if (st.gravel.support.jvm.IntegerExtensions.equals_(_sel.numArgs(), _numArgs) && _allSelectors[0].contains(_sel)) {
final java.lang.invoke.MethodHandle _methodHandle;
_methodHandle = _compilerTools.methodHandleAt_numArgs_in_identityClass_isStatic_(_methodName, _sel.numArgs(), _receiverClass, _receiverClass, false);
if (_methodHandle != null) {
return _methodMappings[0].put(_sel, AnonymousMethodMapping.factory.methodHandle_definingClass_(_methodHandle, _receiverClass));
}
}
return SystemMapping.this;
}
});
_classNode = ClassNode.factory.name_superclassPath_properties_instVars_classInstVars_sharedVariables_methods_classMethods_namespace_isExtension_isTrait_traitUsage_classTraitUsage_(_superMapping.classNode().name(), _superMapping.reference().toString(), new java.util.HashMap<String, String>(), new VariableDeclarationNode[] {}, new VariableDeclarationNode[] {}, new SharedDeclarationNode[] {}, new MethodNode[] {}, new MethodNode[] {}, _superMapping.classNode().namespace(), false, false, EmptyTraitUsageNode.factory.basicNew(), EmptyTraitUsageNode.factory.basicNew());
return ClassMapping.factory.identityMapping_extensions_instVarMappings_classNode_(IdentityClassPartMapping.factory.javaClass_isGenerated_(_receiverClass, false).withMethodMappings_(_methodMappings[0]), new ExtensionClassPartMapping[] {}, new java.util.HashMap<String, InstVarMapping>(), _classNode);
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMapping method classMappingForJavaClass_.
public ClassMapping classMappingForJavaClass_(final Class _receiverClass) {
return this.classMappingAtJavaClass_ifAbsent_(_receiverClass, ((st.gravel.support.jvm.Block0<ClassMapping>) (new st.gravel.support.jvm.Block0<ClassMapping>() {
@Override
public ClassMapping value() {
final ClassMapping _newClassMapping;
_newClassMapping = SystemMapping.this.newClassMappingForJavaClass_(_receiverClass);
_classMappingsByJavaClass.put(_receiverClass, _newClassMapping);
return (ClassMapping) _newClassMapping;
}
})));
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMapping method methodMappingForNil_.
public MethodMapping methodMappingForNil_(final String _methodName) {
final st.gravel.core.Symbol _sel;
final ClassMapping _classMapping;
_classMapping = this.nilClassMapping();
_sel = _selectorConverter.functionNameAsSelector_(_methodName);
return ((MethodMapping) this.methodMappingFrom_selector_(_classMapping, _sel));
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMapping method methodHandleForNil_.
public java.lang.invoke.MethodHandle methodHandleForNil_(final String _methodName) {
final st.gravel.core.Symbol _sel;
final ClassMapping _classMapping;
_classMapping = this.nilClassMapping();
_sel = _selectorConverter.functionNameAsSelector_(_methodName);
return this.methodHandleFrom_selector_(_classMapping, _sel);
}
Aggregations