Beispiel #1
0
        public ClassDefinition(
            Token classToken,
            Token nameToken,
            IList <Token> subclassTokens,
            IList <string> subclassNames,
            Node owner,
            FileScope fileScope,
            ModifierCollection modifiers,
            AnnotationCollection annotations)
            : base(classToken, owner, fileScope, modifiers)
        {
            this.ClassID = ClassDefinition.classIdAlloc++;

            this.NameToken             = nameToken;
            this.BaseClassTokens       = subclassTokens.ToArray();
            this.BaseClassDeclarations = subclassNames.ToArray();
            this.annotations           = annotations;

            if (this.Modifiers.HasPrivate)
            {
                throw new ParserException(this.Modifiers.PrivateToken, "Private classes are not supported yet.");
            }
            if (this.Modifiers.HasProtected)
            {
                throw new ParserException(this.Modifiers.ProtectedToken, "Protected classes are not supported yet.");
            }
        }
 public ConstStatement(
     Token constToken,
     Token nameToken,
     TopLevelConstruct owner,
     LibraryMetadata library,
     FileScope fileScope,
     AnnotationCollection annotations)
     : base(constToken, owner, fileScope)
 {
     this.Library     = library;
     this.NameToken   = nameToken;
     this.Name        = nameToken.Value;
     this.annotations = annotations;
 }
Beispiel #3
0
 public EnumDefinition(
     Token enumToken,
     Token nameToken,
     TopLevelConstruct owner,
     LibraryMetadata library,
     FileScope fileScope,
     AnnotationCollection annotations)
     : base(enumToken, owner, fileScope)
 {
     this.Library     = library;
     this.NameToken   = nameToken;
     this.Name        = nameToken.Value;
     this.annotations = annotations;
 }
 public FunctionDefinition(
     Token functionToken,
     LibraryMetadata library,
     TopLevelConstruct nullableOwner,
     bool isStaticMethod,
     Token nameToken,
     AnnotationCollection annotations,
     FileScope fileScope)
     : base(functionToken, nullableOwner, fileScope)
 {
     this.Library        = library;
     this.IsStaticMethod = isStaticMethod;
     this.NameToken      = nameToken;
     this.Annotations    = annotations;
     this.MemberID       = -1;
 }
Beispiel #5
0
 public FunctionDefinition(
     Token functionToken,
     AType returnType,
     TopLevelEntity nullableOwner,
     Token nameToken,
     ModifierCollection modifiers,
     AnnotationCollection annotations,
     FileScope fileScope)
     : base(functionToken, nullableOwner, fileScope, modifiers)
 {
     this.ReturnType         = returnType;
     this.NameToken          = nameToken;
     this.Annotations        = annotations;
     this.MemberID           = -1;
     this.Lambdas            = new List <Lambda>();
     this.ArgumentNameLookup = new HashSet <string>();
 }
Beispiel #6
0
        public EnumDefinition(
            Token enumToken,
            Token nameToken,
            Node owner,
            FileScope fileScope,
            ModifierCollection modifiers,
            AnnotationCollection annotations)
            : base(enumToken, owner, fileScope, modifiers)
        {
            this.NameToken   = nameToken;
            this.Name        = nameToken.Value;
            this.annotations = annotations;

            if (modifiers.AccessModifierType == AccessModifierType.PRIVATE ||
                modifiers.AccessModifierType == AccessModifierType.PROTECTED)
            {
                // TODO: this will not be true when you can start nesting these into classes.
                throw new ParserException(modifiers.PrivateToken ?? modifiers.ProtectedToken, "This is not a valid access modifier for enums.");
            }
        }
Beispiel #7
0
 public TopLevelConstruct(Token firstToken, TopLevelConstruct owner, FileScope fileScope)
     : base(firstToken, owner)
 {
     this.FileScope = fileScope;
 }
Beispiel #8
0
 public TopLevelEntity(Token firstToken, Node owner, FileScope fileScope, ModifierCollection modifiers)
     : base(firstToken, owner)
 {
     this.fileScopeOverride = fileScope;
     this.Modifiers         = modifiers;
 }
 public ImportStatement(Token importToken, string path, LibraryMetadata callingLibrary, FileScope fileScope)
     : base(importToken, null, fileScope)
 {
     this.Library    = callingLibrary;
     this.ImportPath = path;
     fileScope.Imports.Add(this);
 }
Beispiel #10
0
 public PropertyDefinition(Token firstToken, Node owner, FileScope file, ModifierCollection modifiers)
     : base(firstToken, owner, file, modifiers)
 {
     this.ArgumentNameLookup = new HashSet <string>();
 }