Esempio n. 1
0
        public override void Validate(Environment env)
        {
            if (ClassNode != null)
            {
                if (!IsExtern)
                {
                    env.Classes.Add(ClassNode);
                }

                ClassNode.Validate(env);
                return;
            }

            env.Scopes.Types.Bind(Name, TypeNode.EvalType(env));
        }
Esempio n. 2
0
        public override void Validate(Environment env)
        {
            Expr.Validate(env);

            DerivedType = Expr.Type;

            if (TypeAnnotation != null)
            {
                DerivedType = TypeAnnotation.EvalType(env);
                Expr.AssertType(DerivedType);
            }

            env.Scopes.Values.Bind(Name, new VariableBinding()
            {
                Name    = Name,
                Type    = DerivedType,
                IsConst = IsConst,
            });
        }