private GSharpMethod CompileMethod(FunctionDeclarationNode funcDecl, bool isInstanceMethod) { symbolTable.CurrentScope = symbolTable.CurrentScope.ChildScopes[currentScope++]; GSharpMethod methodBuilder = new GSharpMethod(funcDecl.Name, funcDecl.Parameters.Count, symbolTable.CurrentScope.SymbolCount, module); FunctionCompiler compiler = new FunctionCompiler(symbolTable, methodBuilder); for (int i = 0; i < funcDecl.Parameters.Count; i++) { methodBuilder.Parameters[funcDecl.Parameters[i]] = symbolTable.GetSymbol(funcDecl.Parameters[i]).Index; } methodBuilder.IsInstanceMethod = isInstanceMethod; compiler.Visit(funcDecl.Children[0]); symbolTable.CurrentScope = symbolTable.CurrentScope.ParentScope; methodBuilder.EmitInstruction(OperationCode.LoadNull); methodBuilder.FinalizeLabels(); return(methodBuilder); }
public FunctionCompiler(SymbolTable symbolTable, GSharpMethod methodBuilder) { this.symbolTable = symbolTable; this.methodBuilder = methodBuilder; }
public GSharpClass(string name, GSharpMethod constructor) : base(name) { this.constructor = constructor; }
public void AddInstanceMethod(GSharpMethod method) { instanceMethods.Add(method); }