Пример #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);
 }