Search in sources :

Example 11 with ClassDescriptionNode

use of st.gravel.support.compiler.ast.ClassDescriptionNode 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;
}
Also used : UnaryMethodNode(st.gravel.support.compiler.ast.UnaryMethodNode) MethodNode(st.gravel.support.compiler.ast.MethodNode) HashMap(java.util.HashMap) ExtensionClassPartMapping(st.gravel.support.compiler.ast.ExtensionClassPartMapping) IdentityClassPartMapping(st.gravel.support.compiler.ast.IdentityClassPartMapping) ClassDescriptionNode(st.gravel.support.compiler.ast.ClassDescriptionNode) BoundVariableDeclarationNode(st.gravel.support.compiler.ast.BoundVariableDeclarationNode)

Example 12 with ClassDescriptionNode

use of st.gravel.support.compiler.ast.ClassDescriptionNode in project gravel by gravel-st.

the class SimpleTraitUsageNode method canUnderstand_in_.

public boolean canUnderstand_in_(final String _selector, final SystemNode _aSystemNode) {
    final ClassDescriptionNode _trait;
    _trait = _aSystemNode.classNodeAt_(_reference);
    return _trait.canUnderstand_in_(_selector, _aSystemNode);
}
Also used : ClassDescriptionNode(st.gravel.support.compiler.ast.ClassDescriptionNode)

Example 13 with ClassDescriptionNode

use of st.gravel.support.compiler.ast.ClassDescriptionNode 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()));
}
Also used : ClassNode(st.gravel.support.compiler.ast.ClassNode) MethodNode(st.gravel.support.compiler.ast.MethodNode) Symbol(st.gravel.core.Symbol) SystemDefinitionNode(st.gravel.support.compiler.ast.SystemDefinitionNode) PackageNode(st.gravel.support.compiler.ast.PackageNode) ClassDescriptionNode(st.gravel.support.compiler.ast.ClassDescriptionNode)

Example 14 with ClassDescriptionNode

use of st.gravel.support.compiler.ast.ClassDescriptionNode in project gravel by gravel-st.

the class MetaclassNode method allMethodsIn_do_.

@Override
public MetaclassNode allMethodsIn_do_(final SystemNode _aSystemNode, final st.gravel.support.jvm.Block1<Object, MethodNode> _aBlock) {
    final ClassDescriptionNode _scn;
    for (final MethodNode _temp1 : _methods) {
        _aBlock.value_(_temp1);
    }
    _scn = this.superclassNodeIn_(_aSystemNode);
    if (_scn == null) {
        return MetaclassNode.this;
    }
    _scn.allMethodsIn_do_(_aSystemNode, _aBlock);
    return this;
}
Also used : MethodNode(st.gravel.support.compiler.ast.MethodNode) ClassDescriptionNode(st.gravel.support.compiler.ast.ClassDescriptionNode)

Aggregations

ClassDescriptionNode (st.gravel.support.compiler.ast.ClassDescriptionNode)14 MethodNode (st.gravel.support.compiler.ast.MethodNode)10 HashMap (java.util.HashMap)6 ExtensionClassPartMapping (st.gravel.support.compiler.ast.ExtensionClassPartMapping)4 UnaryMethodNode (st.gravel.support.compiler.ast.UnaryMethodNode)4 Map (java.util.Map)3 ClassNode (st.gravel.support.compiler.ast.ClassNode)3 IdentityClassPartMapping (st.gravel.support.compiler.ast.IdentityClassPartMapping)3 Reference (st.gravel.support.compiler.ast.Reference)3 AbsoluteReference (st.gravel.support.compiler.ast.AbsoluteReference)2 BoundVariableDeclarationNode (st.gravel.support.compiler.ast.BoundVariableDeclarationNode)2 JVMClass (st.gravel.support.compiler.jvm.JVMClass)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Symbol (st.gravel.core.Symbol)1 AbstractClassMapping (st.gravel.support.compiler.ast.AbstractClassMapping)1 ClassMapping (st.gravel.support.compiler.ast.ClassMapping)1 NamespaceNode (st.gravel.support.compiler.ast.NamespaceNode)1 PackageNode (st.gravel.support.compiler.ast.PackageNode)1 SimpleTraitUsageNode (st.gravel.support.compiler.ast.SimpleTraitUsageNode)1