示例#1
0
        public override IType check(Context context)
        {
            Context instanceContext = context.newInstanceContext(type, true);
            Context childContext    = instanceContext.newChildContext();

            return(statements.check(childContext, null));
        }
示例#2
0
        private IType checkItemIterator(IType elemType, Context context)
        {
            Context child    = context.newChildContext();
            String  itemName = v2 == null ? v1 : v2;

            child.registerValue(new Variable(itemName, elemType));
            if (v2 != null)
            {
                child.registerValue(new Variable(v1, IntegerType.Instance));
            }
            return(statements.check(child, null));
        }
示例#3
0
        public IType check(Context context)
        {
            IType cond = condition.check(context);

            if (cond != BooleanType.Instance)
            {
                throw new SyntaxError("Expected a Boolean condition!");
            }
            Context child = context.newChildContext();

            return(statements.check(child, null));
        }
示例#4
0
        public override IType check(Context context)
        {
            IType type = resolveAndCheck(context);

            context = context.newChildContext();
            if (resultName != null)
            {
                context.registerValue(new Variable(resultName, type));
            }
            andThen.check(context, VoidType.Instance);
            return(VoidType.Instance);
        }
示例#5
0
 public IType check(Context context)
 {
     if (condition != null)
     {
         IType cond = condition.check(context);
         if (cond != BooleanType.Instance)
         {
             throw new SyntaxError("Expected a bool condition!");
         }
     }
     context = downCast(context, false);
     return(statements.check(context, null));
 }
示例#6
0
 protected virtual void collectReturnTypes(Context context, TypeMap types)
 {
     foreach (SwitchCase sc in switchCases)
     {
         IType type = sc.checkReturnType(context);
         if (type != VoidType.Instance)
         {
             types.add(type);
         }
     }
     if (defaultCase != null)
     {
         IType type = defaultCase.check(context, null);
         if (type != VoidType.Instance)
         {
             types.add(type);
         }
     }
 }
示例#7
0
        protected override void collectReturnTypes(Context context, TypeMap types)
        {
            IType type = statements.check(context, null);

            if (type != VoidType.Instance)
            {
                types.add(type);
            }
            Context local = context.newLocalContext();

            local.registerValue(new ErrorVariable(errorName));
            base.collectReturnTypes(local, types);
            if (alwaysStatements != null)
            {
                type = alwaysStatements.check(context, null);
                if (type != VoidType.Instance)
                {
                    types.add(type);
                }
            }
        }
示例#8
0
 public IType checkReturnType(Context context)
 {
     return(statements.check(context, null));
 }
示例#9
0
 public IType check(Context context)
 {
     context = context.newResourceContext();
     resource.checkResource(context);
     return(statements.check(context, null));
 }