public void Visit(FunctionDeclarationStatement expression) { Builder.Append("function ") .Append(expression.Name) .Append("("); bool first = true; foreach (var parameter in expression.Parameters) { if (first == false) { Builder.Append(", "); } first = false; Builder.Append(parameter); } Builder.Append(") {"); indent++; Indent(); expression.Statement.Accept(this); indent--; Indent(); Builder.AppendLine("}"); }
public override void Visit(FunctionDeclarationStatement node) { VisitNode(node.Implementation); // VisitNode(node.Expression); Visit((Statement)node); // WriteEdge(node, node.Expression, "expression"); WriteEdge(node, node.Implementation, "implementation"); }
public override void Visit(FunctionDeclarationStatement node) { PushLocation(node); var stackState = _localVars.GetTemporaryStackState(); VisitNode(node.Implementation); AsVoid(); _localVars.PopTemporariesAfter(stackState); PopLocation(); }
public IEnumerable <FunctionDeclarationStatement> GetSourceCodeGlobalFunctions() { foreach (Statement statement in JintEngine.Compile(Code, false).Statements) { if (statement.GetType() == typeof(FunctionDeclarationStatement)) { FunctionDeclarationStatement funcDecl = (FunctionDeclarationStatement)statement; if (funcDecl != null) { yield return(funcDecl); } } } }
private void HoistingExecuteStatement(FunctionDeclarationStatement statement) { var name = statement.Name; try { Memory.HoistingDecalreFunction(this, name); } catch (RuntimeException) { throw; } catch (Exception ex) { throw new RuntimeException(statement.LinePragma, ex.Message, ex); } }
private ExecuteResult ExecuteStatement(FunctionDeclarationStatement statement) { var name = statement.Name; var paras = statement.Parameters; var stats = statement.Statements; try { IFunctionObject value = this.ObjectCreator.CreateFunction(this, paras, stats); Memory.DecalreFunction(this, name, value); } catch (RuntimeException) { throw; } catch (Exception ex) { throw new RuntimeException(statement.LinePragma, ex.Message, ex); } return(ExecuteResult.Next); }
public void Visit(FunctionDeclarationStatement expression) { Visit(expression.Expression); }
public override void Visit(FunctionDeclarationStatement node) { VisitNode(node.Implementation); Visit((Statement)node); }
public override void Visit(FunctionDeclarationStatement expression) { Trace.Fail("Invalid situation, should not get here"); }
public override void Visit(FunctionDeclarationStatement node) { result = new FunctionDeclarationStatement(GetCloneOf(node.Expression), GetCloneOf(node.Implementation)); }
public override void Visit(FunctionDeclarationStatement node) { }
public virtual void Visit(FunctionDeclarationStatement expression) { logVisit(expression); }
public void Visit(FunctionDeclarationStatement expression) { Dump(expression); }
public void LoadPlugins(Player p) { Hooks.ResetHooks(); this.ParsePlugin(); foreach (Plugin plugin in this.plugins) { try { this.interpreter.Run(plugin.Code); foreach (Statement current in JintEngine.Compile(plugin.Code, false).Statements) { if (current.GetType() == typeof(FunctionDeclarationStatement)) { FunctionDeclarationStatement functionDeclarationStatement = (FunctionDeclarationStatement)current; if (functionDeclarationStatement != null) { if (functionDeclarationStatement.Name == "On_ServerInit") { Hooks.OnServerInit += new Hooks.ServerInitDelegate(plugin.OnServerInit); } else if (functionDeclarationStatement.Name == "On_PluginInit") { Hooks.OnPluginInit += new Hooks.PluginInitHandlerDelegate(plugin.OnPluginInit); } else if (functionDeclarationStatement.Name == "On_ServerShutdown") { Hooks.OnServerShutdown += new Hooks.ServerShutdownDelegate(plugin.OnServerShutdown); } else if (functionDeclarationStatement.Name == "On_ItemsLoaded") { Hooks.OnItemsLoaded += new Hooks.ItemsDatablocksLoaded(plugin.OnItemsLoaded); } else if (functionDeclarationStatement.Name == "On_TablesLoaded") { Hooks.OnTablesLoaded += new Hooks.LootTablesLoaded(plugin.OnTablesLoaded); } else if (functionDeclarationStatement.Name == "On_Chat") { Hooks.OnChat += new Hooks.ChatHandlerDelegate(plugin.OnChat); } else if (functionDeclarationStatement.Name == "On_Console") { Hooks.OnConsoleReceived += new Hooks.ConsoleHandlerDelegate(plugin.OnConsole); } else if (functionDeclarationStatement.Name == "On_Command") { Hooks.OnCommand += new Hooks.CommandHandlerDelegate(plugin.OnCommand); } else if (functionDeclarationStatement.Name == "On_PlayerConnected") { Hooks.OnPlayerConnected += new Hooks.ConnectionHandlerDelegate(plugin.OnPlayerConnected); } else if (functionDeclarationStatement.Name == "On_PlayerDisconnected") { Hooks.OnPlayerDisconnected += new Hooks.DisconnectionHandlerDelegate(plugin.OnPlayerDisconnected); } else if (functionDeclarationStatement.Name == "On_PlayerKilled") { Hooks.OnPlayerKilled += new Hooks.KillHandlerDelegate(plugin.OnPlayerKilled); } else if (functionDeclarationStatement.Name == "On_PlayerHurt") { Hooks.OnPlayerHurt += new Hooks.HurtHandlerDelegate(plugin.OnPlayerHurt); } else if (functionDeclarationStatement.Name == "On_PlayerSpawning") { Hooks.OnPlayerSpawning += new Hooks.PlayerSpawnHandlerDelegate(plugin.OnPlayerSpawn); } else if (functionDeclarationStatement.Name == "On_PlayerSpawned") { Hooks.OnPlayerSpawned += new Hooks.PlayerSpawnHandlerDelegate(plugin.OnPlayerSpawned); } else if (functionDeclarationStatement.Name == "On_PlayerGathering") { Hooks.OnPlayerGathering += new Hooks.PlayerGatheringHandlerDelegate(plugin.OnPlayerGathering); } else if (functionDeclarationStatement.Name == "On_EntityHurt") { Hooks.OnEntityHurt += new Hooks.EntityHurtDelegate(plugin.OnEntityHurt); } else if (functionDeclarationStatement.Name == "On_EntityDecay") { Hooks.OnEntityDecay += new Hooks.EntityDecayDelegate(plugin.OnEntityDecay); } else if (functionDeclarationStatement.Name == "On_EntityDeployed") { Hooks.OnEntityDeployed += new Hooks.EntityDeployedDelegate(plugin.OnEntityDeployed); } else if (functionDeclarationStatement.Name == "On_NPCHurt") { Hooks.OnNPCHurt += new Hooks.HurtHandlerDelegate(plugin.OnNPCHurt); } else if (functionDeclarationStatement.Name == "On_NPCKilled") { Hooks.OnNPCKilled += new Hooks.KillHandlerDelegate(plugin.OnNPCKilled); } else if (functionDeclarationStatement.Name == "On_BlueprintUse") { Hooks.OnBlueprintUse += new Hooks.BlueprintUseHandlerDelagate(plugin.OnBlueprintUse); } else if (functionDeclarationStatement.Name == "On_DoorUse") { Hooks.OnDoorUse += new Hooks.DoorOpenHandlerDelegate(plugin.OnDoorUse); } } } } } catch (Exception) { string arg = "Can't load plugin : " + plugin.Path.Remove(0, plugin.Path.LastIndexOf("\\") + 1); if (p != null) { p.Message(arg); } else { Server.GetServer().Broadcast(arg); } } } }
public override void Visit(FunctionDeclarationStatement node) { throw new InvalidOperationException(); }