示例#1
0
        public ArrowExpressionClauseCompiler(IArrowExpressionClause arrowExpressionClause, AbstractILCompilerParams @params) : base(@params)
        {
            myArrowExpressionClause = arrowExpressionClause;
            switch (myArrowExpressionClause.Parent)
            {
            case IPropertyDeclaration propertyDeclaration:
                var name = $"get_{propertyDeclaration.DeclaredName}";
                MyParams.CreateMethod(null, name);
                IsMethod = true;
                break;

            case IMethodDeclaration _:
            case ILocalFunctionDeclaration _:
            case IAccessorDeclaration _:
            case IConstructorDeclaration _:
            case IIndexerDeclaration _:
                IsMethod = false;
                break;

            default:
                throw MyParams.CreateException(
                          $"parent of ArrowExpression is {myArrowExpressionClause.Parent?.GetType()}");
            }
        }
 public LocalFunctionDeclarationCompiler(ILocalFunctionDeclaration localFunctionDeclaration, AbstractILCompilerParams @params) : base(@params)
 {
     myLocalFunctionDeclaration = localFunctionDeclaration;
     MyParams.CreateMethod(myLocalFunctionDeclaration.DeclaredElement);
 }
示例#3
0
 public AccessorDeclarationCompiler(IAccessorDeclaration accessor, AbstractILCompilerParams myParams) : base(myParams)
 {
     myAccessor = accessor;
     MyParams.CreateMethod(accessor.DeclaredElement);
 }
示例#4
0
 public MethodDeclarationCompiler(IMethodDeclaration methodDeclaration, AbstractILCompilerParams @params) : base(@params)
 {
     myMethodDeclaration = methodDeclaration;
     MyParams.CreateMethod(myMethodDeclaration.DeclaredElement);
 }
示例#5
0
 public ConstructorDeclarationCompiler(IConstructorDeclaration constructorDeclaration,
                                       AbstractILCompilerParams @params) : base(@params)
 {
     myConstructorDeclaration = constructorDeclaration;
     MyParams.CreateMethod(constructorDeclaration.DeclaredElement);
 }