private void CheckSemanticExtern(MoveInfo treeInfo, ScriptInfo scriptInfo, CheckingInfo checkingInfo) { _path = _pathOrUsing; #region Finding using UsingInfo usingInfoTry = scriptInfo.FindUsing(_path); if (usingInfoTry != null) { if (usingInfoTry.SF != scriptInfo.SF && usingInfoTry.Access != MemberAccess.Public) { scriptInfo.SF.Errors.Add(new SemanticError("Could not access using '" + usingInfoTry.SF.SFPath + "::" + usingInfoTry.Name + "'", treeInfo.GetErrorInfo(_pathElem))); return; } _path = usingInfoTry.SFPath; UsingName usingName = UsingName.ConvertToMe(this, _pathElem, usingInfoTry); scriptInfo.References.Add(new UsingRefInfo(scriptInfo.SF, usingInfoTry, usingName.CharIndex, usingName.CharLength, checkingInfo.SC.SourceCode.Substring(usingName.CharIndex, usingName.CharLength))); } #endregion ScriptFile sf = scriptInfo.SF.Manager.GetSF(_path); if (sf == null) { scriptInfo.SF.Errors.Add( new SemanticError("Could not find file '" + _path + "'", treeInfo.GetErrorInfo(treeInfo.Current))); return; } else if (sf.SI == null) { scriptInfo.SF.Errors.Add( new WarningError("Could not read file '" + _path + "'", treeInfo.GetErrorInfo(treeInfo.Current))); return; } _funcInfo = sf.SI.FindLocalFunc(_name); if (_funcInfo == null) { scriptInfo.SF.Errors.Add( new SemanticError("Unknown function '" + _path + "::" + _name + "'", treeInfo.GetErrorInfo(treeInfo.Current))); return; } // member is private if (sf != scriptInfo.SF && _funcInfo.Access != MemberAccess.Public) { scriptInfo.SF.Errors.Add( new SemanticError("Cannot access function '" + _path + "::" + _name + "'", treeInfo.GetErrorInfo(treeInfo.Current))); } }
private void CheckSemanticExtern(MoveInfo treeInfo, ScriptInfo scriptInfo, CheckingInfo checkingInfo) { _path = _pathOrUsing; #region Finding using UsingInfo usingInfoTry = scriptInfo.FindUsing(_path); if (usingInfoTry != null) { if (usingInfoTry.SF != scriptInfo.SF && usingInfoTry.Access != MemberAccess.Public) { scriptInfo.SF.Errors.Add(new SemanticError("Could not access using '" + usingInfoTry.SF.SFPath + "::" + usingInfoTry.Name + "'", treeInfo.GetErrorInfo(this._pathElem))); return; } _path = usingInfoTry.SFPath; UsingName usingName = UsingName.ConvertToMe(this, this._pathElem, usingInfoTry); scriptInfo.References.Add(new UsingRefInfo(scriptInfo.SF, usingInfoTry, usingName.CharIndex, usingName.CharLength, checkingInfo.SC.SourceCode.Substring(usingName.CharIndex, usingName.CharLength))); } #endregion ScriptFile sf = scriptInfo.SF.Manager.GetSF(_path); if (sf == null || sf.SI == null) { scriptInfo.SF.Errors.Add( new SemanticError("Could not find file '" + _path + "'", treeInfo.GetErrorInfo(treeInfo.Current))); return; } else if (sf.SI == null) { scriptInfo.SF.Errors.Add( new WarningError("Could not read file '" + _path + "'", treeInfo.GetErrorInfo(treeInfo.Current))); return; } IMemberInfo member = sf.SI.FindLocalMember(_name); if (member == null) { scriptInfo.SF.Errors.Add( new SemanticError("Unknown member '" + _path + "::" + _name + "'", treeInfo.GetErrorInfo(treeInfo.Current))); return; } // member is private if (sf != scriptInfo.SF && ((member is FuncInfo && ((FuncInfo)member).Access != MemberAccess.Public) || (member is ConstInfo && ((ConstInfo)member).Access != MemberAccess.Public))) { scriptInfo.SF.Errors.Add( new SemanticError("Cannot access member '" + _path + "::" + _name + "'", treeInfo.GetErrorInfo(treeInfo.Current))); } // create constant if (member is ConstInfo) { ToConstant(treeInfo, (ConstInfo)member); scriptInfo.References.Add(new ConstRefInfo(scriptInfo.SF, (ConstInfo)member, this.CharIndex, this.CharLength, checkingInfo.SC.SourceCode.Substring(this.CharIndex, this.CharLength))); return; } else if (member is FuncInfo) { _funcInfo = (FuncInfo)member; scriptInfo.References.Add(new FuncRefInfo(scriptInfo.SF, (FuncInfo)member, this.CharIndex, this.CharLength, checkingInfo.SC.SourceCode.Substring(this.CharIndex, this.CharLength), false)); } else { scriptInfo.SF.Errors.Add( new SemanticError("Unknown member type '" + _path + "::" + _name + "'", treeInfo.GetErrorInfo(treeInfo.Current))); } }