Package st.gravel.support.compiler.ast

Examples of st.gravel.support.compiler.ast.AbstractClassMapping


  public static boolean inheritsFrom_(ObjectClass receiver, Object arg) {
    ClassMapping cm = ImageBootstrapper.systemMapping
        .classMappingForJavaClass_(receiver.getClass());
    ClassMapping other = ImageBootstrapper.systemMapping
        .classMappingForJavaClass_(arg.getClass());
    AbstractClassMapping sm = cm;
    while (sm != null) {
      sm = sm.superclassMappingIn_(ImageBootstrapper.systemMapping);
      if (sm == other)
        return true;
    }
    return false;
  }
View Full Code Here


      if (_temp1 == null) {
        _temp1 = ((st.gravel.support.jvm.runtime.AlmostFinalValue) st.gravel.support.jvm.DictionaryExtensions.at_ifAbsent_(_singletonHolders, _reference.namespace().namespace().$slash$(_reference.name()), ((st.gravel.support.jvm.Block0<st.gravel.support.jvm.runtime.AlmostFinalValue>) (new st.gravel.support.jvm.Block0<st.gravel.support.jvm.runtime.AlmostFinalValue>() {

          @Override
          public st.gravel.support.jvm.runtime.AlmostFinalValue value() {
            final AbstractClassMapping _cm;
            final AbsoluteReference _superclassReference;
            final SharedDeclarationNode _sharedVariable;
            _cm = ((AbstractClassMapping) st.gravel.support.jvm.DictionaryExtensions.at_ifAbsent_(_classMappingsByReference, _reference.namespace(), ((st.gravel.support.jvm.Block0<AbstractClassMapping>) (new st.gravel.support.jvm.Block0<AbstractClassMapping>() {

              @Override
              public AbstractClassMapping value() {
                throw new NonLocalReturn(_aBlock.value(), _temp2);
              }
            }))));
            _sharedVariable = _cm.classNode().meta().sharedVariableAt_ifAbsent_(_reference.name().asString(), new st.gravel.support.jvm.Block0<SharedDeclarationNode>() {

              @Override
              public SharedDeclarationNode value() {
                return (SharedDeclarationNode) null;
              }
            });
            if (_sharedVariable != null) {
              throw new RuntimeException("Shared not initialized: " + _reference.toString());
            }
            _superclassReference = ((AbsoluteReference) _cm.superclassReference());
            if (_superclassReference == null) {
              throw new NonLocalReturn(_aBlock.value(), _temp2);
            }
            return (st.gravel.support.jvm.runtime.AlmostFinalValue) SystemMapping.this.classSharedSingletonHolderAtReference_ifAbsent_(_superclassReference.$slash$(_reference.name()), _aBlock);
          }
View Full Code Here

  @Test
  public void testLookupClass() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    ImageBootstrapper.bootstrap();
    systemMapping = ImageBootstrapper.systemMapping;
    Reference ref = Reference.factory.value_("st.gravel.lang.Message class");
    AbstractClassMapping meta = systemMapping.classMappingAtReference_(ref);
    Object cl = systemMapping.singletonAtReference_(ref.nonmeta());
    Method basicNew = cl.getClass().getMethod("basicNew");
    Object instance = basicNew.invoke(cl);
    Method r_class = instance.getClass().getMethod("r_class");
    Object instanceClass = r_class.invoke(instance);
    assertEquals(meta.identityClass(), instanceClass.getClass());
  }
View Full Code Here

TOP

Related Classes of st.gravel.support.compiler.ast.AbstractClassMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.