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;
}
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);
}
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()));
}
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;
}
Aggregations