Esempio n. 1
0
 void ConditionalAddByte([NotNull] IWordBuilder wb, string word, CompileConstantDelegate compileConstant,
                         [CanBeNull] ZilObject value)
 {
     if (value == null)
     {
         wb.AddByte(0);
     }
     else
     {
         var operand = compileConstant(value);
         if (operand == null)
         {
             ctx.HandleError(new CompilerError(
                                 CompilerMessages.Nonconstant_Initializer_For_0_1_2,
                                 "vocab word",
                                 word,
                                 value.ToString()));
             wb.AddByte(0);
         }
         else
         {
             wb.AddByte(operand);
         }
     }
 }
Esempio n. 2
0
 public void VisitDeclConstraint(ZilObject pattern)
 {
     result = new JObject {
         ["constraint"] = "decl", ["decl"] = pattern.ToString()
     };
 }