コード例 #1
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (exp != null)
            {
                if (exp is Exp)
                {
                    r &= ((Exp)exp).Resolve(env, false);
                }
                else
                {
                    r &= exp.Resolve(env);
                }
            }
            if (stm != null)
            {
                if (stm is Exp)
                {
                    r &= ((Exp)stm).Resolve(env, true);
                }
                else
                {
                    r &= stm.Resolve(env);
                }
            }
            return(r);
        }
コード例 #2
0
 internal override bool Resolve(Environment env)
 {
     if (!InFunction)
     {
         throw new Exception("error JS1018: 'return' statement outside of function");
     }
     if (expression != null)
     {
         if (expression is Expression)
         {
             AST ast = ((Expression)expression).Last;
             if (ast is Call)
             {
                 Call call = (Call)ast;
                 if (call.member_exp is Identifier)
                 {
                     object obj = env.Get(String.Empty, ((Identifier)call.member_exp).name);
                     if (obj is Function)
                     {
                         exp_returns_void = ((Function)obj).HandleReturnType == typeof(void);
                     }
                 }
             }
         }
         OnNotVoidReturn(null);
         return(expression.Resolve(env));
     }
     else
     {
         return(true);
     }
 }
コード例 #3
0
ファイル: ForIn.cs プロジェクト: mayatforest/Refractor
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (lhs != null)
            {
                if (lhs is VariableStatement)
                {
                    ((ICanModifyContext)lhs).PopulateContext(env, String.Empty);
                }
                else
                {
                    r &= lhs.Resolve(env);
                }
            }
            if (obj != null)
            {
                r &= obj.Resolve(env);
            }

            if (body != null)
            {
                if (body is Exp)
                {
                    r &= ((Exp)body).Resolve(env, true);
                }
                else
                {
                    r &= body.Resolve(env);
                }
            }
            return(r);
        }
コード例 #4
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (guarded_block != null)
            {
                r &= guarded_block.Resolve(env);
            }

            if (catch_blocks != null && catch_blocks.Count > 0)
            {
                foreach (Catch c in catch_blocks)
                {
                    env.BeginScope(String.Empty, true);
                    env.Enter(String.Empty, Symbol.CreateSymbol(c.id), c);
                    r &= c.Resolve(env);
                    env.EndScope(String.Empty);
                }
            }
            if (finally_block != null)
            {
                r &= finally_block.Resolve(env);
            }
            return(r);
        }
コード例 #5
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (stms != null)
            {
                r &= stms.Resolve(env);
            }
            return(r);
        }
コード例 #6
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (val != null)
            {
                r = val.Resolve(env);
            }
            lexical_depth = env.Depth(String.Empty);
            func_decl     = GetContainerFunction;
            return(r);
        }
コード例 #7
0
 internal override bool Resolve(Environment env)
 {
     try {
         SemanticAnalyser.AddLabel(name, this);
     } catch (ArgumentException) {
         throw new Exception("error JS1025: Label redefined");
     }
     if (stm != null)
     {
         stm.Resolve(env);
     }
     SemanticAnalyser.RemoveLabel(name);
     return(true);
 }
コード例 #8
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (exp != null)
            {
                r &= exp.Resolve(env);
            }
            foreach (AST ast in stm_list)
            {
                if (ast is Exp)
                {
                    r &= ((Exp)ast).Resolve(env, true);
                }
                else
                {
                    r &= ast.Resolve(env);
                }
            }
            return(r);
        }
コード例 #9
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            if (exp != null)
            {
                r &= exp.Resolve(env);
            }
            if (case_clauses != null)
            {
                foreach (Clause c in case_clauses)
                {
                    r &= c.Resolve(env);
                }
            }
            if (default_clauses != null)
            {
                foreach (AST dc in default_clauses)
                {
                    if (dc is Exp)
                    {
                        r &= ((Exp)dc).Resolve(env, true);
                    }
                    else
                    {
                        r &= dc.Resolve(env);
                    }
                }
            }
            if (sec_case_clauses != null)
            {
                foreach (Clause sc in sec_case_clauses)
                {
                    r &= sc.Resolve(env);
                }
            }
            return(r);
        }
コード例 #10
0
        internal override bool Resolve(Environment env)
        {
            bool r = true;

            for (int i = 0; i < 3; ++i)
            {
                AST e = exprs[i];
                if (e is Exp)
                {
                    r &= ((Exp)e).Resolve(env, i != 1);
                }
                else
                {
                    r &= e.Resolve(env);
                }
            }

            if (stms != null)
            {
                r &= stms.Resolve(env);
            }
            return(true);
        }
コード例 #11
0
ファイル: Throw.cs プロジェクト: mayatforest/Refractor
 internal override bool Resolve(Environment env)
 {
     return(expression.Resolve(env));
 }