示例#1
0
        ImportStatement ImportDeclaration(IBlockNode scope)
        {
            // In DMD 2.060, the static keyword must be written exactly before the import token
            bool isStatic = t!= null && t.Kind == Static;
            bool isPublic = Modifier.ContainsAttribute(DeclarationAttributes, Public) ||
                            Modifier.ContainsAttribute(BlockAttributes,Public);

            Expect(Import);

            var importStatement = new ImportStatement { Attributes = GetCurrentAttributeSet_Array(), Location=t.Location, IsStatic = isStatic, IsPublic = isPublic };

            DeclarationAttributes.Clear();

            var imp = _Import();

            while (laKind == Comma)
            {
                importStatement.Imports.Add(imp);

                Step();

                imp = _Import();
            }

            if (laKind == Colon)
            {
                Step();
                importStatement.ImportBindList = ImportBindings(imp);
            }
            else
                importStatement.Imports.Add(imp); // Don't forget to add the last import

            Expect(Semicolon);

            CheckForPostSemicolonComment();

            importStatement.EndLocation = t.EndLocation;

            // Prepare for resolving external items
            importStatement.CreatePseudoAliases(scope);

            return importStatement;
        }
示例#2
0
        ImportStatement ImportDeclaration()
        {
            Expect(Import);

            var importStatement = new ImportStatement { Location=t.Location };

            ApplyAttributes(importStatement);

            var imp = _Import();

            while (laKind == Comma)
            {
                importStatement.Imports.Add(imp);

                Step();

                imp = _Import();
            }

            if (laKind == Colon)
            {
                Step();
                importStatement.ImportBinding = ImportBindings(imp);
            }
            else
                importStatement.Imports.Add(imp); // Don't forget to add the last import

            if (Expect(Semicolon))
                LastParsedObject = null;

            CheckForPostSemicolonComment();

            importStatement.EndLocation = t.EndLocation;

            // Prepare for resolving external items
            importStatement.CreatePseudoAliases();

            return importStatement;
        }