Example #1
0
        public IPhpScriptTypeSymbol ResolveFile(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }

            // normalize path
            path = FileUtilities.NormalizeRelativePath(path, null, Compilation.Options.BaseDirectory);

            // absolute path
            if (PathUtilities.IsAbsolute(path))
            {
                path = PhpFileUtilities.GetRelativePath(path, Compilation.Options.BaseDirectory);
            }

            // ./ handled by context semantics

            // ../ handled by context semantics

            // TODO: lookup include paths
            // TODO: calling script directory

            // cwd
            return(_table.GetFile(path));
        }
Example #2
0
        /// <summary>
        /// Gets enumeration of user declared routines (global code, functions, methods and lambdas) in the specified file
        /// identified by its syntax tree.
        /// </summary>
        public IEnumerable <IPhpRoutineSymbol> GetUserDeclaredRoutinesInFile(PhpSyntaxTree syntaxTree)
        {
            string relativePath = PhpFileUtilities.GetRelativePath(
                PhpFileUtilities.NormalizeSlashes(syntaxTree.Source.FilePath),
                PhpFileUtilities.NormalizeSlashes(_options.BaseDirectory));
            var fileSymbol = _tables.GetFile(relativePath);

            return(fileSymbol?.GetAllRoutines() ?? ImmutableArray <SourceRoutineSymbol> .Empty);
        }
Example #3
0
        public IPhpScriptTypeSymbol ResolveFile(string relativePathNormalized)
        {
            // {relativePathNormalized} is relative to BaseDirectory
            // slashes are normalized '/'

            if (string.IsNullOrEmpty(relativePathNormalized))
            {
                return(null);
            }

            // ./ handled by context semantics

            // ../ handled by context semantics

            // TODO: lookup include paths
            // TODO: calling script directory

            // cwd
            return(_table.GetFile(relativePathNormalized));
        }
        public SourceFileSymbol GetFile(string path)
        {
            // normalize path
            path = FileUtilities.NormalizeRelativePath(path, null, _table.Compilation.Options.BaseDirectory);

            // absolute path
            if (PathUtilities.IsAbsolute(path))
            {
                path = PhpFileUtilities.GetRelativePath(path, _table.Compilation.Options.BaseDirectory);
            }

            // ./ handled by context semantics

            // ../ handled by context semantics

            // TODO: lookup include paths
            // TODO: calling script directory

            // cwd
            return(_table.GetFile(path));
        }