Example #1
0
        private NsInfo ResolveAliasInModuleMember(DOM.Antlr.Alias alias, NsInfo memberNsInfo)
        {
            //Finding AliasDef
            var aliasDef = LookupAliasDef(alias);

            if (aliasDef == null)
            {
                //Report Error if alias is not defined
                _context.AddError(CompilerErrorFactory.AliasIsNotDefined(alias, memberNsInfo.ModuleMember.Module.FileName));
                return(null);
            }

            if (aliasDef.IsValueNode != alias.IsValueNode)
            {
                _context.AddError(aliasDef.IsValueNode
                    ? CompilerErrorFactory.CantUseValueAliasInTheBlock(alias, memberNsInfo.ModuleMember.Module.FileName)
                    : CompilerErrorFactory.CantUseBlockAliasAsValue(alias, memberNsInfo.ModuleMember.Module.FileName));
            }


            CheckAliasArguments(alias, aliasDef, memberNsInfo);

            return(ResolveAliasesInAliasDefinition(aliasDef));
        }
Example #2
0
        private void CheckDuplicateArguments(DOM.Antlr.Alias alias)
        {
            var dups = alias.Arguments.GroupBy(a => a.Name).Where(g => g.Count() > 1).SelectMany(g => g).ToList();

            dups.ForEach(a => _context.AddError(CompilerErrorFactory.DuplicateArgumentName(a, _currentModule.FileName)));
        }