public void AddArgument(LuaExpressionSyntax argument) { ArgumentList.AddArgument(argument); }
public LuaLocalVariableDeclaratorSyntax(LuaIdentifierNameSyntax identifier, LuaExpressionSyntax expression = null) { Declarator = new LuaVariableDeclaratorSyntax(identifier, expression); }
public LuaInvocationExpressionSyntax(LuaExpressionSyntax expression, LuaExpressionSyntax argument) : this(expression) { AddArgument(argument); }
internal void Add(LuaIdentifierNameSyntax key, LuaExpressionSyntax value) { Items.Add(new LuaKeyValueTableItemSyntax(key, value)); }
public LuaSingleTableItemSyntax(LuaExpressionSyntax expression) { Expression = expression ?? throw new ArgumentNullException(nameof(expression)); }
public void Update(LuaExpressionSyntax expression, bool isObjectColon) { Contract.Assert(Expression == null); Expression = expression; OperatorToken = isObjectColon ? Tokens.ObjectColon : Tokens.Dot; }
public LuaKeyValueTableItemSyntax(LuaIdentifierNameSyntax key, LuaExpressionSyntax value) : this(new LuaTableLiteralKeySyntax(key), value) { }
private void AddInitFiled(LuaIdentifierNameSyntax name, LuaExpressionSyntax value) { initStatements_.Add(LuaIdentifierNameSyntax.This.MemberAccess(name).Assignment(value)); }
public void AddField(LuaIdentifierNameSyntax name, LuaExpressionSyntax value, bool isImmutable, bool isStatic, bool isPrivate, bool isReadOnly, List <LuaStatementSyntax> statements) { if (isStatic) { if (isPrivate) { local_.Variables.Add(name); if (value != null) { var assignment = name.Assignment(value); if (isImmutable) { methodList_.Statements.Add(assignment); } else { if (statements != null) { staticInitStatements_.AddRange(statements); } staticInitStatements_.Add(assignment); } } } else { if (isReadOnly) { local_.Variables.Add(name); if (value != null) { var assignment = name.Assignment(value); if (isImmutable) { methodList_.Statements.Add(assignment); AddResultTable(name); } else { if (statements != null) { staticInitStatements_.AddRange(statements); } staticInitStatements_.Add(assignment); staticInitStatements_.Add(LuaIdentifierNameSyntax.This.MemberAccess(name).Assignment(name)); } } } else { if (value != null) { if (isImmutable) { AddResultTable(name, value); } else { if (statements != null) { staticInitStatements_.AddRange(statements); } staticInitStatements_.Add(LuaIdentifierNameSyntax.This.MemberAccess(name).Assignment(value)); } } } } } else { if (value != null) { if (isImmutable) { AddResultTable(name, value); } else { if (statements != null) { initStatements_.AddRange(statements); } AddInitFiled(name, value); } } } }
public LuaElseIfStatementSyntax(LuaExpressionSyntax condition) { Condition = condition ?? throw new ArgumentNullException(nameof(condition));; }
private void AddResultTable(LuaIdentifierNameSyntax name, LuaExpressionSyntax value) { AddResultTable(new LuaKeyValueTableItemSyntax(name, value)); }
public void Update(string newName) { NameExpression = newName; }
public LuaSymbolNameSyntax(LuaExpressionSyntax identifierName) : base("") { NameExpression = identifierName; }
private void AddImport(LuaIdentifierNameSyntax name, LuaExpressionSyntax value) { importAreaStatements.Statements.Add(new LuaLocalVariableDeclaratorSyntax(name, value)); }
public LuaBinaryExpressionSyntax(LuaExpressionSyntax left, string operatorToken, LuaExpressionSyntax right) { Left = left ?? throw new ArgumentNullException(nameof(left)); OperatorToken = operatorToken; Right = right ?? throw new ArgumentNullException(nameof(right)); }
private (LuaPropertyOrEventIdentifierNameSyntax, LuaPropertyOrEventIdentifierNameSyntax) AddPropertyOrEvent(bool isProperty, LuaIdentifierNameSyntax name, LuaIdentifierNameSyntax innerName, LuaExpressionSyntax value, bool isImmutable, bool isStatic, bool isPrivate, LuaExpressionSyntax typeExpression, List <LuaStatementSyntax> statements) { LuaPropertyOrEventIdentifierNameSyntax get, set; if (isProperty) { get = new LuaPropertyOrEventIdentifierNameSyntax(true, true, name); set = new LuaPropertyOrEventIdentifierNameSyntax(true, false, name); } else { get = new LuaPropertyOrEventIdentifierNameSyntax(false, true, name); set = new LuaPropertyOrEventIdentifierNameSyntax(false, false, name); } local_.Variables.Add(get); local_.Variables.Add(set); if (!isStatic) { var initMethodIdentifier = isProperty ? LuaIdentifierNameSyntax.Property : LuaIdentifierNameSyntax.Event; var assignment = new LuaMultipleAssignmentExpressionSyntax(); assignment.Lefts.Add(get); assignment.Lefts.Add(set); var invocation = new LuaInvocationExpressionSyntax(initMethodIdentifier); invocation.AddArgument(new LuaStringLiteralExpressionSyntax(innerName)); assignment.Rights.Add(invocation); methodList_.Statements.Add(assignment); } else { var memberAccess = typeExpression.MemberAccess(innerName); var getFunction = new LuaFunctionExpressionSyntax(); var setFunction = new LuaFunctionExpressionSyntax(); if (isProperty) { getFunction.AddStatement(new LuaReturnStatementSyntax(memberAccess)); setFunction.AddParameter(LuaIdentifierNameSyntax.Value); setFunction.AddStatement(memberAccess.Assignment(LuaIdentifierNameSyntax.Value)); } else { getFunction.AddParameter(LuaIdentifierNameSyntax.Value); var getAssignment = memberAccess.Assignment(memberAccess.Binary(Tokens.Plus, LuaIdentifierNameSyntax.Value)); getFunction.AddStatement(getAssignment); setFunction.AddParameter(LuaIdentifierNameSyntax.Value); var setAssignment = memberAccess.Assignment(memberAccess.Binary(Tokens.Sub, LuaIdentifierNameSyntax.Value)); setFunction.AddStatement(setAssignment); } methodList_.Statements.Add(get.Assignment(getFunction)); methodList_.Statements.Add(set.Assignment(setFunction)); } if (value != null) { if (isStatic) { if (isImmutable) { AddResultTable(innerName, value); } else { if (statements != null) { staticInitStatements_.AddRange(statements); } staticInitStatements_.Add(LuaIdentifierNameSyntax.This.MemberAccess(innerName).Assignment(value)); } } else { if (isImmutable) { AddResultTable(innerName, value); } else { if (statements != null) { initStatements_.AddRange(statements); } AddInitFiled(innerName, value); } } } if (!isPrivate) { AddResultTable(get); AddResultTable(set); } return(get, set); }
public LuaPropertyAdapterExpressionSyntax(LuaExpressionSyntax expression, LuaPropertyOrEventIdentifierNameSyntax name, bool isObjectColon) { Update(expression, isObjectColon); Name = name; }
public (LuaPropertyOrEventIdentifierNameSyntax, LuaPropertyOrEventIdentifierNameSyntax) AddEvent(LuaIdentifierNameSyntax name, LuaIdentifierNameSyntax innerName, LuaExpressionSyntax value, bool isImmutable, bool isStatic, bool isPrivate, LuaExpressionSyntax typeExpression, List <LuaStatementSyntax> statements) { return(AddPropertyOrEvent(false, name, innerName, value, isImmutable, isStatic, isPrivate, typeExpression, statements)); }
public LuaKeyValueTableItemSyntax(LuaTableKeySyntax key, LuaExpressionSyntax value) { Key = key; Value = value; }
public LuaPrefixUnaryExpressionSyntax(LuaExpressionSyntax operand, string operatorToken) { Operand = operand ?? throw new ArgumentNullException(nameof(operand)); OperatorToken = operatorToken; }
public LuaTableIndexAccessExpressionSyntax(LuaExpressionSyntax expression, LuaExpressionSyntax index) { Expression = expression ?? throw new ArgumentNullException(nameof(expression)); Index = index ?? throw new ArgumentNullException(nameof(index)); }
public LuaParenthesizedExpressionSyntax(LuaExpressionSyntax expression) { Expression = expression ?? throw new ArgumentNullException(nameof(expression)); }
internal void Add(LuaExpressionSyntax value) { Items.Add(new LuaSingleTableItemSyntax(value)); }
public LuaArrayTypeAdapterExpressionSyntax(LuaExpressionSyntax typeExpression, LuaArrayRankSpecifierSyntax rankSpecifier) { TypeExpression = typeExpression ?? throw new ArgumentNullException(nameof(typeExpression)); RankSpecifier = rankSpecifier ?? throw new ArgumentNullException(nameof(rankSpecifier)); }
public LuaTableExpressionKeySyntax(LuaExpressionSyntax expression) { Expression = expression ?? throw new ArgumentNullException(nameof(expression)); }
public LuaInternalMethodExpressionSyntax(LuaExpressionSyntax expression) { Expression = expression ?? throw new ArgumentNullException(nameof(expression)); }
public LuaEqualsValueClauseSyntax(LuaExpressionSyntax value) { Value = value ?? throw new ArgumentNullException(nameof(value)); }
public LuaAssignmentExpressionSyntax(LuaExpressionSyntax left, LuaExpressionSyntax right) { Left = left ?? throw new ArgumentNullException(nameof(left)); Right = right ?? throw new ArgumentNullException(nameof(right)); }
public LuaInvocationExpressionSyntax(LuaExpressionSyntax expression, LuaExpressionSyntax argument1, LuaExpressionSyntax argument2, LuaExpressionSyntax argument3) : this(expression) { AddArgument(argument1); AddArgument(argument2); AddArgument(argument3); }
public LuaInvocationExpressionSyntax(LuaExpressionSyntax expression, params LuaExpressionSyntax[] arguments) : this(expression) { AddArguments(arguments); }