Package edu.cmu.cs.fusion.constraint.operations

Examples of edu.cmu.cs.fusion.constraint.operations.BeginOfMethodOp


    params.add(new StubVariable());
    params.add(new StubVariable());
    StubVariable var = new StubVariable();

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(var, params);
    BeginOfMethodOp op = new BeginOfMethodOp(null, "name", null, null, false);
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(map != null);
    assertEquals(1, map.size());
    assertTrue(map.contains(new Binding(Constraint.RECEIVER, var)));
  }
View Full Code Here


    List<Variable> params = new ArrayList<Variable>();
    params.add(new StubVariable());
    params.add(new StubVariable());

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(new StubVariable(), params);
    BeginOfMethodOp op = new BeginOfMethodOp("Bar", null, null, null, false);
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(map == null);
  }
View Full Code Here

    params.add(new StubVariable());
    params.add(new StubVariable());
    StubVariable var = new StubVariable();

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(var, params);
    BeginOfMethodOp op = new BeginOfMethodOp("Foo", null, null, null, false);
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(map != null);
    assertEquals(1, map.size());
    assertTrue(map.contains(new Binding(Constraint.RECEIVER, var)));
  }
View Full Code Here

    params.add(new StubVariable());

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(new StubVariable(), params);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0), utils.getVar(1)};
    String[] vTypes = new String[] {"Bar", "Baz", "blah"};
    BeginOfMethodOp op = new BeginOfMethodOp(null, null, vars, vTypes, false);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(list == null);
  }
View Full Code Here

    params.add(new StubVariable());

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(new StubVariable(), params);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0), utils.getVar(1)};
    String[] vTypes = new String[] {"Bar", "Baz2"};
    BeginOfMethodOp op = new BeginOfMethodOp(null, null, vars, vTypes, false);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(list == null)
  }
View Full Code Here

    params.add(p2);

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(tVar, params);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0), utils.getVar(1)};
    String[] vTypes = new String[] {"Bar", "Baz"};
    BeginOfMethodOp op = new BeginOfMethodOp("Foo", "name", vars, vTypes, false);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(list != null);
    assertTrue(list.contains(new Binding(Constraint.RECEIVER, tVar)));
    assertTrue(list.contains(new Binding(utils.getVar(0), p1)));
    assertTrue(list.contains(new Binding(utils.getVar(1), p2)));
View Full Code Here

    params.add(p2);

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(tVar, params);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0), utils.getVar(1)};
    String[] vTypes = new String[] {"Bar", "Baz"};
    BeginOfMethodOp op = new BeginOfMethodOp("Foo", "name", vars, vTypes, true);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(list != null);
    assertTrue(list.contains(new Binding(utils.getVar(0), p1)));
    assertTrue(list.contains(new Binding(utils.getVar(1), p2)));
   
View Full Code Here

    params.add(tVar);

    Pair<EntryInstruction, Method> pair = getEntryAndMethod(tVar, params);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0), utils.getVar(1)};
    String[] vTypes = new String[] {"Bar", "Baz"};
    BeginOfMethodOp op = new BeginOfMethodOp(null, null, vars, vTypes, false);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), pair.snd(), pair.fst());
   
    assertTrue(list != null);
    assertTrue(list.contains(new Binding(Constraint.RECEIVER, tVar)));
    assertTrue(list.contains(new Binding(utils.getVar(0), tVar)));
    assertTrue(list.contains(new Binding(utils.getVar(1), tVar)));
View Full Code Here

      params[ndx] = new SpecVar(methodType.getParameterNames()[ndx]);
    }
   
    boolean isStatic = Flags.isStatic(methodType.getFlags());
   
    Operation op = new BeginOfMethodOp(declaringType.getFullyQualifiedName(), methodType.getElementName(), params, paramTypes, isStatic);
    List<Effect> effects = new LinkedList<Effect>();
    effects.add(RelEffect.createAddEffect(relation, new SpecVar[] {Constraint.RECEIVER}));
   
    String owner = methodType.getDeclaringType().getFullyQualifiedName();
    constraints.add(new Constraint(owner, op, new TruePredicate(), new TruePredicate(), new TruePredicate(), effects));
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.operations.BeginOfMethodOp

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.