Exemple #1
0
        public override void CaseAFuncDecl(AFuncDecl node)
        {
            Scope sub = Env.CurrentScope.AddSubScope(node);

            Env.CurrentScope = sub;
            base.CaseAFuncDecl(node);
        }
Exemple #2
0
 public ScopeInfo(AFuncDecl decl, Scope scope)
 {
     mFunction = decl;
     mBlock    = null;
     mType     = ScopeType.Function;
     mScope    = scope;
 }
 public override void CaseAFuncDecl(AFuncDecl node)
 {
     // find the scope of the func decl, and make it the
     // current scope.
     mEnv.CurrentScope = mEnv.CurrentScope.GetScope(node);
     base.CaseAFuncDecl(node);
 }
 public override void CaseAFuncDecl(AFuncDecl node)
 {
     // find the scope of the func decl, and make it the
     // current scope.
     mEnv.CurrentScope = mEnv.CurrentScope.GetScope(node);
     mOutputFile.Add(new Label(node.GetName().Text));
     base.CaseAFuncDecl(node);
 }
Exemple #5
0
        public Scope AddSubScope(AFuncDecl decl)
        {
            Scope child = new Scope();

            child.Parent = this;
            mSubScopes.Add(child);
            ScopeInfo inf = new ScopeInfo(decl, child);

            mSubScopeInfo.Add(inf);
            return(child);
        }
Exemple #6
0
 public Scope GetScope(AFuncDecl decl)
 {
     foreach (ScopeInfo info in mSubScopeInfo)
     {
         if (info.Type == ScopeType.Function)
         {
             if (info.Function == decl)
             {
                 return(info.Scope);
             }
         }
     }
     return(null);
 }
Exemple #7
0
 public FunctionShell(AFuncDecl decl)
 {
     ReturnType = TypeEnvironment.GetTypename(decl.GetType());
     Name       = decl.GetName().ToString();
 }
Exemple #8
0
 public override void OutAFuncDecl(AFuncDecl node)
 {
     Env.CurrentScope = Env.CurrentScope.Parent;
     base.OutAFuncDecl(node);
 }
 public override void CaseAFuncDecl(AFuncDecl node)
 {
     base.CaseAFuncDecl(node);
 }