예제 #1
0
 public AssignmentExpression(VariableExpression target, Expression expression) 
     : base(AstNodeType.AssignmentExpression, new AstNode[]{target, expression})
 {
 }
예제 #2
0
파일: VaultEval.cs 프로젝트: xeno-by/elf4b
        private static Expression Expand(VariableExpression vex, IVault vault, IVault repository, List<Expression> stack, Dictionary<String, IBranch> nodes)
        {
            var @ref = vault.GetBranch(vex.Name.FromElfIdentifier());
            if (@ref == null)
            {
                throw new ReferencedBranchDoesNotExistException(vex.Name);
            }

            if (@ref.IsFov())
            {
                if (@ref.GetOrCreateValue("declarationType", "source").ContentString == "source")
                {
                    String val;
                    if (repository == null)
                    {
                        val = @ref.GetValue("valueForTesting").ContentString;
                    }
                    else
                    {
                        var external = @ref.GetValue("repositoryValue").ContentString;
                        val = repository.GetValue(external).ContentString;
                    }

                    return new LiteralExpression(String.Format("[[{0}]]{1}", @ref.GetValue("type").ContentString, val));
                }
                else
                {
                    return ExpandRhs(@ref, repository, stack, nodes);
                }
            }
            else
            {
                var varName = @ref.VPath.ToElfIdentifier();
                nodes[varName] = @ref;
                return new VariableExpression(varName);
            }
        }
예제 #3
0
 private IEnumerable<ElfVmInstruction> CompileVariable(VariableExpression ve)
 {
     yield return new PushRef(ve.Name);
 }