Package wyvern.targets.Common.wyvernIL.interpreter.core

Examples of wyvern.targets.Common.wyvernIL.interpreter.core.BytecodeContextImpl


    return context;
  }

  @Override
  public BytecodeContext visit(ClassDef classDef) {
    BytecodeContext newContext = new BytecodeContextImpl(evalContext);
    List<Definition> classDefs = classDef.getClassDefinitions();
    List<Definition> defs = classDef.getDefinitions();
    for(Definition def : classDefs) {
      newContext = def.accept(new BytecodeDefVisitor(newContext));
    }
View Full Code Here


    List<Definition> defs = aNew.getDefs();
    BytecodeValue thisObject = context.getValue("this").dereference();
    BytecodeClass newClass;
    if(thisObject != null) {
      BytecodeClassDef thisClass = (BytecodeClassDef) thisObject;
      newContext = new BytecodeContextImpl(thisClass.getContext());
      newClass = (BytecodeClass) thisClass.getCompleteClass();
    } else {
      newContext = context;
      newClass = new BytecodeClass(newContext);
    }
    BytecodeContext tempContext = new BytecodeContextImpl(context);
    for(Definition def : defs) {
      def.accept(new BytecodeDefVisitor(newClass.getContext(),tempContext));
    }
    return newClass;
  }
View Full Code Here

   * and returns it
   * @return
   *     a bytecodeClass representing the full class instance
   */
  public BytecodeValue getCompleteClass() { 
    BytecodeContext context = new BytecodeContextImpl(coreContext);
    BytecodeFunction init = (BytecodeFunction) context.getValue("$init");
    init.run(new ArrayList<BytecodeValue>(), context);
    for(Definition def : defs) {
      context = def.accept(new BytecodeDefVisitor(context));
    }
    return new BytecodeClass(context);
View Full Code Here

    body = bodyStmts;
    params = new ArrayList<String>();
    for (Param param : parameters) {
      params.add(param.getName());
    }
    coreContext = new BytecodeContextImpl(context);
    if(! name.equals("$init")) {
      isInit = false;
      coreContext.addToContext(name, this);
      coreContext.addToContext("this",new BytecodeRef(null));
    } else {
View Full Code Here

   * @param args
   *            the arguments associated with the call to the function
   * @return the final result of the function's execution
   */
  public BytecodeValue run(List<BytecodeValue> args) {
    BytecodeContext context = new BytecodeContextImpl(coreContext);
    return run(args,context);
  }
View Full Code Here

  public BytecodeValue run(List<BytecodeValue> args, BytecodeContext ctx) {
    BytecodeContext context;
    if(isInit) {
      context = ctx;
    } else {
      context = new BytecodeContextImpl(coreContext);
    }
    for (int i = 0; i < args.size(); i++) {
      BytecodeValue val = args.get(i);
      String name = params.get(i);
      context.addToContext(name, val);
View Full Code Here

  public void setUp() throws Exception {
    Mod = "def mod(num : Int, over : Int)  : Int    \n"
    +   "  num - (over * (num / over))          \n";
    List<Param> params = new ArrayList<Param>();
    List<Statement> statements = new ArrayList<Statement>();
    func = new BytecodeFunction(params,statements,new BytecodeContextImpl(), "");
    clas = new BytecodeClass(new BytecodeContextImpl());
    clasDef = new BytecodeClass(new BytecodeContextImpl());
    empty = new BytecodeEmptyVal();
    setupList();
  }
View Full Code Here

TOP

Related Classes of wyvern.targets.Common.wyvernIL.interpreter.core.BytecodeContextImpl

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.