public object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) { B.Constructor m = new B.Constructor(GetLexicalInfo(constructorDeclaration)); m.Modifiers = ConvertModifier(constructorDeclaration, B.TypeMemberModifiers.Private); ConvertAttributes(constructorDeclaration.Attributes, m.Attributes); if (currentType != null) { currentType.Members.Add(m); } ConvertParameters(constructorDeclaration.Parameters, m.Parameters); m.EndSourceLocation = GetEndLocation((INode)constructorDeclaration.Body ?? constructorDeclaration); m.Body = ConvertMethodBlock(constructorDeclaration.Body); ConstructorInitializer ci = constructorDeclaration.ConstructorInitializer; if (ci != null && !ci.IsNull) { B.Expression initializerBase; if (ci.ConstructorInitializerType == ConstructorInitializerType.Base) { initializerBase = new B.SuperLiteralExpression(); } else { initializerBase = new B.SelfLiteralExpression(); } B.MethodInvocationExpression initializer = new B.MethodInvocationExpression(initializerBase); ConvertExpressions(ci.Arguments, initializer.Arguments); m.Body.Insert(0, new B.ExpressionStatement(initializer)); } return(m); }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { base.OnSuperLiteralExpression(node); if (node.IsTargetOfMethodInvocation()) { OnExpression(node); } }
override public object Clone() { SuperLiteralExpression clone = new SuperLiteralExpression(); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._isSynthetic = _isSynthetic; clone._entity = _entity; if (_annotations != null) { clone._annotations = (Hashtable)_annotations.Clone(); } clone._expressionType = _expressionType; return(clone); }
override public object Clone() { SuperLiteralExpression clone = (SuperLiteralExpression)FormatterServices.GetUninitializedObject(typeof(SuperLiteralExpression)); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._entity = _entity; if (_annotations != null) { clone._annotations = (Hashtable)_annotations.Clone(); } clone._expressionType = _expressionType; return(clone); }
override public void OnSuperLiteralExpression(SuperLiteralExpression node) { var externalSelf = CodeBuilder.CreateReference(node.LexicalInfo, ExternalEnumeratorSelf()); if (AstUtil.IsTargetOfMethodInvocation(node)) // super(...) ReplaceCurrentNode(CodeBuilder.CreateMemberReference(externalSelf, (IMethod)GetEntity(node))); else // super.Method(...) ReplaceCurrentNode(externalSelf); }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { _il.Emit(OpCodes.Ldarg_0); if (node.ExpressionType.IsValueType) { _il.Emit(OpCodes.Ldobj, GetSystemType(node.ExpressionType)); } PushType(node.ExpressionType); }
//throws RecognitionException, TokenStreamException protected SuperLiteralExpression super_literal() { SuperLiteralExpression e; IToken t = null; e = null; try { // for error handling t = LT(1); match(SUPER); if (0==inputState.guessing) { e = new SuperLiteralExpression(SourceLocationFactory.ToLexicalInfo(t)); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_36_); } else { throw ex; } } return e; }
override public void OnSuperLiteralExpression(SuperLiteralExpression node) { LoadSelf(node); }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { if (callingClass == null) ClearResult(); else MakeResult(callingClass.BaseType); }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { if (AstUtil.IsTargetOfMethodInvocation(node)) return; if (AstUtil.IsTargetOfMemberReference(node)) return; Error(CompilerErrorFactory.InvalidSuper(node)); }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { _expression = new CodeBaseReferenceExpression(); }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { WriteKeyword("super"); }
override public object Clone() { SuperLiteralExpression clone = new SuperLiteralExpression(); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._isSynthetic = _isSynthetic; clone._entity = _entity; if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone(); clone._expressionType = _expressionType; return clone; }
public SuperLiteralExpression CreateSuperReference(IType super) { SuperLiteralExpression expression = new SuperLiteralExpression(); expression.ExpressionType = super; return expression; }
public SuperLiteralExpression super_literal() { SuperLiteralExpression expression = null; IToken token = null; try { token = this.LT(1); this.match(0x27); if (base.inputState.guessing == 0) { expression = new SuperLiteralExpression(ToLexicalInfo(token)); } } catch (RecognitionException exception) { if (base.inputState.guessing != 0) { throw; } this.reportError(exception); this.recover(exception, tokenSet_20_); return expression; } return expression; }
protected SuperLiteralExpression super_literal() //throws RecognitionException, TokenStreamException { SuperLiteralExpression e; IToken t = null; e = null; try { // for error handling t = LT(1); match(SUPER); if (0==inputState.guessing) { e = new SuperLiteralExpression(ToLexicalInfo(t)); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex, "super_literal"); recover(ex,tokenSet_44_); } else { throw ex; } } return e; }
public override void OnSuperLiteralExpression(SuperLiteralExpression node) { if (!AstUtil.IsTargetOfMethodInvocation(node)) { node.ExpressionType = _currentMethod.DeclaringType.BaseType; return; } if (EntityType.Constructor == _currentMethod.EntityType) { // TODO: point to super ctor node.Entity = _currentMethod; return; } if (null == _currentMethod.Overriden) { Error(node, CompilerErrorFactory.MethodIsNotOverride(node, _currentMethod)); return; } node.Entity = _currentMethod.Overriden; }
public object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) { B.Constructor m = new B.Constructor(GetLexicalInfo(constructorDeclaration)); m.Modifiers = ConvertModifier(constructorDeclaration, B.TypeMemberModifiers.Private); ConvertAttributes(constructorDeclaration.Attributes, m.Attributes); if (currentType != null) currentType.Members.Add(m); ConvertParameters(constructorDeclaration.Parameters, m.Parameters); m.EndSourceLocation = GetEndLocation((INode)constructorDeclaration.Body ?? constructorDeclaration); m.Body = ConvertMethodBlock(constructorDeclaration.Body); ConstructorInitializer ci = constructorDeclaration.ConstructorInitializer; if (ci != null && !ci.IsNull) { B.Expression initializerBase; if (ci.ConstructorInitializerType == ConstructorInitializerType.Base) initializerBase = new B.SuperLiteralExpression(); else initializerBase = new B.SelfLiteralExpression(); B.MethodInvocationExpression initializer = new B.MethodInvocationExpression(initializerBase); ConvertExpressions(ci.Arguments, initializer.Arguments); m.Body.Insert(0, new B.ExpressionStatement(initializer)); } return m; }