예제 #1
0
        public IPropertyAssignment MakePropertyGetAssignment(Scope scope, ILiteral name, IStatement body, Scope innerScope)
        {
            // TODO: Is calling ToString() adequate here?
            // TODO: Implement properly. This is just a quick hack to get things semi-working.
            var getterName = MakeIdentifier(innerScope, name.ToString(), ((Node)name).SourceOffset);
            var getter     = MakeFunctionExpression(scope, getterName, MakeIdentifierList(), body, innerScope);

            return(new PropertyAssignment(name.ToString(), null, getter));
        }
예제 #2
0
 public Boolean BooleanValue(ILiteral literal)
 {
     if (literal is IntVar || literal is NotBooleanVariable)
     {
         int index = literal.GetIndex();
         return(SolutionBooleanValue(index));
     }
     else
     {
         throw new ArgumentException("Cannot evaluate '" + literal.ToString() + "' as a boolean literal");
     }
 }
예제 #3
0
 public Boolean BooleanValue(ILiteral literal)
 {
     if (literal is IntVar || literal is NotBooleanVariable)
     {
         int index = literal.GetIndex();
         if (index >= 0)
         {
             return(response_.Solution[index] != 0);
         }
         else
         {
             return(response_.Solution[-index - 1] == 0);
         }
     }
     else
     {
         throw new ArgumentException("Cannot evaluate '" + literal.ToString() + "' as a boolean literal");
     }
 }
예제 #4
0
 public IPropertyAssignment MakePropertySetAssignment(Scope scope, ILiteral name, IIdentifier paramName, IStatement body, Scope innerScope)
 {
   // TODO: Is calling ToString() adequate here?
   // TODO: Implement properly. This is just a quick hack to get things semi-working.
   var paramList = MakeIdentifierList();
   paramList.Add(paramName);
   var setterName = MakeIdentifier(innerScope, name.ToString(), ((Node)name).SourceOffset);
   var setter = MakeFunctionExpression(scope, setterName, paramList, body, innerScope);
   return new PropertyAssignment(name.ToString(), setter, null);
 }