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)); }
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"); } }
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"); } }
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); }