Ejemplo n.º 1
0
        protected MemberSemanticModel(
            LanguageSyntaxNode root,
            Symbol memberSymbol,
            Binder rootBinder,
            SyntaxTreeSemanticModel containingSemanticModelOpt,
            SyntaxTreeSemanticModel parentSemanticModelOpt,
            int speculatedPosition)
        {
            Debug.Assert(root != null);
            Debug.Assert((object)memberSymbol != null);
            Debug.Assert(parentSemanticModelOpt == null ^ containingSemanticModelOpt == null);
            Debug.Assert(containingSemanticModelOpt == null || !containingSemanticModelOpt.IsSpeculativeSemanticModel);
            Debug.Assert(parentSemanticModelOpt == null || !parentSemanticModelOpt.IsSpeculativeSemanticModel, CSharpResources.ChainingSpeculativeModelIsNotSupported);

            _memberSymbol = memberSymbol;

            this.RootBinder             = rootBinder.WithAdditionalFlags(GetSemanticModelBinderFlags());
            _containingSemanticModelOpt = containingSemanticModelOpt;
            _parentSemanticModelOpt     = parentSemanticModelOpt;
            _speculatedPosition         = speculatedPosition;

            _boundTree = new BoundTree(this.Compilation, (LanguageSyntaxTree)root.SyntaxTree, rootBinder, _ignoredDiagnostics);

            _operationFactory = new Lazy <LanguageOperationFactory>(() => new LanguageOperationFactory(this));
        }
Ejemplo n.º 2
0
 public BoundProperty(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, string name, Optional <object> valueOpt, SymbolPropertyOwner owner, Type ownerType, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _name          = name;
     _hasFixedValue = valueOpt.HasValue;
     _value         = valueOpt.HasValue ? valueOpt.Value : default;
     _owner         = owner;
     _ownerType     = ownerType;
 }
Ejemplo n.º 3
0
        public BoundTree Bind(CodeBlockNode node)
        {
            BoundTree tree = new BoundTree();

            foreach (Statement statement in node.Children)
            {
                tree.Statements.Add(BindStatement(statement));
            }

            return(tree);
        }
        internal SyntaxTreeSemanticModel(LanguageCompilation compilation, LanguageSyntaxTree syntaxTree, bool ignoreAccessibility = false)
        {
            _compilation          = compilation;
            _ignoresAccessibility = ignoreAccessibility;

            if (!this.Compilation.SyntaxTrees.Contains(syntaxTree))
            {
                throw new ArgumentOutOfRangeException(nameof(syntaxTree), CSharpResources.TreeNotPartOfCompilation);
            }

            _boundTree = new BoundTree(compilation, syntaxTree, compilation.GetBinder(syntaxTree.GetRootNode()), _ignoredDiagnostics);

            _binderFactory = compilation.GetBinderFactory(SyntaxTree);
        }
Ejemplo n.º 5
0
 public CustomBoundNode(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
 }
Ejemplo n.º 6
0
 public BoundIdentifier(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
 }
Ejemplo n.º 7
0
 public BoundValue(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, object value, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _values = ImmutableArray.Create(value);
 }
Ejemplo n.º 8
0
 public BoundSymbolDef(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, Type type, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _type = type;
 }
Ejemplo n.º 9
0
 public BoundAttribute(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, ImmutableArray <Type> types, ImmutableArray <Type> nestingTypes, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, types, nestingTypes, syntax, hasErrors)
 {
 }
Ejemplo n.º 10
0
 public abstract IsBindableNodeVisitor CreateIsBindableNodeVisitor(BoundTree boundTree);
Ejemplo n.º 11
0
 private Binder GetEnclosingBinderInternalWithinRoot(SyntaxNode node, int position)
 {
     AssertPositionAdjusted(position);
     return(BoundTree.GetEnclosingBinderInternalWithinRoot(node, position, RootBinder, _boundTree.Root).WithAdditionalFlags(GetSemanticModelBinderFlags()));
 }
 internal SyntaxTreeSemanticModel(LanguageCompilation parentCompilation, LanguageSyntaxTree parentSyntaxTree, LanguageSyntaxTree speculatedSyntaxTree)
 {
     _compilation   = parentCompilation;
     _boundTree     = new BoundTree(parentCompilation, speculatedSyntaxTree, parentCompilation.GetBinder(speculatedSyntaxTree.GetRootNode()), _ignoredDiagnostics);
     _binderFactory = _compilation.GetBinderFactory(parentSyntaxTree);
 }
Ejemplo n.º 13
0
 protected BoundExpression(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, IOperation expression, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _expression = expression;
 }
Ejemplo n.º 14
0
 public BoundSelectedEndPoint(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
 }
Ejemplo n.º 15
0
 protected BoundStatement(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, IOperation statement, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _statement = statement;
 }
Ejemplo n.º 16
0
 public BoundSymbolUse(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, ImmutableArray <Type> types, ImmutableArray <Type> nestingTypes, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _types        = types;
     _nestingTypes = nestingTypes;
 }
Ejemplo n.º 17
0
 public BoundEnumValue(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, string name, Type enumType, LanguageSyntaxNode syntax, bool hasErrors = false)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
     _name     = name;
     _enumType = enumType;
 }
Ejemplo n.º 18
0
 public override BoundNodeFactoryVisitor CreateBoundNodeFactoryVisitor(BoundTree boundTree)
 {
     return(new MetaBoundNodeFactoryVisitor(boundTree));
 }
Ejemplo n.º 19
0
 public abstract BoundNodeFactoryVisitor CreateBoundNodeFactoryVisitor(BoundTree boundTree);
Ejemplo n.º 20
0
 public override IsBindableNodeVisitor CreateIsBindableNodeVisitor(BoundTree boundTree)
 {
     return(new MetaIsBindableNodeVisitor(boundTree));
 }
Ejemplo n.º 21
0
 public BoundBadStatement(BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors)
     : base(BoundKind.BadStatement, boundTree, childBoundNodes, syntax, hasErrors)
 {
 }
Ejemplo n.º 22
0
 public BoundOpposite(MetaBoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors)
     : base(kind, boundTree, childBoundNodes, syntax, hasErrors)
 {
 }