public AbcScript DefineNamespaceScript(AbcNamespace ns, string name) { if (ns == null) { throw new ArgumentNullException("ns"); } var script = _nsscripts[name] as AbcScript; if (script != null) { return(script); } ns = ImportConst(ns); var traitName = DefineName(QName.Global(name)); script = new AbcScript { Initializer = DefineEmptyMethod() }; _nsscripts[name] = script; script.Traits.AddConst(BuiltinTypes.Namespace, traitName, ns); return(script); }
public void ImportScript(AbcScript from) { var script = new AbcScript(); Scripts.Add(script); script.Initializer = ImportMethod(from.Initializer); ImportTraits(from, script); }
public void DefineEmptyScript() { var script = new AbcScript { Initializer = DefineEmptyMethod() }; Scripts.Add(script); }
public void DefineScript(IEnumerable <AbcInstance> instances, Predicate <AbcInstance> filter) { var script = new AbcScript(); Scripts.Add(script); script.DefineClassTraits(instances, filter); DefineScriptInit(script); }
public void DefineScriptInit(AbcScript script) { script.Initializer = DefineMethod( Sig.@void(), code => { code.PushThisScope(); code.InitClassProperties(script); code.ReturnVoid(); } ); }
static int CompareScriptInstances(AbcScript s1, AbcScript s2) { var i1 = s1.SingleInstance; var i2 = s2.SingleInstance; if (i1 == null) { if (i2 != null) { return(-1); } return(s1.Index - s2.Index); } if (i2 == null) { return(-1); } return(i1.Index - i2.Index); }
/// <summary> /// Determines whether the given <see cref="AbcScript"/> is defined in this ABC file. /// </summary> /// <param name="script">script to check</param> /// <returns></returns> public bool IsDefined(AbcScript script) { return(Scripts.IsDefined(script)); }