예제 #1
0
 public TreeTryReceiveNode(TreeContext context, SourceLocation location, TreeLocal result, TreeReference then,
                           TreeReference @else)
     : base(context, location)
 {
     Result = result;
     Then   = then;
     Else   = @else;
 }
예제 #2
0
 public TreeTryCallNode(TreeContext context, SourceLocation location, TreeReference subject,
                        ImmutableArray <TreeReference> arguments, TreeReference?variadicArgument, TreeLocal exception,
                        TreeReference @catch)
     : base(context, location)
 {
     Subject          = subject;
     Arguments        = arguments;
     VariadicArgument = variadicArgument;
     Exception        = exception;
     Catch            = @catch;
 }
예제 #3
0
파일: TreePattern.cs 프로젝트: alexrp/flare
 public abstract TreeReference Compile(TreeContext context, SourceLocation location, TreeLocal operand);
예제 #4
0
 public override TreeReference Compile(TreeContext context, SourceLocation location, TreeLocal operand)
 {
     throw new System.NotImplementedException(); // TODO
 }
예제 #5
0
        public override TreeReference Compile(TreeContext context, SourceLocation location, TreeLocal operand)
        {
            var local = context.CreateLocal();
            var exprs = ImmutableArray.Create <TreeReference>(
                new TreeAssignNode(context, location,
                                   new TreeVariableNode(context, location, local),
                                   new TreeRelationalNode(context, location,
                                                          new TreeVariableNode(context, location, operand), TreeRelationalOperator.Equal,
                                                          new TreeLiteralNode(context, location, Value))));

            if (Alias is TreeLocal alias)
            {
                exprs = exprs.Add(
                    new TreeAssignNode(context, location,
                                       new TreeVariableNode(context, location, alias),
                                       new TreeVariableNode(context, location, operand)));
            }

            return(new TreeBlockNode(context, location, exprs.Add(
                                         new TreeVariableNode(context, location, local))));
        }
예제 #6
0
        public override TreeReference Compile(TreeContext context, SourceLocation location, TreeLocal operand)
        {
            var exprs = ImmutableArray.Create <TreeReference>(
                new TreeAssignNode(context, location,
                                   new TreeVariableNode(context, location, Identifier),
                                   new TreeVariableNode(context, location, operand)));

            if (Alias is TreeLocal alias)
            {
                exprs = exprs.Add(
                    new TreeAssignNode(context, location,
                                       new TreeVariableNode(context, location, alias),
                                       new TreeVariableNode(context, location, operand)));
            }

            return(new TreeBlockNode(context, location, exprs.Add(
                                         new TreeLiteralNode(context, location, true))));
        }
예제 #7
0
 public TreeIdentifierPattern(TreeLocal?alias, TreeLocal identifier)
     : base(alias)
 {
     Identifier = identifier;
 }