Beispiel #1
0
        public void Add(AVarDecl var)
        {
            Declaration tv = new Declaration(var, var.GetType(), var.GetName().Text);

            mNamedTypes.Add(var, tv);
            mLookupTable.Add(var.GetName().Text, tv);
        }
Beispiel #2
0
        public VariableShell(AVarDecl decl, RuntimeEnvironment env)
        {
            Name = decl.GetName().ToString();

            //if (decl.GetInit() != null && env.GetGlobalScope().ContainsExpression(decl.GetInit()))
            //{
            //    Value = env.GetGlobalScope().GetValueOfExpression(decl.GetInit());
            //}
        }
Beispiel #3
0
        public override void CaseAVarDecl(AVarDecl node)
        {
            // check: variable initializer is a InitExp
            PExp exp = node.GetInit();

            if (exp != null)
            {
                if (exp.GetType() != typeof(AInitExp))
                {
                    Error.Fatal(ErrorType.InvalidInitializer, node.GetName());
                }
            }
            base.CaseAVarDecl(node);
        }
Beispiel #4
0
 public Declaration Lookup(AVarDecl decl)
 {
     return(Lookup(decl.GetName().Text));
 }