示例#1
0
 // TODO: convert to static method; caller parameter doesn't belong here
 /// <exception cref="InterpreterError"><paramref name="argspec"/> is invalid.</exception>
 public ZilFunction([NotNull] string caller, [CanBeNull] ZilAtom name, [CanBeNull] ZilAtom activationAtom,
                    [NotNull][ItemNotNull] IEnumerable <ZilObject> argspec, ZilDecl decl,
                    [ItemNotNull][NotNull] IEnumerable <ZilObject> body)
 {
     this.argspec = ArgSpec.Parse(caller, name, activationAtom, argspec, decl);
     this.body    = body.ToArray();
 }
示例#2
0
 protected override ZilResult EvalImpl(Context ctx, LocalEnvironment environment, ZilAtom originalType) =>
 throw new InterpreterError(InterpreterMessages.A_SEGMENT_Can_Only_Be_Evaluated_Inside_A_Structure);
示例#3
0
        protected override ZilResult EvalImpl(Context ctx, LocalEnvironment environment, ZilAtom originalType)
        {
            var result = EvalSequence(ctx, this, environment).ToZilListResult(SourceLine);

            if (result.ShouldPass())
            {
                return(result);
            }

            return(originalType != null?ctx.ChangeType((ZilObject)result, originalType) : result);
        }
示例#4
0
        protected override ZilResult EvalImpl(Context ctx, LocalEnvironment environment, ZilAtom originalType)
        {
            var result = First.Eval(ctx, environment);

            if (!result.ShouldPass())
            {
                ctx.MaybeCheckDecl(this, (ZilObject)result, Second, "result of evaluating {0}", First);
            }
            return(result);
        }
示例#5
0
 public static ZilActivation FromAtom([NotNull] Context ctx, [NotNull] ZilAtom name)
 {
     throw new InterpreterError(InterpreterMessages.CHTYPE_To_0_Not_Supported, "ACTIVATION");
 }
示例#6
0
 public ZilActivation(ZilAtom name)
 {
     this.name = name;
 }
示例#7
0
 public ZilStructuredHash(ZilAtom type, PrimType primType, IStructure primValue)
     : base(type, primType, primValue)
 {
 }
示例#8
0
 public new static ZilLink FromAtom(Context ctx, ZilAtom atom)
 {
     throw new InterpreterError(InterpreterMessages.CHTYPE_To_0_Not_Supported, "LINK");
 }
示例#9
0
 protected ZilHashBase(ZilAtom type, PrimType primType, TPrim primValue)
 {
     this.type      = type;
     this.primType  = primType;
     this.primValue = primValue;
 }
示例#10
0
 /// <exception cref="InterpreterError"><paramref name="argspec"/> is invalid.</exception>
 public ZilFunction([CanBeNull] ZilAtom name, [CanBeNull] ZilAtom activationAtom,
                    [NotNull][ItemNotNull] IEnumerable <ZilObject> argspec, ZilDecl decl,
                    [ItemNotNull][NotNull] IEnumerable <ZilObject> body)
     : this("<internal>", name, activationAtom, argspec, decl, body)
 {
 }
示例#11
0
 public ZilEnvironment(LocalEnvironment env, ZilAtom name)
 {
     this.env  = new WeakReference <LocalEnvironment>(env);
     this.name = name;
 }
示例#12
0
 public static ZilEnvironment FromAtom([NotNull] Context ctx, [NotNull] ZilAtom atom)
 {
     throw new InterpreterError(InterpreterMessages.CHTYPE_To_0_Not_Supported, "ENVIRONMENT");
 }
示例#13
0
 public static ZilAtom FromAtom([NotNull] Context ctx, [NotNull] ZilAtom other)
 {
     // we can't construct a new atom since it wouldn't be equal to the old one
     return(other);
 }