Package macromedia.asc.semantics

Examples of macromedia.asc.semantics.Slot


                   if(men instanceof MemberExpressionNode)
                   {
                       ReferenceValue v = ((MemberExpressionNode)men).ref;
                       if(v != null)
                       {
                           Slot s = v.getSlot(cx);
                           if(s != null && s.getInitializerValue() != null && s.getInitializerValue().hasValue())
                           {
                               // If this is a constant initializer, then remove it from the list
                               // because the value will be provided in the traits
                               list_node.items.set(i, cx.getNodeFactory().emptyStatement());
                           }
View Full Code Here


        TypeValue type = getTypeFromQName(typeID);
       
        int var_id = obj.builder.Variable(ctx, obj);
        int slot_id = obj.builder.ExplicitVar(ctx,obj,name,nss,type,-1,-1,var_id);

        Slot slot = obj.getSlot(ctx,slot_id);
    slot.setConst(is_const);
    slot.setImported(true);

        ret.slot = slot;

        IdentifierNode id=null;
        AttributeListNode attr=null;

        if( build_ast )
        {
            id = identifierNode(name, ns);
            attr = attributeList(false, false, false, ns, obj.builder);
        }
        if( value_kind == ActionBlockConstants.CONSTANT_Namespace )
        {
            ObjectValue nsValue = getNamespace(valueID);
            slot.setObjectValue(nsValue);
      slot.setConst(true);

            if( build_ast )
                ret.def = ctx.getNodeFactory().namespaceDefinition(attr, id, ctx.getNodeFactory().literalString(nsValue.name));

            return ret;
        }
        if( valueID != 0)
            slot.setObjectValue(getInitValue(valueID, value_kind));
       
        if( build_ast )
        {
          MemberExpressionNode typeExpr = null;
          if( typeID != 0 )
View Full Code Here

            method_slot = obj.builder.ExplicitCall(ctx,obj,methodName,names,ctx.noType(),isFinal,isOverride,-1,method_id,-1);
            break;
        }

        ObjectValue funcObj = getFunctionObject();
        Slot slot = obj.getSlot(ctx, method_slot);
        slot.setValue(funcObj);
    slot.setImported(true);

        // Calculate the internal name - this matter because with get/set properties you can end up with
        // multiple methods with the same name, but they must each have different internal names.
        StringBuilder internal_name = new StringBuilder(methodName.length() + 5);
        if( !fun_names.containsKey(methodName) )
        {
            fun_names.put(methodName,0);
        }
        internal_name.append(methodName).append('$');
        int num = fun_names.get(methodName);
        internal_name.append(num);
        num++;
        fun_names.put(methodName, num);

        int slot_id = obj.getImplicitIndex(ctx,method_slot,Tokens.EMPTY_TOKEN);
        Slot implied_slot = obj.getSlot(ctx, slot_id);
    implied_slot.setImported(true);

      String n = internal_name.toString();
        implied_slot.setMethodName(n);//node->fexpr->internal_name;
        ret.slot = implied_slot;

        // Make sure the FunctionBuilder gets cleaned up
        int functionKind;
        switch( kind )
        {
            case ActionBlockConstants.TRAIT_Getter:
                functionKind = Tokens.GET_TOKEN;
                break;
            case ActionBlockConstants.TRAIT_Setter:
                functionKind = Tokens.SET_TOKEN;
                break;
            default:
                functionKind = Tokens.EMPTY_TOKEN;
                break;
        }

        // Come up with the function signature
        AbcData.Method m_info = this.abcData.getMethod(methInfo);

        int returnTypeID = m_info.getReturnType();
        int paramTypeIDs[] = m_info.getParamTypes();
        int paramCount = paramTypeIDs.length;
        ObjectList<Node> optional_nodes = null;
        int optional_count = 0;
        if( m_info.getHasOptional()  )
        {
            if( build_ast )
            {
                optional_nodes = parseOptionalParams(m_info);
            }
            optional_count = m_info.getOptionalParamTypes().length;
        }
        String[] param_names = m_info.getParamNames();

        // Set return type
        implied_slot.setType(getTypeFromQName(returnTypeID).getDefaultTypeInfo());

        ParameterListNode paramList = null;

        ObjectList<TypeInfo> param_types = new ObjectList<TypeInfo>(paramCount);
        ByteList decl_styles = new ByteList(1);

        for( int i = 0, cur_optional = 0; i < paramCount; ++i )
        {
            ParameterNode param = null;
            if( build_ast )
            {
                AbcData.BinaryMN typeMN = null;
                if( paramTypeIDs[i] != 0 )
                {
                    typeMN = getBinaryMNFromCPool(paramTypeIDs[i]);
                    // getFullName(typeMN); // for effect
                }

                String simple_param_name = i < param_names.length && param_names[i] != null ? param_names[i] : ("param" + (i+1)).intern();
                param = parameterNode(simple_param_name, typeMN);

                paramList = nf.parameterList(paramList, param);
            }

            param_types.push_back(getTypeFromQName(paramTypeIDs[i]).getDefaultTypeInfo());

            if( i >= paramCount - optional_count )
            {
                if( build_ast )
                    param.init = optional_nodes.get(cur_optional++);
                decl_styles.push_back((byte) Slot.PARAM_Optional);
            }
            else
            {
                decl_styles.push_back((byte) Slot.PARAM_Required);
            }
        }
        if( m_info.getNeedsRest() )
        {
            if( build_ast )
            {
                ParameterNode param = parameterNode("rest", ctx.arrayType().name);
                RestParameterNode restNode = ctx.getNodeFactory().restParameter(param , -1);
                restNode.ref = param.ref;
                restNode.typeref = param.typeref;
                paramList = nf.parameterList(paramList, restNode);

                // rsun 11.22.05 porting over a fix made to the 8ball_AS3 branch a long time
                // ago, but only to the C++ compiler. has_rest needs to be reset here since
                // MovieClipMaker is a special entry point that creates function nodes itself.
                // otherwise, has_rest is unnecessarily true for all functions processed after
                // this.
                ctx.getNodeFactory().has_rest = false;
            }

            param_types.push_back(ctx.arrayType().getDefaultTypeInfo());
            decl_styles.push_back((byte) Slot.PARAM_Rest);
        }

        if( param_types.size() > 0 )
        {
            implied_slot.setTypes(param_types);
            implied_slot.setDeclStyles(decl_styles);
        }
        else
        {
            param_types.push_back(ctx.voidType().getDefaultTypeInfo());
            implied_slot.setTypes(param_types);
            implied_slot.addDeclStyle(Slot.PARAM_Void);
        }

        if( build_ast )
        {
            MemberExpressionNode retTypeNode = null;
View Full Code Here

            cframe.baseclass = null;
    }

        int var_id  = current_scope.builder.Variable(ctx,current_scope);
        int slot_id  = current_scope.builder.ExplicitVar(ctx,current_scope,className,ns,ctx.typeType(),-1,-1,var_id);
        Slot slot = current_scope.getSlot(ctx,slot_id);
        slot.setObjectValue(cframe);
    slot.setImported(true);
    slot.setConst(true);    // all class definitions are const.

        ret.slot = slot;

        current_scope.builder.ImplicitCall(ctx,current_scope,slot_id,cframe,CALL_Method,-1,-1);
    current_scope.builder.ImplicitConstruct(ctx,current_scope,slot_id,cframe,CALL_Method,-1,-1);

        if( isInterface )
        {
            ((ClassBuilder)cframe.builder).is_interface = true;
            slot.setImplNode(cdn);
        }

        clsdefs_sets.add(new ObjectList<ClassDefinitionNode>());

        region_name_stack.push_back(fullNameString);
       
        ctx.pushStaticClassScopes(cdn); // class
        {
          ctx.pushScope(iframe); // instance
          {
            StatementListNode instance_stmts = nf.statementList(null, (StatementListNode)null);
            parseTraits(iinfo.getITraits(), instance_stmts, build_ast, null, build_ast); // Traits for the instance
            cdn.instanceinits = new ObjectList<Node>(instance_stmts.items.size());
            if( instance_stmts.items.size() > 0)
            {
              cdn.instanceinits.addAll(instance_stmts.items);
            }
            // Add nodes for the constructor, which doesn't have a traits entry.
            DefAndSlot d = methodTrait("$construct", ctx.publicNamespace(),0,iinfo.getInitIndex(),0,0, build_ast);
            DefinitionNode iinit_node = d.def;
                if( build_ast )
                cdn.instanceinits.add(iinit_node);

                int implied_idx = current_scope.getImplicitIndex(ctx, slot_id, Tokens.NEW_TOKEN);
                Slot class_slot = current_scope.getSlot(ctx, implied_idx);
                if( class_slot != null)
                {
                    //class_slot.setType(d.slot.getType());
                    class_slot.setTypes(d.slot.getTypes());
                    class_slot.setDeclStyles(d.slot.getDeclStyles());
                }
          }
          ctx.popScope(); // instance

          AbcData.ClassInfo cinfo = this.abcData.getClassInfo(classID);
View Full Code Here

                        cx.error(node.pos(), kError_IncompatibleOverride);
                    }

                    if( true /* check signature and final */ )
                    {
                        Slot slot = obj.getSlot(cx,implied_id);
                        is_dynamic = slot.isIntrinsic();
                        int method_id = slot.getMethodID();
                        if( slot.isFinal() && !is_ctor )
                        {
                            if( node.name.kind == SET_TOKEN || node.name.kind == GET_TOKEN)
                                cx.error(node.pos(), kError_OverrideFinalAccessor);
                            else
                                cx.error(node.pos(), kError_FinalMethodRedefinition);
                        }

                        if( slot.declaredBy == obj )
                        {
                            // This was already defined at this level, it was not inherited from a base class
                            cx.error(node.pos(), kError_DuplicateFunction);
                        }
                        else if( is_prototype || is_dynamic )
                        {
                            is_override = true;
                        }
                        else if( !is_override && !is_ctor )
                        {
                            cx.error(node.pos(), kError_OverrideOfFuncNotMarkedForOverride);
                        }

                        if( node.name.kind == GET_TOKEN )
                        {
                            slot_id = bui.ExplicitGet(cx,obj,node.ref.name,namespaces,cx.noType(),is_final,is_override,-1,method_id,-1);
                        }
                        else
                        if( node.name.kind == SET_TOKEN )
                        {
                            slot_id = bui.ExplicitSet(cx,obj,node.ref.name,namespaces,cx.noType(),is_final,is_override,-1,method_id,-1);
                        }
                        else
                        {
                            slot_id = bui.ExplicitCall(cx,obj,node.ref.name,namespaces,cx.noType(),is_final,is_override,-1,method_id,-1);
                        }

                        if( !is_ctor )
                        {
                          // Constructors don't actually override the base class constructor
                          // Can have different signatures, so don't mark it as having an overriden slot
                          // so we won't do signature matching later.
                          Slot overriddenSlot = slot;
                          Slot overrideSlot = obj.getSlot(cx,obj.getImplicitIndex(cx,slot_id,EMPTY_TOKEN));
                          overrideSlot.setOverriddenSlot(overriddenSlot);
                        }
                    }
                    else
                    {
                        cx.error(node.pos(), kError_IncompatibleOverride);
                    }
                }
                else // cn: I think accessors now always end up in the block above, making this else block obsolete.
                {
                    Slot slot = obj.getSlot(cx,slot_id);
                    if( slot.getMethodID() <= 0 )
                    {
                        cx.error(node.pos(), kError_OverrideFinalAccessor);
                    }

                    // ISSUE: implement accessor overriding
                }
            }
            else
            if( bui instanceof ClassBuilder )
            {
                cx.error(node.pos(), kError_DuplicateFunction);
            }
            else
            if (bui instanceof GlobalBuilder && (node.pkgdef != null || namespaces.at(0) != hasNamespaces.at(0)) && is_first_time )
            {
                cx.error(node.pos(), kError_DuplicateFunction);
            }
            else
            if( cx.useStaticSemantics() && is_first_time ) // ISSUE: remove use of this flag by not evaluating this code twice
            {
                cx.error(node.pos(), kError_DuplicateFunction);
            }
            else
            {
                slot_id = obj.getSlotIndex(cx,GET_TOKEN,node.ref.name,hasNamespaces.at(0));
            }
        }
        else
        {
            if( is_override && !is_ctor)
            {
                if (is_interface_method)
                {
                    cx.error(node.pos(), kError_InvalidOverrideUsage);
                }
                else
                {
                    ObjectValue n = namespaces.at(0);
                    UnresolvedNamespace un = n instanceof UnresolvedNamespace ? (UnresolvedNamespace) n : null;
                    if( un == null || un.resolved )
                    {
                        cx.error(node.pos(), kError_OverrideNotFound);
                    }
                    else
                    {
                        cx.error(un.node.pos(), kError_Unknown_Namespace);
                    }
                }
            }

            if( node.name.kind == GET_TOKEN )
            {
                int method_id = bui.Method(cx,obj,(node.ref.name+"$get").intern(),namespaces,is_intrinsic); // Add getter to local dispatch table
                slot_id = bui.ExplicitGet(cx,obj,node.ref.name,namespaces,cx.noType(),is_final,is_override,-1,method_id,-1);
            }
            else
            if( node.name.kind == SET_TOKEN )
            {
                int method_id = bui.Method(cx,obj,(node.ref.name+"$set").intern(),namespaces,is_intrinsic);
                slot_id = bui.ExplicitSet(cx,obj,node.ref.name,namespaces,cx.noType(),is_final,is_override,-1,method_id,-1);
            }
            else
            {
                int method_id = bui.Method(cx,obj,node.ref.name,namespaces,is_intrinsic);
                slot_id = bui.ExplicitCall(cx,obj,node.ref.name,namespaces,cx.noType(),is_final,is_override,-1,method_id,-1);
            }
        }

        /*

        At this point we have either reported a redefinition error, or have
        the explicit slot for the function being defined, and an implicit
        slot for the implementation (i.e. method name, call seq)

        Now we specify the implementation

        */

        if( is_intrinsic )
        {
        }
        else
        if( node.fexpr != null && slot_id >= 0 )
        {
            node.fexpr.setNative(is_native);
            node.fexpr.kind = node.name.kind;  // inherited attribute

            Slot slot     = obj.getSlot(cx,slot_id);

            // FunctionCommonNode gets evaluated twice. The first time is for initializing
            // the function object and adding it to the list of nodes to be evaluated later.
            // The second time (this time) is for evaluating the function body.

            val     = node.fexpr.evaluate(cx,this);
            val = val != null ? val.getValue(cx) : null;
            slot.setObjectValue((val instanceof ObjectValue ? (ObjectValue)val : null));
            // slot.objValue = dynamic_cast<ObjectValue>(val!=null?val.getValue(cx) : null);


            if( slot.getObjectValue() != null)
            {
                // Resolve this function to its local dispatch id, if it is virtual, or a global
                // method id (method info) if it is not. Local method ids share the same local
                // name (the name of the original method). If B overrides m in A, then the local
                // method id for B.m will be something like A$m. If B.n is new, then its local
                // name will be something like B$n. A name consists of the classname,simplename,and
                // namespace.

                // B inherits the names of A. B declares an override of A.m. The new method slot for
                // m in B has the internal name that is the same as m in A, and therefore the same
                // dispatch id ( = local method name id).

                // The key is comparing names so that the rules for overriding are correctly implemented.

                if( is_ctor )
                {
                    InstanceBuilder ib = ((bui instanceof InstanceBuilder) ? (InstanceBuilder)bui : null);
                    if( ib != null)
                    {
                        ib.has_ctor = true;
                        ib.ctor_name = node.fexpr.internal_name;
                    }
                    else
                    {
                        cx.error(node.pos(), kError_ConstructorsMustBeInstanceMethods);
                    }
                }
                else
                if( bui instanceof ClassBuilder || bui instanceof InstanceBuilder || bui instanceof PackageBuilder )
                {
                }
                else
                {
                }

                /*

                Copy the implementation details into the implicit call slot

                */

                slot_id = obj.getImplicitIndex(cx,slot_id,EMPTY_TOKEN);
                obj.getSlot(cx,slot_id).setMethodName(node.fexpr.internal_name);
                obj.getSlot(cx,slot_id).setIntrinsic(is_dynamic);
                slot.getObjectValue().name = node.fexpr.internal_name;

            }

            node.fexpr.debug_name = region_name_stack.back();
        }
View Full Code Here

            // name and a pair of accessors (getter and setter).

            int var_id;
            var_id  = bui.Variable(cx,obj);
            int slot_id = bui.ExplicitVar(cx,obj,node.ref.name,namespaces,cx.noType(),-1,-1,var_id);
            Slot slot = obj.getSlot(cx,slot_id);
            slot.setTypeRef(node.typeref);
        }

        return node.ref;
    }
View Full Code Here

                else
                {
                    inheritClassSlots(node.cframe, node.iframe, type, cx);

                    // No matter what, if the base slot was from an import, we can't early bind.
                    Slot base_slot = node.baseref.getSlot(node.cx, node.baseref.getKind());
                    if( base_slot.isImported() && type != cx.noType() ) //Ok if it's object, doesn't have any methods...
                    {
                        ((InstanceBuilder)node.iframe.builder).canEarlyBind = false;
                    }

                    // inherit protected namespaces
                    ClassBuilder classBuilder;
                    while( type != null && type != node.cframe && type.resolved)
                    {
                        classBuilder = (ClassBuilder) type.builder;
                        if( classBuilder.static_protected_namespace != null )
                        {
                            node.used_namespaces.push_back(classBuilder.static_protected_namespace);
                            node.used_def_namespaces.push_back(classBuilder.static_protected_namespace);
                        }

                        type = type.baseclass;
                    }
                }
            }

            if (node.interfaces != null && node.interfaces.values != null)
            {
                ObjectList<ReferenceValue> interface_refs = ((InstanceBuilder)node.iframe.builder).interface_refs;

                HashSet<TypeValue> seen_interfs = new HashSet<TypeValue>();
                for (int i = 0; i < node.interfaces.values.size(); ++i )
                {
                    Value v = node.interfaces.values.get(i);
                    if (v instanceof ReferenceValue)
                    {
                        ReferenceValue ref = (ReferenceValue) v;
                        Value v2 = v.getValue(cx);
                        TypeValue t = ((v2 instanceof TypeValue) ? (TypeValue)v2 : null);

                        if (t == null )
                        {
                            cx.error(node.interfaces.items.get(i).pos(), kError_UnknownInterface, ref.name);
                        }
                        else
                        {
                            if (t.builder instanceof ClassBuilder)
                            {
                                if (!(((ClassBuilder)t.builder).is_interface))
                                {
                                    cx.error(node.interfaces.items.get(i).pos(), kError_CannotExtendClass, ref.name);
                                }
                                else
                                {
                                    if( seen_interfs.contains(t) )
                                    {
                                        cx.error(node.interfaces.items.get(i).pos(), kError_DuplicateImplements, node.ref.name, ref.name);
                                    }
                                    else
                                    {
                                        seen_interfs.add(t);
                                    }
                                    interface_refs.push_back(ref);

                                    if (node instanceof InterfaceDefinitionNode)
                                    {
                                        // If this is an interface, inherit the super-interface slots.
                                        inheritClassSlots(node.cframe, node.iframe, t, cx);
                                    }
                                }
                            }
                            else
                            {
                                cx.error(node.interfaces.items.get(i).pos(), kError_UnknownInterface, ref.name);
                            }
                        }
                    }
                    else
                    {
                        // uh oh, didn't resolve to anything, but we have a baseclass expression
                        cx.error(node.interfaces.items.get(i).pos(), kError_InvalidInterfaceTypeExpression);
                    }
                }
            }

            Names lastInterfaceMethods = interfaceMethods;
            interfaceMethods = null;

            scanInterfaceMethods(cx, node);
            processInterfacePublicMethods(cx, node.iframe);

            StartClass(node.ref.name);

            ObjectList<String> namespace_ids = new ObjectList<String>();
            if( node.namespaces.size() != 0 )
            {
                namespace_ids.push_back(node.namespaces.back().name);
            }
            else
            {
                namespace_ids.push_back("error");
            }

            region_name_stack.push_back(cx.debugName(region_name_stack.back(),node.ref.name,namespace_ids,EMPTY_TOKEN));

            /*
                node->used_namespaces = *used_namespaces_sets.back()  // save alias of outer namespaces
                ...
                node->used_namespaces.push_back(node->private_namespace);  // add implicitly used namespaces
                ...
                usednamespaces_sets.back(&node->used_namespaces)          // add current namespaces to nss sets
                ...
                used_namespaces get deleted
            */

            private_namespaces.push_back(node.private_namespace);
            default_namespaces.push_back(node.default_namespace);
            public_namespaces.push_back(node.public_namespace);
            protected_namespaces.push_back(node.protected_namespace);
            static_protected_namespaces.push_back(node.static_protected_namespace);

            cx.pushStaticClassScopes(node);

            this_contexts.removeLast();
            this_contexts.add(cinit_this);

            // Function expressions that occur in the current block will be
            // compiled as though they had occured at the end of the block.
            // The variable that references them is initialized at the beginning
            // of the block.

            fexprs_sets.add(new ObjectList<FunctionCommonNode>());
            staticfexprs_sets.add(new ObjectList<FunctionCommonNode>());
            instanceinits_sets.add(new ObjectList<Node>());

            // Copy the set of nested functions into the node for use
            // by later phases.

            node.fexprs = fexprs_sets.last();
            node.instanceinits = instanceinits_sets.last();    // Holds the static initializers for this class
            node.staticfexprs = staticfexprs_sets.last();    // Holds the static initializers for this class

            fun_name_stack.add(node.ref.name);    // During flow analysis we use the class name
            max_params_stack.add(0);
            max_locals_stack.add(node.var_count);
            max_temps_stack.add(node.temp_count);

            StartMethod(fun_name_stack.last(), max_params_stack.last(), max_locals_stack.last());

            if (node.statements != null)
            {
                // Evaluate the statements. When we are done, the static names
                // are in the class object builder. The static initializers are
                // in the inner staticdefs_sets sets. The instance names are in
                // the instance object builder, and the instance initializers
                // are in the

                node.statements.evaluate(cx, this);
                node.temp_count = getTempCount();
                node.var_count = node.cframe.var_count;
            }
            else
            {
                StartMethod(fun_name_stack.last(), max_params_stack.last(), max_locals_stack.last());
            }

            node.temp_count = getTempCount(); // Remember the temp count

      //            Return(TYPE_none);
      Return(TYPE_void);
      FinishMethod(cx, fun_name_stack.back(), null,null,null,0, cx.getScopes().size(), "",false,false, null);

            cx.pushScope(node.iframe);

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

            // Evaluate the instance initializers
            // (This must be done before we add the default
            //  constructor if needed, because this is where
            //  has_ctor gets set)
            {
                for (Node n : node.instanceinits)
                {
                  if( cx.statics.es4_nullability  && !n.isDefinition())
                    node.iframe.setInitOnly(true);

                  n.evaluate(cx, this);

                  if( cx.statics.es4_nullability  && !n.isDefinition())
                    node.iframe.setInitOnly(false);

                }
            }

            ObjectValue     obj = node.iframe;
            InstanceBuilder bui = ((obj.builder instanceof InstanceBuilder) ? (InstanceBuilder)obj.builder : null);

            if( !bui.is_intrinsic && !bui.has_ctor )
            {
                NodeFactory nf = cx.getNodeFactory();

                FunctionNameNode fname = nf.functionName(EMPTY_TOKEN, nf.identifier(node.ref.name,0));

                nf.has_rest = false;
                nf.has_arguments = false;

                FunctionCommonNode fexpr = nf.functionCommon(cx, fname.identifier, nf.functionSignature(null, null, 0), null, 0);
                AttributeListNode attrs = nf.attributeList(nf.identifier(PUBLIC,false,0),null);
                attrs.evaluate(cx,this);
                FunctionDefinitionNode fdef = nf.functionDefinition(cx, attrs, fname, fexpr);
                fdef.pkgdef = node.pkgdef;
                fdef.evaluate(cx,this);
                Node init = fdef.initializerStatement(cx);
                init.evaluate(cx,this);
                if( null == node.statements )
                {
                    node.statements = nf.statementList(null,init);
                }
                else
                {
                    node.statements.items.add(0,init);
                }
            }

            // Now turn the static names into definitions


            // Generate code for the static property definitions

            {
                this_contexts.add(error_this);
                cx.popScope(); // temporarily
                for (Node n : node.staticfexprs)
                {
                    n.evaluate(cx, this);
                }
                cx.pushScope(node.iframe);
                this_contexts.removeLast();
            }


            fun_name_stack.removeLast();
            max_params_stack.removeLast();
            max_locals_stack.removeLast();
            max_temps_stack.removeLast();

            // Now evaluate each function expression
            {
                for (FunctionCommonNode n : node.fexprs)
                {
                    n.evaluate(cx, this);
                }
            }

            // Remove the top set of nested functions from the stack of sets

            fexprs_sets.removeLast();

            //ASSERT(fexprs_sets.size() == 0);

            private_namespaces.pop_back();
            default_namespaces.pop_back();
            public_namespaces.pop_back();
            protected_namespaces.pop_back();
            static_protected_namespaces.pop_back();
            usednamespaces_sets.pop_back();
            used_def_namespaces_sets.pop_back();
            importednames_sets.pop_back();

            FinishClass(cx,node.cframe.builder.classname,null,false, false, false, node.cframe.is_nullable);

            this_contexts.removeLast();

            // pop the iframe now so we process class defs in static scope
            cx.popScope(); // iframe

            // Now evaluate each class definition

            {

                // node.clsdefs have the baseclass.cframe resolved, i.e. we've got fully-qualified class names.
                // sort the class names based on "extends" and "implements"...
                node.clsdefs = sortClassDefinitions(node.cx, node.clsdefs);

                if (found_circular_or_duplicate_class_definition == false)
                {
                    for (ClassDefinitionNode clsdef : node.clsdefs)
                    {
                        clsdef.evaluate(cx,this);
                    }
                }
            }

            // Remove the top set of nested classes from the stack of sets

            instanceinits_sets.removeLast();
            staticfexprs_sets.removeLast();

            cx.popStaticClassScopes(node);

            node.debug_name = region_name_stack.back();
            // store debug name on the slot as well.  asDoc needs fully qualified debug_names for all
            //  type references.
            Slot s = node.ref.getSlot(cx,GET_TOKEN);
            if (s != null)
            {
                s.setDebugName(node.debug_name);
                s.setConst(true); // class slots are const
            }

            region_name_stack.removeLast();
            strict_context.pop_back();

View Full Code Here

                            }
                        }
                    }
                }
            }
            Slot s = node.ref.getSlot(node.cx,GET_TOKEN);
            if (s != null)
            {
                s.setDebugName(node.debug_name);
                s.setConst(true); // class slots are const
            }

            Names lastInterfaceMethods = interfaceMethods;
            interfaceMethods = null;
View Full Code Here

    public Value evaluate(Context cx, InterfaceDefinitionNode node)
    {
        Value val = this.evaluate(cx, (ClassDefinitionNode) node);
        ReferenceValue ref = ((val instanceof ReferenceValue) ? (ReferenceValue)val : null);
        Slot slot = ref!=null?ref.getSlot(cx):null;
        if( slot == null )
        {
            cx.internalError(node.pos(), "internal error in FA::InterfaceDefinitionNode has no slot");
            return null;
        }
        slot.setImplNode(node)// use this to validate class definitions during CE
        ((ClassBuilder)node.cframe.builder).is_interface = true;

        // check state == Inheritance before checking.  Don't want to log errors twice
        if (node.attrs != null && node.state == ProgramNode.Inheritance)
        {
View Full Code Here

                    case Names.METHOD_NAMES:
                    {
                      assert !Builder.removeBuilderNames;
            int inherited_get_id  = baseobj.getSlotIndex(cx,GET_TOKEN,name,namespace);
                        int inherited_call_id = baseobj.getImplicitIndex(cx,inherited_get_id,EMPTY_TOKEN);
                        Slot inheritedSlot = baseobj.getSlot(cx,inherited_get_id);
                        Slot inheritedCallSlot = baseobj.getSlot(cx,inherited_call_id);

                        bui.InheritCall(cx,obj,name,namespace,inheritedSlot,inheritedCallSlot);
                        break;
                    }

                    case Names.GET_NAMES:
                    {
                        int slot_id = baseobj.getSlotIndex(cx,GET_TOKEN,name,namespace);
                        Slot slot = baseobj.getSlot(cx,slot_id);

                        if(slot == null || (limitToContext && slot.declaredBy != null && slot.declaredBy.builder.contextId != basebui.contextId))
                          break;

                        int implicit_id = baseobj.getImplicitIndex(cx,slot_id,EMPTY_TOKEN);
                        if(Builder.removeBuilderNames && slot_id != implicit_id && slot instanceof MethodSlot)
                        {
                          Slot inheritedCallSlot = baseobj.getSlot(cx,implicit_id);
                          bui.InheritCall(cx,obj,name,namespace,slot,inheritedCallSlot);
                          break;
                        }

                        if(Builder.removeBuilderNames && slot instanceof VariableSlot)
                        {
                          // hack propagated from VAR_NAMES case
                          // Hack
                          slot.setVarIndex(-1);

                          int index = slot.implies(cx,EMPTY_TOKEN);
                          Slot inheritedCallSlot = baseobj.getSlot(cx,index);

                          index = slot.implies(cx,NEW_TOKEN);
                          Slot inheritedConstructorSlot = baseobj.getSlot(cx,index);

                          bui.InheritVar(cx, obj, name, namespace, slot);

                          if (inheritedCallSlot != null)
                          {
                              obj.addSlot(inheritedCallSlot);
                          }

                          if (inheritedConstructorSlot != null)
                          {
                              obj.addSlot(inheritedConstructorSlot);
                          }
                        }

                        // skip non-public names, this isn't applied to methods so its down here
                      if(namespace != cx.publicNamespace())
                        {
                            break;
                        }

                        bui.InheritGet(cx,obj,name,namespace,slot);
                        break;
                    }

                    case Names.SET_NAMES:
                    {
                        // skip non-public names
                      if(namespace != cx.publicNamespace())
                        {
                            break;
                        }

                        int slot_id = baseobj.getSlotIndex(cx,SET_TOKEN,name,namespace);
                        Slot slot = baseobj.getSlot(cx,slot_id);

                        bui.InheritSet(cx,obj,name,namespace,slot);
                        break;
                    }

                    case Names.VAR_NAMES:
                    {
                      assert !Builder.removeBuilderNames;
                        int slot_id = baseobj.getSlotIndex(cx,VAR_TOKEN,name,namespace);
                        Slot inheritedSlot = baseobj.getSlot(cx,slot_id);

                        // Hack
                        inheritedSlot.setVarIndex(-1);

                        int index = inheritedSlot.implies(cx,EMPTY_TOKEN);
                        Slot inheritedCallSlot = baseobj.getSlot(cx,index);

                        index = inheritedSlot.implies(cx,NEW_TOKEN);
                        Slot inheritedConstructorSlot = baseobj.getSlot(cx,index);

                        bui.InheritVar(cx, obj, name, namespace, inheritedSlot);

                        if (inheritedCallSlot != null)
                        {
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.