/// <nodoc /> public InterfaceDeclaration( SymbolAtom name, IReadOnlyList <TypeParameter> typeParameters, IReadOnlyList <NamedTypeReference> extendedTypes, IReadOnlyList <Expression> decorators, ObjectType body, DeclarationFlags modifier, LineInfo location) : base(modifier, location) { Contract.Requires(name.IsValid); Contract.Requires(typeParameters != null); Contract.RequiresForAll(typeParameters, p => p != null); Contract.Requires(extendedTypes != null); Contract.RequiresForAll(extendedTypes, t => t != null); Contract.Requires(decorators != null); Contract.RequiresForAll(decorators, d => d != null); Contract.Requires(body != null); Name = name; TypeParameters = typeParameters; ExtendedTypes = extendedTypes; Body = body; Decorators = decorators; }
/// <nodoc /> public FunctionDeclaration( [NotNull] IReadOnlyList <SymbolAtom> @namespace, SymbolAtom name, [NotNull] CallSignature callSignature, [NotNull] Statement body, int captures, int locals, DeclarationFlags modifier, LineInfo location, StringTable stringTable) : base(modifier, location) { Contract.Requires(name.IsValid); Contract.Requires(callSignature != null); Contract.Requires(body != null); Contract.Requires(captures >= 0); Contract.Requires(locals >= 0); Name = name; CallSignature = callSignature; Body = body; Captures = captures; Locals = locals; var fullName = @namespace.ToList(); fullName.Add(name); Statistic = new FunctionStatistic(fullName, callSignature, stringTable); }
public static string ToDisplayModifier(this DeclarationFlags flags) { string result = string.Empty; if ((flags & DeclarationFlags.Public) == DeclarationFlags.Public) { result += "public"; } else if ((flags & DeclarationFlags.Export) == DeclarationFlags.Export) { result += "internal"; } if ((flags & DeclarationFlags.Obsolete) == DeclarationFlags.Obsolete) { if (string.IsNullOrEmpty(result)) { result += "obsolete"; } else { result += ".obsolete"; } } return(result); }
protected Declaration(string name, bool merge, string parentPropertyToAddTo) { this.name = name; if (merge) { this.flags |= DeclarationFlags.Merge; } this.parentPropertyToAddTo = parentPropertyToAddTo; }
public static string GetModifierAsSuffix(this DeclarationFlags flags) { var modifier = flags.ToDisplayModifier(); if (!string.IsNullOrEmpty(modifier)) { return(string.Concat(".", modifier)); } return(modifier); }
/// <nodoc /> public EnumMemberDeclaration(SymbolAtom name, Expression expression, DeclarationFlags modifier, IReadOnlyList <Expression> decorators, LineInfo location) : base(modifier, location) { Contract.Requires(name.IsValid); Contract.Requires(decorators != null); Contract.RequiresForAll(decorators, d => d != null); Name = name; Expression = expression; Decorators = decorators; }
/// <nodoc /> protected ImportOrExportDeclaration( ImportOrExportClause importOrExportClause, Expression pathSpecifier, DeclarationFlags modifier, LineInfo location) : base(modifier, location) { Contract.Requires(importOrExportClause != null); ImportOrExportClause = importOrExportClause; PathSpecifier = pathSpecifier; }
/// <nodoc /> public VarDeclaration( SymbolAtom name, Type type, Expression initializer, DeclarationFlags modifier, LineInfo location) : base(modifier, location) { Contract.Requires(name.IsValid); Name = name; Type = type; Initializer = initializer; }
/// <nodoc /> public EnumDeclaration( SymbolAtom name, IReadOnlyList <EnumMemberDeclaration> enumMemberDeclarations, IReadOnlyList <Expression> decorators, DeclarationFlags modifier, LineInfo location) : base(modifier, location) { Contract.Requires(name.IsValid); Contract.Requires(enumMemberDeclarations != null); Contract.RequiresForAll(enumMemberDeclarations, e => e != null); Contract.Requires(decorators != null); Contract.RequiresForAll(decorators, e => e != null); Name = name; EnumMemberDeclarations = enumMemberDeclarations; Decorators = decorators; }
private void AnalyzeInterfaceMembers(NodeArray <ITypeElement> elements, bool registerPropertyNames) { foreach (var interfaceMember in elements.AsStructEnumerable()) { var property = interfaceMember.As <IPropertySignature>(); if (property != null) { if (registerPropertyNames) { // Registering property name bool isOptional = property.QuestionToken.HasValue; DeclarationFlags modifiers = GetModifiers(property, isOptional); AddOrCreateDeclarationSymbol(SymbolKind.InterfaceMemberDeclaration, property.Name.Text, modifiers); } // Registering property type AnalyzeTypeReference(property.Type); AnalyzeDecorators(interfaceMember); } var method = interfaceMember.As <IMethodSignature>(); if (method != null) { if (registerPropertyNames) { // Registering method name var typeElement = method.TryCast <ITypeElement>(); if (typeElement != null) { bool isOptional = typeElement.QuestionToken.HasValue; DeclarationFlags modifiers = GetModifiers(property, isOptional); AddOrCreateDeclarationSymbol(SymbolKind.InterfaceMemberDeclaration, method.Name.Text, modifiers); } } AnalyzeTypeParameters(method.TypeParameters); AnalyzeDecorators(method); } } }
/// <nodoc /> public TypeAliasDeclaration(SymbolAtom name, IReadOnlyList <TypeParameter> typeParameters, Type type, DeclarationFlags modifier, LineInfo location) : base(modifier, location) { Contract.Requires(name.IsValid); Contract.Requires(type != null); Contract.Requires(typeParameters != null); Name = name; Type = type; TypeParameters = typeParameters; }
/// <nodoc /> public ModuleDeclaration(SymbolAtom name, IReadOnlyList <Declaration> declarations, DeclarationFlags modifier, LineInfo location) : base(modifier, location) { Contract.Requires(name.IsValid); Contract.Requires(declarations != null); Contract.RequiresForAll(declarations, d => d != null); Name = name; Declarations = declarations; }
/// <nodoc/> public ImportDeclaration(ImportOrExportClause importOrExportClause, Expression pathSpecifier, Expression qualifier, IReadOnlyList <Expression> decorators, DeclarationFlags modifier, LineInfo location) : base(importOrExportClause, pathSpecifier, modifier, location) { Contract.Requires(importOrExportClause != null); Contract.Requires(pathSpecifier != null); Contract.Requires(decorators != null); Contract.RequiresForAll(decorators, d => d != null); Qualifier = qualifier; Decorators = decorators; }
private void AnalyzeTopLevelVariableDeclarations(IVariableDeclarationList source, DeclarationFlags modifiers, int idx) { foreach (var declaration in source.Declarations.AsStructEnumerable()) { if (modifiers == DeclarationFlags.None) { AddOrCreateReferencedSymbol(SymbolKind.VariableDeclaration, declaration.Name.GetText(), modifiers); } else { AddOrCreateDeclarationSymbol(SymbolKind.VariableDeclaration, declaration.Name.GetText(), modifiers); } if (declaration.Initializer != null) { AnalyzeExpression(declaration.Initializer, idx, saveIdentifierOnStack: false); } AnalyzeTypeReference(declaration.Type); } }
/// <nodoc /> protected Declaration(DeserializationContext context, LineInfo location) : base(location) { Modifier = ReadModifier(context.Reader); }
/// <nodoc /> protected Declaration(DeclarationFlags modifier, LineInfo location) : base(location) { Modifier = modifier; }