//------------------------------------------------------------ // Ident重複チェック。trueなら重複している。 private bool checkIdentDuplication(SymbolTree.ErrorInfoHolder aErrorHolder, Identifier aIdent) { if (FindChildNode(aIdent) != null) { aErrorHolder.Set(new SymbolTree.ErrorInfo(SymbolTree.ErrorKind.NODE_NAME_IS_ALREADY_EXIST, mModuleContext, aIdent.Token)); return(true); } return(false); }
//------------------------------------------------------------ // 展開命令。 public bool SymbolExpand(SymbolTree.ErrorInfoHolder aHolder, SymbolExpandCmdKind aCmd) { foreach (ISymbolNode node in mNodeList) { if (!node.SymbolExpand(aHolder, aCmd)) { return(false); } } return(true); }
//------------------------------------------------------------ // 展開命令。 public bool SymbolExpand(SymbolTree.ErrorInfoHolder aErrorHolder, SymbolExpandCmdKind aCmd) { switch (aCmd) { case SymbolExpandCmdKind.TypeNode: return(expandTypeNode(aErrorHolder)); case SymbolExpandCmdKind.FunctionNodeDecl: return(expandFunctionNodeDecl(aErrorHolder)); default: return(true); } }
//------------------------------------------------------------ // コンストラクタ。 public SemanticAnalyzeComponent( SymbolTree.ErrorInfoHolder aErrorInfoHolder , ModuleContext aModuleContext , TypeSymbolNode aTypeSymbolNode , OnSymbolNodeCreate aOnSymbolNodeCreate , ISymbolNode aPrevSymbolNode ) { ErrorInfoHolder = aErrorInfoHolder; ModuleContext = aModuleContext; TypeSymbolNode = aTypeSymbolNode; OnSymbolNodeCreateMethod = aOnSymbolNodeCreate; PrevSymbolNode = aPrevSymbolNode; }
//------------------------------------------------------------ // FunctionNode宣言展開。 private bool expandFunctionNodeDecl(SymbolTree.ErrorInfoHolder aErrorHolder) { foreach (SymbolDef symbol in mStaticTypeDef.SymbolDefList) { if (symbol.MemberFunctionDecl != null) { if (checkIdentDuplication(aErrorHolder, symbol.MemberFunctionDecl.Ident)) { return(false); } addNode(new FunctionSymbolNode(this, mModuleContext, symbol.MemberFunctionDecl)); } } return(true); }
//------------------------------------------------------------ // TypeNode展開。 private bool expandTypeNode(SymbolTree.ErrorInfoHolder aErrorHolder) { foreach (SymbolDef symbol in mStaticTypeDef.SymbolDefList) { if (symbol.StaticTypeDef != null) { if (checkIdentDuplication(aErrorHolder, symbol.StaticTypeDef.Ident)) { return(false); } addNode(new TypeSymbolNode(this, mModuleContext, symbol.StaticTypeDef)); } } return(true); }
//------------------------------------------------------------ // シンボルを展開する。 public bool SymbolExpand(SymbolTree.ErrorInfoHolder aHolder, SymbolExpandCmdKind aCmdKind) { // todo:impl return(true); }
//------------------------------------------------------------ // 展開命令 public bool SymbolExpand(SymbolTree.ErrorInfoHolder holder, SymbolExpandCmdKind cmd) { return(mTypeNode.SymbolExpand(holder, cmd)); }