Package macromedia.asc.semantics

Examples of macromedia.asc.semantics.Slot


        if (doing_method)
        {
            if( node.ref != null )
            {
                Slot slot = node.ref.getSlot(cx,node.kind);
                if( slot != null )
                {
                    if (slot.getOverriddenSlot() != null)
                    {
                        if (!matchSignatures(slot, slot.getOverriddenSlot()))
                        {
                            cx.error(node.pos(), kError_IncompatibleOverride);
                        }
                    }
                }

                ObjectValue fun = node.fun;
                cx.pushScope(fun.activation);

                if( node.def != null && node.def.version > -1)
                    cx.pushVersion(node.def.version);

                node.signature.evaluate(cx,this);

                if( node.def != null && node.def.version > -1)
                    cx.popVersion();
                cx.popScope();


            }

            return node.fun;

        }

        int savedWithDepth = cx.statics.withDepth;
        if( node.with_depth != -1)
        {
            cx.statics.withDepth = node.with_depth;
        }

        ObjectList<ObjectValue>saved_scopes = null;
        if( node.scope_chain != null )
        {
            saved_scopes = cx.swapScopeChain(node.scope_chain);
        }

        if( node.def != null && node.def.version > -1 )
            cx.pushVersion(node.def.version);

        ObjectValue fun = node.fun;
        cx.pushScope(fun.activation);

        boolean is_constructor = "$construct".equals(node.ref.name);
        if (is_constructor || node.isNative())
        {
            this.return_type = cx.voidType().getDefaultTypeInfo();
        }
        else
        {
            this.return_type = node.signature.type!=null?node.signature.type:cx.noType().getDefaultTypeInfo();
        }

        if( is_constructor && cx.useStaticSemantics() )
        {
            // check for default 0 arg ctor in baseclass if the user doesn't explicitly call super() from the ctor
            int scope_depth = cx.getScopeDepth();
            ObjectValue iframe = cx.scope(scope_depth-2);
            InstanceBuilder ib = iframe.builder instanceof InstanceBuilder ? (InstanceBuilder) iframe.builder : null;
            if( ib != null && !ib.calls_super_ctor )
            {
                // Doesn't call the base class constructor, check for a default no-args constructor

                if( ib.basebui != null )
                {
                    ObjectValue baseobj = ib.basebui.objectValue;

                    ReferenceValue ref = new ReferenceValue(cx, baseobj,"$construct",cx.publicNamespace());
                    Slot slot = ref.getSlot(cx,EMPTY_TOKEN);
                    ref.getType(cx,EMPTY_TOKEN);

                    if (slot != null && size(slot.getDeclStyles()) != 0 && slot.getDeclStyles().at(0) == PARAM_Required)
                    {
                        // found a slot, and it has required params
                        cx.error(node.pos(), kError_NoDefaultBaseclassCtor, ib.basebui.classname.toString());
                    }
                }
View Full Code Here


        Value result = cx.noType().prototype;

        if( node.typeref != null )
        {
            Slot typeslot = node.typeref.getSlot(cx);
            if( typeslot != null )
            {
                TypeValue typeval = typeslot.getValue() instanceof TypeValue ? (TypeValue) typeslot.getValue() : null;
                node.type = typeval != null ? node.typeref.has_nullable_anno ? typeval.getTypeInfo(node.typeref.is_nullable) : typeval.getDefaultTypeInfo() : null;
            }

            if( node.type != null )
            {
View Full Code Here

        Value result = cx.noType().prototype;

        if( node.typeref != null )
        {
            Slot typeslot = node.typeref.getSlot(cx);
            if( typeslot != null )
            {
                TypeValue typeval = typeslot.getValue() instanceof TypeValue ? (TypeValue) typeslot.getValue() : null;
                node.type = typeval != null ? node.typeref.has_nullable_anno ? typeval.getTypeInfo(node.typeref.is_nullable) : typeval.getDefaultTypeInfo() : null;
            }

            if( node.type != null )
            {
View Full Code Here

    }

    public Value evaluate(Context cx, ParameterNode node)
    {
        TypeInfo type = null;
        Slot slot = node.ref.getSlot(cx);

        if( node.typeref != null)
        {
            Slot typeslot = node.typeref.getSlot(cx);
            if( typeslot != null)
            {
                TypeValue typeval = (typeslot.getValue() instanceof TypeValue) ? (TypeValue) typeslot.getValue() : null;
                type = typeval != null ? node.typeref.has_nullable_anno ? typeval.getTypeInfo(node.typeref.is_nullable) : typeval.getDefaultTypeInfo() : null;
            }
            if( type!=null )
            {
                slot.setType(type);
View Full Code Here

    public Value PreprocessDefinitionTypeInfo(Context cx, RestParameterNode node)
    {
        ParameterNode pnode = node;
        Value result = PreprocessDefinitionTypeInfo(cx,pnode);
        Slot  s = node.ref.getSlot(cx);
        // Only error if there was an explicit typeref other than Array
        if (pnode.typeref != null && s.getType() != null && s.getType().getTypeValue() != cx.arrayType())
            cx.error(node.pos(), kError_InvalidRestDecl);

        return result;
    }
View Full Code Here

    }

    public Value PreprocessDefinitionTypeInfo(Context cx, ParameterNode node)
    {
        TypeInfo type = null;
        Slot slot = node.ref.getSlot(cx);

        if( node.typeref != null)
        {
            Slot typeslot = node.typeref.getSlot(cx);
            if( typeslot != null)
            {
                TypeValue typeval = (typeslot.getValue() instanceof TypeValue) ? (TypeValue) typeslot.getValue() : null;
                type = typeval != null ? node.typeref.has_nullable_anno ? typeval.getTypeInfo(node.typeref.is_nullable) :typeval.getDefaultTypeInfo() : null;
            }
            if( type!=null )
            {
                slot.setType(type);
View Full Code Here

            node.needs_init = false;
            doing_method = true;
            node.init.evaluate(cx,this);
            doing_method = false;
        }
        Slot class_slot = null;
        if( node.ref != null )
        {
            class_slot = node.ref.getSlot(cx, NEW_TOKEN);
        }

        if( node.version > -1 )
        {
            cx.pushVersion(node.version);
        }

        if (node.attrs != null)
        {
            node.attrs.evaluate(cx, this);
        }
        if (node.name != null)
        {
            node.name.evaluate(cx, this);
        }
        if (node.baseclass != null)
        {
            node.baseclass.evaluate(cx, this);
        }

        if (doing_class)
          {
              return node.cframe;
          }

        cx.pushStaticClassScopes(node);
        this_contexts.add(error_this);

        // Generate code for the static property definitions
        doing_class = true;

        {
            for (FunctionCommonNode staticfexpr : node.staticfexprs)
            {
                staticfexpr.evaluate(cx, this);
            }
        }

        {
            doing_class = false;
            for (Node clsdef : node.clsdefs)
            {
                clsdef.evaluate(cx, this);
            }
            doing_class = true;
        }

        if (node.statements != null)
        {
            node.statements.evaluate(cx, this);
        }

        doing_method = false;   // This flag determines if the function is compiled
                                // now or later. The outer code block is finished
                                // so we can do a another one.

        cx.pushScope(node.iframe);

        this_contexts.removeLast();
        this_contexts.add(instance_this);

        // Determine which interfaces are implemented by the class
        if (node.interfaces != null)
        {
            node.interfaces.evaluate(cx, this);
        }

        // Generate code for the instance initializers
        {
            for (Node init : node.instanceinits)
            {
                doing_method = true;
                // not clear on whether this is required for instance inits
                if (init instanceof FunctionDefinitionNode) // FunctionCommonNode initial evaluation requires this flag, normally set within StatementListNode evaluation
                {                                                  //  static functions (incl getter/setters) are evaluated here, however, rather than from within a StatementListNode.
                    FunctionDefinitionNode func_def = (FunctionDefinitionNode)init;
                    func_def.evaluate(cx, this);

                    if( func_def.fexpr.ref.name.equals("$construct") )
                    {
                        // Copy the type info from the constructor slot into the global slot that is the reference
                        // to the class - this is so that type checking on constructor calls can happen correctly
                        Slot ctor_slot = func_def.fexpr.ref.getSlot(cx, func_def.fexpr.kind);
                        if( class_slot != null && ctor_slot != null )
                        {
                            class_slot.setTypes(ctor_slot.getTypes());
                            class_slot.setDeclStyles(ctor_slot.getDeclStyles());
                        }
                    }
                }
                else
                {
View Full Code Here

                {
                    errorID = kError_UnknownInterfaceMethod;
                }
                else
                {
                    Slot orig = interfaceIFrame.getSlot(cx, implied_id);

                    slot_id = classNode.iframe.getSlotIndex(cx,lookupKind,name,namespace);
                    implied_id = classNode.iframe.getImplicitIndex(cx, slot_id, EMPTY_TOKEN);
                    boolean slot_getter = (slot_id == implied_id);
                    Slot slot = classNode.iframe.getSlot(cx, implied_id);

                    if (!matchSignatures(slot, orig) || orig_getter != slot_getter)
                    {
                        errorID = kError_IncompatibleInterfaceMethod;
                    }
View Full Code Here

                if (!cx.isValidImport(import_name))
                {
                    Namespaces namespaces = new Namespaces();
                    namespaces.add( cx.getNamespace(packageName.intern()) );
                    ReferenceValue ref = new ReferenceValue(cx, null, definitionName, namespaces);
                    Slot slot = ref.getSlot(cx,GET_TOKEN);
                    if (slot == null)
                    {
                        cx.error(node.name.pos(), kError_DefinitionNotFound, import_name);
                    }
                    else
View Full Code Here

    }

    public Value evaluate(Context cx, SuperStatementNode node)
    {
        Slot slot = null;

        if( node.baseobj != null )
        {
            ReferenceValue ref = new ReferenceValue(cx, node.baseobj,"$construct",cx.publicNamespace());
            slot = ref.getSlot(cx,EMPTY_TOKEN);
            ref.getType(cx,EMPTY_TOKEN);

            // cn: if the user did not define an explicit constructor for the baseclass, decl_styles is
            //  never initialized.  Initialize now to correctly detect wrong # of arguments supplied.
            if (slot != null && size(slot.getTypes()) == 0 && size(slot.getDeclStyles()) == 0)
            {
                slot.addDeclStyle(PARAM_Void);
                slot.addType(cx.voidType().getDefaultTypeInfo());
            }
        }

        if( node.call.args != null )
        {
            if( slot != null )
            {
                node.call.args.expected_types = slot.getTypes();
                node.call.args.decl_styles = slot.getDeclStyles();
            }

            node.call.args.evaluate(cx,this);
        }
        else if (cx.useStaticSemantics() && slot != null && size(slot.getDeclStyles()) != 0 && slot.getDeclStyles().at(0) == PARAM_Required)
        {
            StringBuilder err_arg_buf = new StringBuilder();
            int expected_num_args = slot.getDeclStyles().size();
            for(; expected_num_args > 0; expected_num_args--)
            {
                if (slot.getDeclStyles().at(expected_num_args-1) == PARAM_Required)
                    break;
            }
            err_arg_buf.append(expected_num_args);
            cx.error(node.pos(), kError_WrongNumberOfArguments, err_arg_buf.toString());
        }
View Full Code Here

TOP

Related Classes of macromedia.asc.semantics.Slot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.