public DataType LoadFile(string path)
{
path = FileSystem.GetFullPath(path);
if (!FileSystem.FileExists(path))
{
return null;
}
ModuleType module = GetCachedModule(path);
if (module != null)
{
return module;
}
// detect circular import
if (inImportStack(path))
{
return null;
}
// set new CWD and save the old one on stack
string oldcwd = cwd;
setCWD(FileSystem.GetDirectoryName(path));
pushImportStack(path);
DataType type = parseAndResolve(path);
popImportStack(path);
// restore old CWD
setCWD(oldcwd);
return type;
}