コード例 #1
0
ファイル: FixedNode.cs プロジェクト: fugaku/scriptsharp
 public FixedNode(Token token,
                  VariableDeclarationNode declaration,
                  ParseNode body)
     : base(ParseNodeType.Fixed, token) {
     _declaration = (VariableDeclarationNode)GetParentedNode(declaration);
     _body = GetParentedNode(body);
 }
コード例 #2
0
 public FixedNode(Token token,
                  VariableDeclarationNode declaration,
                  ParseNode body)
     : base(ParseNodeType.Fixed, token)
 {
     _declaration = (VariableDeclarationNode)GetParentedNode(declaration);
     _body        = GetParentedNode(body);
 }
コード例 #3
0
        private Statement ProcessVariableDeclarationStatement(VariableDeclarationNode node)
        {
            VariableDeclarationStatement statement = new VariableDeclarationStatement();
            TypeSymbol variableType = _symbolSet.ResolveType(node.Type, _symbolTable, _memberContext);

            foreach (VariableInitializerNode initializerNode in node.Initializers) {
                string name = initializerNode.Name.Name;

                VariableSymbol symbol = new VariableSymbol(name, _memberContext, variableType);
                if (initializerNode.Value != null) {
                    Expression value = _expressionBuilder.BuildExpression(initializerNode.Value);
                    if (value is MemberExpression) {
                        value = _expressionBuilder.TransformMemberExpression((MemberExpression)value);
                    }
                    symbol.SetValue(value);
                }

                _symbolTable.AddSymbol(symbol);

                statement.AddVariable(symbol);
            }
            return statement;
        }
コード例 #4
0
ファイル: Parser.cs プロジェクト: fugaku/scriptsharp
        private ParseNode ParseEvent(Token token, ParseNodeList attributes, Modifiers modifiers) {
            ParseNode backingMember;
            NextToken();    // event
            ParseNode type = ParseType();
            NameNode interfaceType;
            switch (ParseMemberName(out interfaceType)) {
                case ScanMemberNameKind.Property:

                    backingMember = ParseProperty(token, new ParseNodeList(), modifiers, type, interfaceType, true);
                    break;
                case ScanMemberNameKind.Field:
                default:
                    ReportInterfaceVariable(interfaceType);
                    backingMember = new VariableDeclarationNode(
                                token,
                                new ParseNodeList(),
                                modifiers,
                                type,
                                ParseFieldInitializersStatement(false),
                                false);
                    break;
            }

            return new EventDeclarationNode(
                        token,
                        attributes,
                        backingMember);
        }