use of st.gravel.support.compiler.ast.MethodNode in project gravel by gravel-st.
the class SystemMappingUpdater method compileClassDescriptionNodeStatic_.
public SystemMappingUpdater compileClassDescriptionNodeStatic_(final ClassDescriptionNode _aClassDescriptionNode) {
final Class _extensionClass;
IdentityClassPartMapping _identityMapping;
final MethodNode[] _allMethods;
final MethodNode[] _extraMethods;
final ClassDescriptionNode _ecdn;
_extraMethods = this.extraMethodsFor_(_aClassDescriptionNode);
_allMethods = this.methods_withExtraMethods_(_aClassDescriptionNode.methods(), _extraMethods);
_ecdn = _aClassDescriptionNode.withExtraMethods_(_extraMethods);
_extensionClass = this.compileClass_isStatic_(_ecdn, true);
_identityMapping = IdentityClassPartMapping.factory.javaClass_isGenerated_(_aClassDescriptionNode.isNilClass() ? null : _extensionClass, true);
_identityMapping = ((IdentityClassPartMapping) this.linkMethods_in_identityClass_to_isStatic_(_allMethods, _extensionClass, _extensionClass, _identityMapping, true));
_systemMapping.addClassMapping_(ClassMapping.factory.identityMapping_extensions_instVarMappings_classNode_(_identityMapping, new ExtensionClassPartMapping[] {}, new java.util.HashMap<String, InstVarMapping>(), _aClassDescriptionNode));
return this;
}
use of st.gravel.support.compiler.ast.MethodNode in project gravel by gravel-st.
the class SystemMappingUpdater method visitWrapJavaclassDiff_.
@Override
public SystemMappingUpdater visitWrapJavaclassDiff_(final WrapJavaclassDiff _aWrapJavaclassDiff) {
final IdentityClassPartMapping _identityMapping;
final ExtensionClassPartMapping _ecm;
final MethodNode[] _allMethods;
final MethodNode[] _extraMethods;
final ClassDescriptionNode _ecdn;
_identityMapping = IdentityClassPartMapping.factory.javaClass_isGenerated_(_compilerTools.findJavaClass_(_aWrapJavaclassDiff.classNode().javaClassPath()), false);
_extraMethods = this.extraMethodsFor_(_aWrapJavaclassDiff.classNode());
_ecdn = _aWrapJavaclassDiff.classNode().withExtraMethods_(_extraMethods);
_allMethods = this.methods_withExtraMethods_(_aWrapJavaclassDiff.classNode().methods(), _extraMethods);
_ecm = this.compileExtensionClassPartMapping_methods_identityClass_instVars_sourceFile_(_ecdn, _allMethods, _identityMapping.javaClass(), new BoundVariableDeclarationNode[] {}, _aWrapJavaclassDiff.classNode().findSourceFile());
_systemMapping.addClassMapping_(ClassMapping.factory.identityMapping_extensions_instVarMappings_classNode_(_identityMapping, st.gravel.support.jvm.ArrayFactory.with_(_ecm), new java.util.HashMap<String, InstVarMapping>(), _aWrapJavaclassDiff.classNode()));
this.compileClassDescriptionNode_(_aWrapJavaclassDiff.classNode().metaclassNode());
_toInitialize.add(_aWrapJavaclassDiff.classNode().metaclassNode().reference());
return this;
}
use of st.gravel.support.compiler.ast.MethodNode in project gravel by gravel-st.
the class SystemMappingUpdater method localLinkMethods_instVars_ownerReference_.
public MethodNode[] localLinkMethods_instVars_ownerReference_(final MethodNode[] _methods, final BoundVariableDeclarationNode[] _instVars, final Reference _ownerReference) {
final SelfNode[] _owner;
_owner = new SelfNode[1];
_owner[0] = SelfNode.factory.basicNew();
return st.gravel.support.jvm.ArrayExtensions.collect_(_methods, ((st.gravel.support.jvm.Block1<MethodNode, MethodNode>) (new st.gravel.support.jvm.Block1<MethodNode, MethodNode>() {
@Override
public MethodNode value_(final MethodNode _m) {
final MethodNode _fieldAccessed;
_fieldAccessed = ((MethodNode) SystemMappingUpdater.this.localLink_instVars_ownerReference_owner_(_m, _instVars, _ownerReference, _owner[0]));
return (MethodNode) _fieldAccessed;
}
})));
}
use of st.gravel.support.compiler.ast.MethodNode in project gravel by gravel-st.
the class LiteralBlockSendCallSite method findMethodForNil.
@Override
protected MethodHandle findMethodForNil() {
MethodMapping methodMapping = ImageBootstrapper.systemMapping.methodMappingForNil_(selector);
if (methodMapping == null) {
return createDNUHandleForNil();
}
MethodNode methodNode = methodMapping.methodNode();
return inlineBlocks(methodNode, ImageBootstrapper.systemMapping.nilClassMapping().reference(), JVMDefinedObjectType.factory.object());
}
use of st.gravel.support.compiler.ast.MethodNode in project gravel by gravel-st.
the class ClassDescriptionMirror method compile_classified_.
public Object compile_classified_(String source, String protocol) {
final MethodNode method = Parser.factory.parseMethod_(source).withProtocol_(protocol);
ClassDescriptionNode currentClassNode = definitionClassNode();
final MethodNode current = currentClassNode.methodOrNilAt_(method.selector());
Symbol targetPackageName = current == null ? definitionClassNode().packageName() : current.packageName();
if (targetPackageName == null) {
targetPackageName = definitionClassNode().packageName();
if (targetPackageName == null) {
targetPackageName = current.packageName();
}
}
SystemDefinitionNode newSystem = ImageBootstrapper.systemMapping.systemDefinitionNode().copyUpdatePackage_do_(targetPackageName, new Block1<PackageNode, PackageNode>() {
@Override
public PackageNode value_(PackageNode packageNode) {
return packageNode.copyUpdateClassNode_do_(definitionClassNode().reference(), new Block1<ClassNode, ClassNode>() {
@Override
public ClassNode value_(ClassNode classNode) {
return current == null ? classNode.withMethodNode_(method) : classNode.copyReplaceMethodNode_(method);
}
});
}
});
ImageBootstrapper.systemMapping.updateTo_(newSystem);
return getMethodMirror(Symbol.value(method.selector()));
}
Aggregations