public override int doFinalize() { int errCount = 0; foreach (var it in this.parentIdents) { errCount += it.finalize(); } if (errCount == 0) { foreach (var it in this.parentIdents) { Native nClass = (Native)it.LastIdent.ReferencedObject; foreach (var child in nClass.children) { if (child is NativeFunction) { var nf = (NativeFunction)child; var nf2 = new NativeFunction(this, nf.Line, nf.Pos, nf.File); nf2.Code = nf.Code; nf2.IsSimple = nf.IsSimple; for (int i = 1; i < nf.children.Count; i++) { nf2.addChild(nf.children[i]); } nf2.VTO = new VarTypeObject(nf.VTO); nf2.Name = new Ident(this, nf.Name.OriginalValue, nf.Name.Line, nf.Name.Pos, nf.Name.File); this.addChild(nf2); nf2.finalize(); } else if (child is NativeOperator) { var no = (NativeOperator)child; var no2 = new NativeOperator(this, no.Line, no.Pos, no.File); no2.Code = no.Code; no2.IsSimple = no.IsSimple; for (int i = 1; i < no.children.Count; i++) { no2.addChild(no.children[i]); } no2.OperatorType = no.OperatorType; no2.VTO = new VarTypeObject(no.VTO); no2.Name = new Ident(this, no.Name.OriginalValue, no.Name.Line, no.Name.Pos, no.Name.File); this.addChild(no2); no2.finalize(); } } } } return(errCount); }
void NATIVEOPERATOR(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new NativeOperator(parent, t.line, t.col); outObj = obj; pBaseLangObject blo; VarType v; Expect(51); if (la.kind == 45) { Get(); obj.IsSimple = true; } if (StartOf(2)) { VARTYPE(out v); obj.VTO = new VarTypeObject(v); } else if (la.kind == 48) { Get(); obj.VTO = new VarTypeObject(VarType.Void); } else if (StartOf(12)) { bool isStrict = false; if (la.kind == 49) { Get(); isStrict = true; } IDENTACCESS(out blo, obj, false); obj.VTO = new VarTypeObject((Ident)blo, isStrict); if (la.kind == 21) { Template te; TEMPLATE(out te, outObj); obj.VTO.TemplateObject = te; } } else SynErr(96); if (la.kind == 12) { Get(); Expect(13); obj.OperatorType = OverridableOperator.ArrayAccess; } else if (StartOf(5)) { if (la.kind == 5) { Get(); switch(t.val) { case "===": obj.OperatorType = OverridableOperator.ExplicitEquals; break; default: SemErr("The operator '" + t.val + "' is not supported for override"); break; } } else if (la.kind == 23) { Get(); SemErr("The operator '" + t.val + "' is not supported for override"); } else if (la.kind == 21) { Get(); Expect(21); SemErr("The operator '" + t.val + "' is not supported for override"); } else { Get(); Expect(22); SemErr("The operator '" + t.val + "' is not supported for override"); } } else SynErr(97); Expect(10); if (StartOf(13)) { NEWVARIABLE(out blo, obj); obj.addChild(blo); while (la.kind == 18) { Get(); NEWVARIABLE(out blo, obj); obj.addChild(blo); } } Expect(11); while (StartOf(17)) { Get(); obj.Code += t.val + (la.val == ";" ? "" : " "); } Expect(52); obj.Code = obj.Code.Trim(); }