Package edu.mit.csail.sdg.alloy4compiler.ast

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig$Field


            if (a.parent!=null && a.parent!=UNIV) expr = sig2meta.get(a.parent);
         }
         e.getValue().addDefinedField(Pos.UNKNOWN, null, Pos.UNKNOWN, "parent", (expr==null ? ExprConstant.EMPTYNESS : expr));
      }
      for(Map.Entry<Sig,PrimSig> e: sig2meta.entrySet()) {
         Sig s = e.getKey();
         PrimSig s2 = e.getValue();
         Expr allfields = ExprConstant.EMPTYNESS;
         for(Field f: s.getFields()) {
            PrimSig metaF = field2meta.get(f);
            if (allfields==ExprConstant.EMPTYNESS) allfields = metaF; else allfields = allfields.plus(metaF);
         }
         if (s instanceof PrimSig) for(Sig c: (((PrimSig)s).descendents())) for(Field f: c.getFields()) {
            PrimSig metaF = field2meta.get(f);
View Full Code Here


      for(CompModule x: root.allModules) {
         errors = x.resolveFuncBody(rep, errors, warns);
         errors = x.resolveAssertions(rep, errors, warns);
         errors = x.resolveFacts(root, rep, errors, warns);
         // also, we can collect up all the exact sigs and add them to the root module's list of exact sigs
         for(String n: x.exactParams) { Sig sig = x.params.get(n); if (sig!=null) root.exactSigs.add(sig); }
      }
      if (!errors.isEmpty()) throw errors.pick();
      // Typecheck the run/check commands (which can refer to function bodies and assertions)
      root.resolveCommands(root.getAllReachableFacts());
      if (!errors.isEmpty()) throw errors.pick();
View Full Code Here

      if (name.equals("seq/Int"))    return ExprUnary.Op.NOOP.make(pos, SEQIDX);
      if (name.equals("String"))     return ExprUnary.Op.NOOP.make(pos, STRING);
      if (name.equals("none"))       return ExprUnary.Op.NOOP.make(pos, NONE);
      if (name.equals("iden"))       return ExprConstant.Op.IDEN.make(pos, 0);
      if (name.equals("sig$") || name.equals("field$")) if (world!=null) {
         Sig s = world.sigs.get(name);
         if (s!=null) return ExprUnary.Op.NOOP.make(pos, s);
      }
      final List<Object> ans = name.indexOf('/')>=0 ? getRawQS(fun?5:1, name) : getRawNQS(this, fun?5:1, name);
      final Sig param = params.get(name); if (param!=null && !ans.contains(param)) ans.add(param);
      for(Object x: ans) {
         if (x instanceof Sig) {
            Sig y = (Sig)x;
            ch.add(ExprUnary.Op.NOOP.make(pos, y, null, 0));
            re.add("sig "+y.label);
         }
         else if (x instanceof Func) {
            Func f = (Func)x;
View Full Code Here

                i++;
                if (i>=t.length-1 || !(t[i] instanceof String) || !(t[i+1] instanceof String)) return null;
                String sigName = (String)(t[i]);
                i++;
                String fieldName = (String)(t[i]);
                Sig first = hasSig(sigs,sigName);
                if (first==null) return null;
                Expression expr = null;
                if (fieldName.length()==0) {
                    expr=frame.a2k(first);
                } else {
                    for(Field field:first.getFields()) if (field.label.equals(fieldName)) {
                        expr=frame.a2k(field);
                        while(expr instanceof BinaryExpression) expr=((BinaryExpression)expr).right();
                        break;
                    }
                }
View Full Code Here

        return newMock(FieldValidatorSource.class);
    }

    protected final Field mockFieldWithLabel(String label)
    {
        Field field = mockField();

        train_getLabel(field, label);

        return field;
    }
View Full Code Here

    @Test(dataProvider = "parse_client_failure_data")
    public void parse_client_failure(Class type, String input, String expectedMessage)
    {
        Translator t = source.getByType(type);
        Field field = mockField();

        replay();

        try
        {
View Full Code Here

    public FieldTranslator createDefaultTranslator(ComponentResources resources, String parameterName)
    {
        assert resources != null;
        assert InternalUtils.isNonBlank(parameterName);
        Field field = (Field) resources.getComponent();
        Class propertyType = resources.getBoundType(parameterName);

        return createDefaultTranslator(field, resources.getId(), resources.getContainerMessages(),
                null, propertyType, resources.getAnnotationProvider(parameterName));
    }
View Full Code Here

    public FieldTranslator createTranslator(ComponentResources resources, String translatorName)
    {
        assert resources != null;
        assert InternalUtils.isNonBlank(translatorName);
        Field field = (Field) resources.getComponent();

        Translator translator = translatorSource.get(translatorName);

        return createTranslator(field, resources.getId(), resources.getContainerMessages(), null, translator);
    }
View Full Code Here

public class FieldTranslatorSourceImplTest extends InternalBaseTestCase
{
    @Test
    public void create_default_property_type_null()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;

        replay();
View Full Code Here

    }

    @Test
    public void create_default_translator_not_found_for_type()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        AnnotationProvider ap = mockAnnotationProvider(null);
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4compiler.ast.Sig$Field

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.