Examples of TypeContext


Examples of flexjson.TypeContext

public class ArrayTransformer extends AbstractTransformer
{

  public void transform(Object object)
  {
    TypeContext typeContext= getContext().writeOpenArray();
    int length= Array.getLength(object);
    for (int i= 0; i < length; ++i)
    {
      if (!typeContext.isFirst())
        getContext().writeComma();
      typeContext.setFirst(false);
      getContext().transform(Array.get(object, i));
    }
    getContext().writeCloseArray();
  }
View Full Code Here

Examples of jetbrick.template.parser.grammer.JetTemplateParser.TypeContext

        SegmentCode code = (SegmentCode) ctx.expression().accept(this);

        boolean defining = false; // 是否同时定义一个变量

        TypedKlass lhs = null; // 变量类型
        TypeContext type = ctx.type();
        if (type != null) {
            defining = true;
            // 定义一个变量
            SegmentCode c = (SegmentCode) type.accept(this);
            lhs = c.getTypedKlass();
            if (!scopeCode.define(name, lhs)) {
                throw reportError("Duplicate local variable " + name, ctx.IDENTIFIER());
            }
        } else {
View Full Code Here

Examples of jetbrick.template.parser.grammer.JetTemplateParser.TypeContext

        String name = ctx.IDENTIFIER().getText();
        SegmentCode code = (SegmentCode) ctx.expression().accept(this);
        assert_not_void_expression(code);

        TypedKlass resultKlass = null;
        TypeContext type = ctx.type();
        if (type != null) {
            // 手动定义返回变量的类型
            SegmentCode c = (SegmentCode) type.accept(this);
            resultKlass = c.getTypedKlass();
        } else {
            // 根据 expression 来进行自动类型推导
            Class<?> rhsKlass = code.getKlass();
            if (rhsKlass.isArray()) {
View Full Code Here

Examples of jetbrick.template.parser.grammer.JetTemplateParser.TypeContext

        return code;
    }

    @Override
    public Code visitType_name(Type_nameContext ctx) {
        TypeContext type = ctx.type();
        if (type != null) {
            return type.accept(this);
        }

        // List<?>
        return new SegmentCode(TypedKlass.WildcharTypedKlass, "?", ctx);
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.context.TypeContext

        ModuleDeclaration moduleDeclaration = SourceParserUtil
            .getModuleDeclaration(type.getSourceModule(), null);
        FileContext fileContext = new FileContext(
            type.getSourceModule(), moduleDeclaration, offset);
        TypeContext typeContext = new TypeContext(fileContext,
            classType);
        PHPTypeInferencer typeInferencer = new PHPTypeInferencer();

        if (!propertyName.startsWith(DOLLAR)) {
          propertyName = DOLLAR + propertyName;
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.context.TypeContext

  public IGoal[] init() {
    ClassVariableDeclarationGoal typedGoal = (ClassVariableDeclarationGoal) goal;
    IType[] types = typedGoal.getTypes();

    if (types == null) {
      TypeContext context = (TypeContext) typedGoal.getContext();
      types = PHPTypeInferenceUtils.getModelElements(
          context.getInstanceType(), context);
    }
    if (types == null) {
      return null;
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.context.TypeContext

    super(goal);
  }

  public IGoal[] init() {
    PHPDocClassVariableGoal typedGoal = (PHPDocClassVariableGoal) goal;
    TypeContext context = (TypeContext) typedGoal.getContext();
    String variableName = typedGoal.getVariableName();
    int offset = typedGoal.getOffset();

    IModelAccessCache cache = context.getCache();
    IType[] types = PHPTypeInferenceUtils.getModelElements(
        context.getInstanceType(), context, offset, cache);
    Map<PHPDocBlock, IField> docs = new HashMap<PHPDocBlock, IField>();

    if (types != null) {
      for (IType type : types) {
        try {
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.context.TypeContext

    // we've evaluated receiver, lets evaluate the method return type now
    // (using PHPDoc first):
    if (state == STATE_GOT_RECEIVER) {
      state = STATE_WAITING_FIELD_PHPDOC;
      TypeContext typeContext = new TypeContext(
          (ISourceModuleContext) goal.getContext(), receiverType);
      if (goal.getContext() instanceof IModelCacheContext) {
        typeContext.setCache(((IModelCacheContext) goal.getContext())
            .getCache());
      }
      return new IGoal[] { new PHPDocClassVariableGoal(typeContext,
          variableName, offset) };
    }

    if (state == STATE_WAITING_FIELD_PHPDOC) {
      if (goalState != GoalState.PRUNED && previousResult != null
          && previousResult != UnknownType.INSTANCE) {
        result = previousResult;
        return null;
      }
      state = STATE_WAITING_FIELD;
      TypeContext typeContext = new TypeContext(
          (ISourceModuleContext) goal.getContext(), receiverType);
      if (goal.getContext() instanceof IModelCacheContext) {
        typeContext.setCache(((IModelCacheContext) goal.getContext())
            .getCache());
      }
      return new IGoal[] { new ClassVariableDeclarationGoal(typeContext,
          variableName) };
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.