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);
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMappingUpdater method compiledMethodNodesIn_do_.
public SystemMappingUpdater compiledMethodNodesIn_do_(final Reference _superclassReference, final st.gravel.support.jvm.Block1<Object, MethodNode> _aBlock) {
final ClassMapping[] _superMapping;
final Class _sc;
final java.util.Set<st.gravel.core.Symbol>[] _allSelectors;
_allSelectors = new java.util.Set[1];
_superMapping = new ClassMapping[1];
if (_superclassReference == null) {
return SystemMappingUpdater.this;
}
_superMapping[0] = ((ClassMapping) _systemMapping.classMappingAtReference_(_superclassReference));
_allSelectors[0] = _superMapping[0].allSelectorsIn_(_systemMapping);
_sc = _superMapping[0].identityClass();
_compilerTools.methodNamesIn_do_(_sc, 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 (_allSelectors[0].contains(_sel)) {
final AbstractMethodMapping _methodMapping;
_methodMapping = _systemMapping.methodMappingFrom_selector_(_superMapping[0], _sel);
if ((_methodMapping != null) && (_methodMapping.methodNode() != null)) {
return _aBlock.value_(_methodMapping.methodNode());
}
}
return SystemMappingUpdater.this;
}
});
return this;
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMappingUpdater method executeUpdateClassDescriptorDiff_reference_.
public SystemMappingUpdater executeUpdateClassDescriptorDiff_reference_(final UpdateClassDescriptorDiff _anUpdateClassDescriptorDiff, final Reference _aReference) {
final ExtensionClassPartMapping _ecm;
ClassMapping _cm;
final ClassDescriptionNode _ncn;
final MethodNode[] _methods;
_cm = ((ClassMapping) _systemMapping.classMappingAtReference_(_aReference));
_cm = ((ClassMapping) st.gravel.support.jvm.ArrayExtensions.inject_into_(_anUpdateClassDescriptorDiff.updatedMethodNodes(), _cm, ((st.gravel.support.jvm.Block2<ClassMapping, ClassMapping, MethodNode>) (new st.gravel.support.jvm.Block2<ClassMapping, ClassMapping, MethodNode>() {
@Override
public ClassMapping value_value_(final ClassMapping _classMapping, final MethodNode _methodNode) {
return (ClassMapping) _classMapping.withoutMethodMapping_(_methodNode.selector());
}
}))));
_cm = ((ClassMapping) st.gravel.support.jvm.ArrayExtensions.inject_into_(_anUpdateClassDescriptorDiff.deletedSelectors(), _cm, ((st.gravel.support.jvm.Block2<ClassMapping, ClassMapping, String>) (new st.gravel.support.jvm.Block2<ClassMapping, ClassMapping, String>() {
@Override
public ClassMapping value_value_(final ClassMapping _classMapping, final String _selector) {
return (ClassMapping) _classMapping.withoutMethodMapping_(_selector);
}
}))));
_ncn = _anUpdateClassDescriptorDiff.applyOnClassNode_(_cm.classNode());
_methods = st.gravel.support.jvm.ArrayExtensions.copyWithAll_(_anUpdateClassDescriptorDiff.methodNodes(), _anUpdateClassDescriptorDiff.updatedMethodNodes());
_ecm = this.compileExtensionClassPartMapping_methods_identityClass_instVars_sourceFile_(_ncn, _methods, _cm.identityClass(), _cm.classNode().boundInstVars(), this.findSourceFile_(_anUpdateClassDescriptorDiff.methodNodes()));
_systemMapping.addClassMapping_(_cm.withClassNode_(_ncn).withExtension_(_ecm));
return this;
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMappingUpdater method link.
public SystemMappingUpdater link() {
_systemMapping.classMappingsDo_(new st.gravel.support.jvm.Block1<Object, AbstractClassMapping>() {
@Override
public Object value_(final AbstractClassMapping _acm) {
if (_acm.classNode().isMeta()) {
SystemMappingUpdater.this.initializeClassShareds_(((MetaclassNode) _acm.classNode()));
return _systemMapping.singletonAtReference_ifAbsentPut_(_acm.reference().nonmeta(), new st.gravel.support.jvm.Block0<Object>() {
@Override
public Object value() {
return _compilerTools.createSingletonForClass_(_acm.identityClass());
}
});
}
return SystemMappingUpdater.this;
}
});
_compilerTools.resetCallsites();
_systemMapping.namespaceGlobalsAndInitializersDo_(new st.gravel.support.jvm.Block2<Object, AbsoluteReference, SharedDeclarationNode>() {
@Override
public Object value_value_(final AbsoluteReference _reference, final SharedDeclarationNode _sharedVariable) {
return _systemMapping.singletonAtReference_initialize_(_reference, _sharedVariable);
}
});
for (final Reference _ref : _toInitialize) {
_compilerTools.initializeClass_systemMapping_(((ClassMapping) _systemMapping.classMappingAtReference_(_ref)), _systemMapping);
}
_toInitialize = new java.util.ArrayList();
return this;
}
use of st.gravel.support.compiler.ast.ClassMapping in project gravel by gravel-st.
the class SystemMapping method methodHandleFor_methodName_.
public java.lang.invoke.MethodHandle methodHandleFor_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 this.methodHandleFrom_selector_(_classMapping, _sel);
}
Aggregations