use of st.gravel.support.compiler.ast.BoundVariableDeclarationNode in project gravel by gravel-st.
the class JVMClassCompiler method compileClassNode.
public JVMClass compileClassNode() {
final MethodNode[] _allMethods;
Reference _superclassReference;
BoundVariableDeclarationNode[] _allInstVars;
final MethodNode[] _localLinkedMethods;
ClassDescriptionNode _scn;
if (_ownerType == null) {
_ownerType = ((JVMDefinedObjectType) _selfType);
}
_allMethods = _classDescriptionNode.methods();
_superclassReference = _classDescriptionNode.superclassReference();
_allInstVars = _classDescriptionNode.boundInstVars();
boolean _temp1 = false;
while (!_temp1) {
_temp1 = _superclassReference == null;
if (!_temp1) {
_scn = _systemNode.classNodeAt_(_superclassReference);
_superclassReference = _scn.superclassReference();
_allInstVars = st.gravel.support.jvm.ArrayExtensions.copyWithAll_(_scn.boundInstVars(), _allInstVars);
}
}
_localLinkedMethods = _systemMappingUpdater.localLinkMethods_instVars_ownerReference_(_allMethods, _allInstVars, _classDescriptionNode.reference());
for (final MethodNode _each : _localLinkedMethods) {
JVMClassCompiler.this.compileMethod_(_each);
}
for (final VariableDeclarationNode _each : _classDescriptionNode.instVars()) {
_fields.add(JVMField.factory.ownerType_varName_type_isStatic_(_ownerType, _each.name(), TypeNodeToJVMTypeConverter.factory.namespace_(JVMClassCompiler.this.namespace()).visit_(_each.type()), false));
}
this.compileBlocks();
return this.createContainerClass();
}
use of st.gravel.support.compiler.ast.BoundVariableDeclarationNode in project gravel by gravel-st.
the class BlockInliner method link_.
public MethodNode link_(final MethodNode _aMethodNode) {
final SelfNode _owner;
final SystemMappingUpdater _updater;
final BoundVariableDeclarationNode[] _instVars;
_owner = SelfNode.factory.basicNew();
_updater = _systemMapping.newSystemMappingUpdater();
_instVars = _updater.allInstVarsForReference_(_receiverReference);
return ((MethodNode) _updater.localLink_instVars_ownerReference_owner_(_aMethodNode, _instVars, _receiverReference, _owner));
}
use of st.gravel.support.compiler.ast.BoundVariableDeclarationNode in project gravel by gravel-st.
the class ClassMapping method allInstVarsIn_.
@Override
public BoundVariableDeclarationNode[] allInstVarsIn_(final SystemMapping _aSystemMapping) {
final BoundVariableDeclarationNode[] _arr;
final ClassMapping _scm;
_arr = this.boundInstVars();
_scm = ((ClassMapping) this.superclassMappingIn_(_aSystemMapping));
if (_scm != null) {
return st.gravel.support.jvm.ArrayExtensions.copyWithAll_(_arr, _scm.allInstVarsIn_(_aSystemMapping));
}
return _arr;
}
use of st.gravel.support.compiler.ast.BoundVariableDeclarationNode 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.BoundVariableDeclarationNode in project gravel by gravel-st.
the class SystemMappingUpdater method localLink_instVars_ownerReference_owner_.
public Node localLink_instVars_ownerReference_owner_(final Node _node, final BoundVariableDeclarationNode[] _instVars, final Reference _ownerReference, final Expression _owner) {
final Node _intermediate;
final Node _nonLocal;
final Node _holderized;
final Node _fieldAccessed;
_intermediate = IntermediateNodeRewriter.factory.visit_(_node);
_nonLocal = NonLocalReturnRewriter.factory.nlrMarker_(_compilerTools.nextNlrMarker()).visit_(_intermediate);
_holderized = NonLocalTempWritesToHolderConverter.factory.visit_(_nonLocal);
_fieldAccessed = VariableAccessToFieldAccessConverter.factory.instVars_owner_ownerReference_(_instVars, _owner, _ownerReference).visit_(_holderized);
return _fieldAccessed;
}
Aggregations