private TypeCheckingArgumentsDefinition(IList<Argument> arguments, ICollection<string> keywords, string rest, string krest, int min, int max, bool restUneval, IList<ITypeChecker> mustMimic, ITypeChecker receiverMustMimic)
     : base(arguments, keywords, rest, krest, min, max, restUneval)
 {
     this.arguments = arguments;
     this.mustMimic = mustMimic;
     this.receiverMustMimic = receiverMustMimic;
 }
Ejemplo n.º 2
0
        public static T GetHelper <T>(AST root, ITypeChecker parent) where T : ITypeHelper, new()
        {
            var helper = new T();

            helper.Initialize(root, parent.Dispatch);
            return(helper);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns whether or not the symbol is a type, or if it references a module that has exported types.
        /// </summary>
        /// <remarks>
        /// Note: This was ported directly from the TypeScript implementation. The name of the function
        /// isn't exactly representative of what it is doing.
        /// </remarks>
        private static bool SymbolCanBeReferencedAtTypeLocation(ISymbol symbol, ITypeChecker typeChecker)
        {
            symbol = symbol.ExportSymbol ?? symbol;

            symbol = SkipAlias(symbol, typeChecker);

            if ((symbol.Flags & SymbolFlags.Type) != SymbolFlags.None)
            {
                return(true);
            }

            if ((symbol.Flags & SymbolFlags.Module) != SymbolFlags.None)
            {
                var exportedSymbols = typeChecker.GetExportsOfModule(symbol);
                foreach (var exportedSymbol in exportedSymbols)
                {
                    if (SymbolCanBeReferencedAtTypeLocation(exportedSymbol.Value, typeChecker))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
 public AnalyzedSourceFile(ITypeChecker checker, ISourceFile sourceFile, ISourceFile[] files, PathTable pathTable)
 {
     m_pathTable                = pathTable;
     DownStreamDependencies     = MaterializeBitSet(checker.GetFileDependentsOf(sourceFile), files);
     UpStreamDependencies       = MaterializeBitSet(checker.GetFileDependenciesOf(sourceFile), files);
     UpStreamModuleDependencies = checker.GetModuleDependenciesOf(sourceFile);
 }
Ejemplo n.º 5
0
        internal static CommonOperatorHelper GetCommonHelper(ITypeChecker parent)
        {
            var res = new CommonOperatorHelper();

            res.Initialize(GetAst(), parent.Dispatch);
            return(res);
        }
Ejemplo n.º 6
0
 public Program(string[] args)
 {
     config = GetConfig();
     ParseArgs(args);
     _lexParse         = new LexParser(new ASTBuilder(new ExpressionHelper()));
     _referenceHandler = new ReferenceHandler(new ReferenceHelper(), !_shouldThrowExceptions);
     _typeChecker      = new TypeChecker(new DeclarationHelper(),
                                         new NumberHelper(),
                                         new CommonOperatorHelper(),
                                         new TypeBooleanHelper(),
                                         new TypeSetHelper());
     _interpreter = new Interpreter(new GenericHelper(),
                                    new FunctionHelper(),
                                    new IntegerHelper(),
                                    new RealHelper(),
                                    new InterpBooleanHelper(),
                                    new InterpreterSetHelper(),
                                    new ElementHelper(),
                                    new StringHelper(),
                                    new GraphHelper(),
                                    !_shouldThrowExceptions);
     _outputGenerator = _output == OutputLanguage.DOT ? (IOutputGenerator) new DotGenerator() :
                        (IOutputGenerator) new GmlGenerator();
     _fileGenerator    = new FileGenerator(new FileHelper());
     _exceptionPrinter = new ExceptionPrinter();
     _fileReader       = new FileReader(new FileHelper());
 }
Ejemplo n.º 7
0
        /// <inheritdoc/>
        public void Initialize(ITypeChecker checker, TypeFlags flags, ISymbol symbol)
        {
            // Checker argument is used only by services.ts, but we're leaving it here for compatibility reasons.
            Flags = flags;

            // HINT: to simplify the code and design, this initialize method sets Id as well.
            Initialize(checker.GetNextTypeId(), flags, symbol);
        }
Ejemplo n.º 8
0
 private static void SetTypeCheckerDefaultValues(ITypeChecker typeChecker)
 {
     typeChecker.Dispatch(Arg.Any <RealLiteralExpression>(), Arg.Any <List <TypeNode> >()).Returns(new TypeNode(TypeEnum.Real, 1, 1));
     typeChecker.Dispatch(Arg.Any <IntegerLiteralExpression>(), Arg.Any <List <TypeNode> >()).Returns(new TypeNode(TypeEnum.Integer, 1, 1));
     typeChecker.Dispatch(Arg.Any <BooleanLiteralExpression>(), Arg.Any <List <TypeNode> >()).Returns(new TypeNode(TypeEnum.Boolean, 1, 1));
     typeChecker.Dispatch(Arg.Any <StringLiteralExpression>(), Arg.Any <List <TypeNode> >()).Returns(new TypeNode(TypeEnum.String, 1, 1));
     typeChecker.Dispatch(Arg.Any <SetExpression>(), Arg.Any <List <TypeNode> >()).Returns(new TypeNode(TypeEnum.Set, 1, 1));
     typeChecker.Dispatch(Arg.Any <GraphExpression>(), Arg.Any <List <TypeNode> >()).Returns(new TypeNode(TypeEnum.Graph, 1, 1));
 }
Ejemplo n.º 9
0
 public RenderContext(UIElementBase root, RenderInfo ri)
 {
     Writer               = ri.Writer;
     _root                = root;
     _dataModel           = ri.DataModel;
     _localizer           = ri.Localizer;
     _currentLocale       = ri.CurrentLocale;
     _typeChecker         = ri.TypeChecker;
     IsDebugConfiguration = ri.IsDebugConfiguration;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Computes semantic workspace from parsed workspace.
        /// </summary>
        /// <remarks>
        /// If this is not the first time specs in this workspace are type checked, the semantic model that resulted in a previous check is expected to be passed
        /// </remarks>
        public async Task <Workspace> ComputeSemanticWorkspaceAsync(PathTable pathTable, Workspace workspace, [CanBeNull] ISemanticModel originalSemanticModel = null, bool incrementalMode = false)
        {
            Contract.Requires(workspace != null);

            ITypeChecker checker = await MeasureCheckingDurationAsync(
                workspace,
                w => TypeCheckWorkspace(pathTable, workspace, m_workspaceConfiguration.MaxDegreeOfParallelismForTypeChecking, originalSemanticModel, incrementalMode));

            return(workspace.WithSemanticModel(new SemanticModel(checker), workspace.FilterWasApplied));
        }
Ejemplo n.º 11
0
        /// <nodoc/>
        public static T CreateType <T>(ITypeChecker checker, TypeFlags flags, ISymbol symbol) where T : IType, new()
        {
            // new() expression will use Activator.CreateInstance under the hood,
            // and this has significant performance impact.
            // Custom expression-tree-based solution preserves the same behavior but lacks performance issues.
            var type = FastActivator <T> .Create();

            type.Initialize(checker, flags, symbol);
            return(type);
        }
Ejemplo n.º 12
0
 public ThreeFiles(PathTable pathTable, ITypeChecker checker, [NotNull] ISourceFile spec1, [NotNull] ISourceFile spec2, [CanBeNull] ISourceFile spec3, ISourceFile[] files)
     : this()
 {
     Spec1 = new AnalyzedSourceFile(checker, spec1, files, pathTable);
     Spec2 = new AnalyzedSourceFile(checker, spec2, files, pathTable);
     if (spec3 != null)
     {
         Spec3 = new AnalyzedSourceFile(checker, spec3, files, pathTable);
     }
 }
Ejemplo n.º 13
0
        public static T GetHelper <T>(AST root) where T : ITypeHelper, new()
        {
            ITypeChecker parent = Substitute.For <ITypeChecker>();

            SetTypeCheckerDefaultValues(parent);

            var helper = new T();

            helper.Initialize(root, parent.Dispatch);
            return(helper);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Returns an enumeration of symbols from the specified types.
        /// </summary>
        public static IEnumerable <ISymbol> GetSymbolsFromTypes(ITypeChecker typeChecker, IEnumerable <IType> types)
        {
            HashSet <ISymbol> symbols = new HashSet <ISymbol>();

            foreach (var type in types)
            {
                symbols.AddRange(typeChecker.GetPropertiesOfType(type));
            }

            return(symbols);
        }
Ejemplo n.º 15
0
        private static FileContent GetPublicSurface(ISourceFile originalFile, ITypeChecker checker)
        {
            using (var writer = new ScriptWriter())
            {
                var printer = new PublicSurfacePrinter(writer, new SemanticModel(checker));

                FileContent publicContent;
                var         result = printer.TryPrintPublicSurface(originalFile, out publicContent);

                XAssert.IsTrue(result);
                return(publicContent);
            }
        }
Ejemplo n.º 16
0
        /// <nodoc/>
        public CompletionState(INode startingNode, TextDocumentPositionParams positionParameters, ITypeChecker typeChecker, Workspace workspace, PathTable pathTable)
        {
            Contract.Requires(startingNode != null);
            Contract.Requires(positionParameters != null);
            Contract.Requires(typeChecker != null);
            Contract.Requires(workspace != null);
            Contract.Requires(pathTable != null);

            StartingNode       = startingNode;
            PositionParameters = positionParameters;
            TypeChecker        = typeChecker;
            Workspace          = workspace;
            PathTable          = pathTable;
        }
Ejemplo n.º 17
0
        public static List <ISourceFile> Analyze(
            out ITypeChecker checker,
            ParsingOptions parsingOptions = null,
            bool implicitReferenceModule  = false, params string[] codes)
        {
            var testFiles = GenerateTestFileNames("dsc", codes);

            return(Analyze(
                       out checker,
                       useCachedVersion: false,
                       parsingOptions: parsingOptions,
                       implicitReferenceModule: implicitReferenceModule,
                       tsInputFiles: testFiles));
        }
Ejemplo n.º 18
0
        /// <nodoc />
        public static string GetDeclaredName(ITypeChecker typeChecker, ISymbol symbol, INode location)
        {
            // If this is an export or import specifier it could have been renamed using the 'as' syntax.
            // If so we want to search for whatever is under the cursor.
            if (IsImportOrExportSpecifierName(location))
            {
                return(location.GetText());
            }

            // Try to get the local symbol if we're dealing with an 'export default'
            // since that symbol has the "true" name.
            var localExportDefaultSymbol = GetLocalSymbolForExportDefault(symbol);

            return(typeChecker.SymbolToString(localExportDefaultSymbol ?? symbol));
        }
Ejemplo n.º 19
0
        private static IEnumerable <IType> GetAllTypesIfUnion(IType type, ITypeChecker typeChecker, HashSet <IType> types)
        {
            if ((type.Flags & TypeFlags.Union) != TypeFlags.None)
            {
                foreach (var unionType in type.Cast <IUnionType>().Types)
                {
                    types.AddRange(GetAllTypesIfUnion(unionType, typeChecker, types));
                }
            }
            else
            {
                types.Add(type);
            }

            return(types);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Analyze all source files.
        /// </summary>
        public static List <ISourceFile> Analyze(
            out ITypeChecker checker,
            bool useCachedVersion         = false,
            ParsingOptions parsingOptions = null, bool implicitReferenceModule = false, params TestFile[] tsInputFiles)
        {
            LazyInitializer.EnsureInitialized(ref s_libFile, () => File.ReadAllText("Libs/lib.core.d.ts"));

            // Need to parse lib.d.ts file each time, because checker mutates ISourcefile
            // var parsedLibFile = s_parsedSourceFile;//threadLocalSource.Value;
            var parsedLibFile = LazyInitializer.EnsureInitialized(ref s_parsedLibFile, ParseLib);

            if (!useCachedVersion)
            {
                // See comment in StringBasedCheckerTests.CheckAnalysisOrderIssue for more details!
                parsedLibFile = ParsingHelper.ParsePotentiallyBrokenSourceFile(s_libFile, "lib.core.d.ts", parsingOptions);
            }

            var sourceFiles =
                tsInputFiles.Select(
                    tsInputFile =>
                    ParsingHelper.ParsePotentiallyBrokenSourceFile(tsInputFile.Content, tsInputFile.UnitName, parsingOptions)).ToList();

            var sourceFilesWithLib = new List <ISourceFile>(sourceFiles)
            {
                parsedLibFile
            };

            // Need to parse lib.d.ts file every time, because checker mutates it and this could lead to failure
            // when multiple checking processes are running in parallel.
            // var parsedLibFile = ParseOrDeserialize(s_libFile);// ParsingHelper.ParseSourceFile(s_libFile, "lib.d.ts");
            ModuleName?fakeModule = new ModuleName("fakeModule", implicitReferenceModule);
            var        host       = new TypeCheckerHostFake(fakeModule, sourceFilesWithLib.ToArray());

            checker = Checker.CreateTypeChecker(host, true, degreeOfParallelism: 1);

            return(sourceFiles);
        }
Ejemplo n.º 21
0
        public static IType GetTypeOfFirstVariableDeclarationOrDefault(this IVariableStatement variableStatement, ITypeChecker typeChecker)
        {
            var firstDeclaration = GetFirstDeclarationOrDefault(variableStatement);

            if (firstDeclaration == null)
            {
                return(null);
            }

            return(typeChecker.GetTypeAtLocation(firstDeclaration));
        }
Ejemplo n.º 22
0
 /// <nodoc/>
 public GotoDefinitionHelper(ITypeChecker typeChecker)
 {
     TypeChecker = typeChecker;
 }
Ejemplo n.º 23
0
 public Or(ITypeChecker first, ITypeChecker second)
 {
     this.first  = first;
     this.second = second;
 }
Ejemplo n.º 24
0
        /// <nodoc/>
        public SemanticModel(ITypeChecker typeChecker)
        {
            Contract.Requires(typeChecker != null);

            TypeChecker = typeChecker;
        }
Ejemplo n.º 25
0
 public Builder ReceiverMustMimic(IokeObject mimic)
 {
     this.receiverMustMimic = mimic;
     return(this);
 }
Ejemplo n.º 26
0
 public Or(ITypeChecker first, ITypeChecker second)
 {
     this.first = first;
     this.second = second;
 }
 public Builder ReceiverMustMimic(IokeObject mimic)
 {
     this.receiverMustMimic = mimic;
     return this;
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Given a <paramref name="type"/>, returns the symbols that can be accessed relative to <paramref name="node"/>
        /// </summary>
        /// <param name="type">The type whose symbols will be tested for valid property access.</param>
        /// <param name="node">The node in which the type's symbols will be accessed.</param>
        /// <param name="typeChecker">Reference to the type checker.</param>
        /// <remarks>
        /// Ported from TypeScript version.
        /// </remarks>
        private static IEnumerable <ISymbol> AddTypeProperties(IType type, INode node, ITypeChecker typeChecker)
        {
            var typeSymbols = typeChecker.GetPropertiesOfType(type);

            if (typeSymbols != null)
            {
                return(typeSymbols.Where(typeSymbol => typeSymbol.Name != null && typeChecker.IsValidPropertyAccess(node.Parent /*HINT: IPropertyAccessExpression*/, typeSymbol.Name)));
            }

            return(Enumerable.Empty <ISymbol>());
        }
Ejemplo n.º 29
0
 /// <nodoc/>
 public static TObjectType CreateObjectType <TObjectType>(ITypeChecker checker, TypeFlags kind, ISymbol symbol) where TObjectType : IObjectType, new()
 {
     return(CreateType <TObjectType>(checker, kind, symbol));
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Creates an array of symbols for a node whose parent is either a qualified name or a property access expression.
        /// </summary>
        /// <remarks>
        /// This was ported from the TypeScript version of the language server.
        /// </remarks>
        public static IEnumerable <ISymbol> GetTypeScriptMemberSymbols(INode node, ITypeChecker typeChecker)
        {
            var symbols = new HashSet <ISymbol>();

            // If we are part of a type (say creating an interface and and assigning a type to a property)
            // interface Test {
            //    myField: ImportedModuleQualifiedName.<Type>
            // };
            // when we want to filter the symbols ot the types
            bool isTypeLocation = node.Parent != null && IsPartOfTypeNode(node.Parent);

            // This case handles when you are accessing a property out of
            // an import statement.
            // const foo = importFrom("").<Type or Value>.
            // NOTE: We don't really hit this case in our completion implementation
            // as it is already handled as part of the property access expression completion code.
            bool isRhsOfImportDeclaration = IsInRightSideOfImport(node);

            if (IsEntityNode(node))
            {
                var symbol = typeChecker.GetSymbolAtLocation(node);

                if (symbol != null)
                {
                    symbol = SkipAlias(symbol, typeChecker);

                    if ((symbol.Flags & (SymbolFlags.Enum | SymbolFlags.Module)) != SymbolFlags.None)
                    {
                        var exportedSymbols = typeChecker.GetExportsOfModule(symbol);
                        foreach (var exportedSymbol in exportedSymbols)
                        {
                            if (isRhsOfImportDeclaration)
                            {
                                if (typeChecker.IsValidPropertyAccess(node.Parent, exportedSymbol.Value.Name) ||
                                    SymbolCanBeReferencedAtTypeLocation(exportedSymbol.Value, typeChecker))
                                {
                                    symbols.Add(exportedSymbol.Value);
                                }
                            }
                            else if (isTypeLocation)
                            {
                                if (SymbolCanBeReferencedAtTypeLocation(exportedSymbol.Value, typeChecker))
                                {
                                    symbols.Add(exportedSymbol.Value);
                                }
                            }
                            else
                            {
                                if (typeChecker.IsValidPropertyAccess(node.Parent, exportedSymbol.Value.Name))
                                {
                                    symbols.Add(exportedSymbol.Value);
                                }
                            }
                        }

                        // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
                        if (!isTypeLocation &&
                            symbol.Declarations != null &&
                            symbol.Declarations.Any(d => d.Kind != SyntaxKind.SourceFile && d.Kind != SyntaxKind.ModuleDeclaration && d.Kind != SyntaxKind.EnumDeclaration))
                        {
                            symbols.AddRange(AddTypeProperties(typeChecker.GetTypeOfSymbolAtLocation(symbol, node), node, typeChecker));
                        }
                    }
                }
            }

            // If we are not in a type location, and not handling module exports, then add the symbols for the
            // type of the "left side" (i.e. the "QualifiedName" in  "QualifiedName."Access") that can be accessed
            // through QualifiedName (i.e. if the user types QualifiedName.<Completion happens here> what symbols
            // have valid property access from there).
            if (!isTypeLocation)
            {
                symbols.AddRange(AddTypeProperties(typeChecker.GetTypeAtLocation(node), node, typeChecker));
            }

            return(symbols);
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Creates a unique set of strings representing the string literal types present in the given type (and all unions if present)
        /// </summary>
        private static IEnumerable <string> AddStringLiteralSymbolsFromType(IType type, ITypeChecker typeChecker)
        {
            var completionStrings = GetAllTypesIfUnion(type, typeChecker).
                                    Where(t => ((t.Flags & TypeFlags.StringLiteral) != TypeFlags.None)).
                                    Select(t => t.Cast <IStringLiteralType>().Text).Distinct();

            return(completionStrings);
        }
        /// <summary>
        /// Attempts to add a file to a source file list. The conditions that must be met are specified in the
        /// array of <paramref name="configurations"/>
        /// </summary>
        public static bool TryAddSourceFileToSourceFile(ITypeChecker checker, ISourceFile sourceFile, string sourceFileName, Workspace workspace, PathTable pathTable, AddSourceFileConfiguration[] configurations)
        {
            INode sourcesNode = null;

            try
            {
                // Use single or default to ensure that we only match a single sources property.
                // If we find more than one, we don't know which source file list to augment.
                // SingleOrDefault throws an InvalidOperationException if it finds more than one element
                // and returns default<T> if there are 0.
                sourcesNode = NodeWalker.TraverseBreadthFirstAndSelf(sourceFile).SingleOrDefault(node =>
                {
                    // We expect that the property for the source file list to be in an object literal
                    // and hence be a property assignment inside that object literal.
                    // The statement will look something like:
                    // const result = TargetType.build( { sources: [f`foo.cpp`] } );
                    if (node.Kind == SyntaxKind.PropertyAssignment &&
                        node.Cast <IPropertyAssignment>().Name.Kind == SyntaxKind.Identifier &&
                        node.Parent?.Kind == SyntaxKind.ObjectLiteralExpression)
                    {
                        var propertyName = node.Cast <IPropertyAssignment>().Name.Text;

                        // Now check the configurations to see if the any match as there
                        // can be different names (such as "references", "sources", etc.) as
                        // well as different functions, etc.

                        AddSourceFileConfiguration singleConfiguration = null;

                        try
                        {
                            // We use single or default to ensure that only one matching configuration is found.
                            // SingleOrDefault throws an InvalidOperationException if it finds more than one element
                            // and returns default<T> if there are 0.
                            singleConfiguration = configurations.SingleOrDefault(configuration =>
                            {
                                // Check to see if this is the correct property name.
                                if (propertyName != configuration.PropertyName)
                                {
                                    return(false);
                                }

                                // Now we will try to find the matching call expression (function name)
                                // The reason we are going to walk parent nodes is that we allow
                                // a "merge" or "override" to be nested inside the function call
                                // as long as the argument type and the expected module the type exists
                                // in match the configuration parameter.
                                var nodeParent = node.Parent.Parent;
                                while (nodeParent != null)
                                {
                                    if (nodeParent.Kind != SyntaxKind.CallExpression)
                                    {
                                        return(false);
                                    }

                                    var callExpression    = nodeParent.Cast <ICallExpression>();
                                    string calledFunction = string.Empty;

                                    // Depending on the module the function is being called from it may be a straight
                                    // call (such as "build()") or it could be an accessor if it was imported
                                    // from another module (such as "StaticLibrary.build()").
                                    if (callExpression.Expression?.Kind == SyntaxKind.PropertyAccessExpression)
                                    {
                                        var propertyAccessExpression = callExpression.Expression.Cast <IPropertyAccessExpression>();
                                        calledFunction = propertyAccessExpression.Name?.Text;
                                    }
                                    else if (callExpression.Expression?.Kind == SyntaxKind.Identifier)
                                    {
                                        calledFunction = callExpression.Expression.Cast <Identifier>().Text;
                                    }
                                    else
                                    {
                                        return(false);
                                    }

                                    // If the called function matches, and has the minimum number of parameters to contain our argument type
                                    // then verify it matches the type name given in the configuration.
                                    if (calledFunction == configuration.FunctionName && callExpression.Arguments?.Length > configuration.ArgumentPosition)
                                    {
                                        var type = checker.GetContextualType(callExpression.Arguments[configuration.ArgumentPosition]);
                                        if (type != null && IsTypeCorrectForAddSourceFileConfiguration(type, workspace, pathTable, configuration))
                                        {
                                            return(true);
                                        }
                                    }
                                    else if (DScriptUtilities.IsMergeOrOverrideCallExpression(callExpression))
                                    {
                                        // In the case of a merge or override function, we make sure it is the proper type and keep moving
                                        // up the parent chain to find the function call.
                                        var type = checker.GetTypeAtLocation(callExpression.TypeArguments[0]);
                                        if (type != null && IsTypeCorrectForAddSourceFileConfiguration(type, workspace, pathTable, configuration))
                                        {
                                            nodeParent = nodeParent.Parent;
                                            continue;
                                        }
                                    }

                                    return(false);
                                }

                                return(false);
                            });
                        }
                        catch (InvalidOperationException)
                        {
                            return(false);
                        }

                        return(singleConfiguration != null);
                    }

                    return(false);
                });
            }
            catch (InvalidOperationException)
            {
            }

            if (sourcesNode != null)
            {
                var propertyAssignment = sourcesNode.Cast <IPropertyAssignment>();
                // Will support array literals for now.
                var initializer = propertyAssignment.Initializer.As <IArrayLiteralExpression>();
                if (initializer == null)
                {
                    // TODO: potentially we could have a glob call here, and what we can do this:
                    // [...(oldExpression), newFile]
                    return(false);
                }

                var alreadyPresent = initializer.Elements.Any(element =>
                {
                    return(element.Kind == SyntaxKind.TaggedTemplateExpression &&
                           element.Cast <ITaggedTemplateExpression>().Template?.Text.Equals(sourceFileName, StringComparison.OrdinalIgnoreCase) == true);
                });

                if (!alreadyPresent)
                {
                    initializer.Elements.Add(new TaggedTemplateExpression("f", sourceFileName));
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 33
0
 protected PropertyValidationAttribute(ITypeChecker validationType)
 {
     if (validationType == null)
     throw new ArgumentNullException("validationType");
       this.ValidationType = validationType;
 }
Ejemplo n.º 34
0
 private TypeCheckingArgumentsDefinition(IList <Argument> arguments, ICollection <string> keywords, string rest, string krest, int min, int max, bool restUneval, IList <ITypeChecker> mustMimic, ITypeChecker receiverMustMimic) : base(arguments, keywords, rest, krest, min, max, restUneval)
 {
     this.arguments         = arguments;
     this.mustMimic         = mustMimic;
     this.receiverMustMimic = receiverMustMimic;
 }