コード例 #1
0
        private GlobalScope CreateGlobalScope(Vector <Class> classes, Vector <Function> functions)
        {
            var globals = new GlobalScope();

            foreach (var @class in classes)
            {
                if (!globals.TryIncludeUniqueBinding(@class.Name.Identifier, ConstructorType(@class.Name)))
                {
                    LogError(CompilerError.DuplicateIdentifier(@class.Position, @class));
                }
            }

            foreach (var function in functions)
            {
                if (!globals.TryIncludeUniqueBinding(function.Name.Identifier, typeRegistry.DeclaredType(function)))
                {
                    LogError(CompilerError.DuplicateIdentifier(function.Position, function));
                }
            }

            return(globals);
        }
コード例 #2
0
ファイル: TypeChecker.cs プロジェクト: klabranche/rook
        private GlobalScope CreateGlobalScope(Vector<Class> classes, Vector<Function> functions)
        {
            var globals = new GlobalScope();

            foreach (var @class in classes)
                if (!globals.TryIncludeUniqueBinding(@class.Name.Identifier, ConstructorType(@class.Name)))
                    LogError(CompilerError.DuplicateIdentifier(@class.Position, @class));

            foreach (var function in functions)
                if (!globals.TryIncludeUniqueBinding(function.Name.Identifier, typeRegistry.DeclaredType(function)))
                    LogError(CompilerError.DuplicateIdentifier(function.Position, function));

            return globals;
        }