コード例 #1
0
 @Override
 public AstNode object(Iterable<NameValue<AstNode>> props) {
   ObjectLiteral object = new ObjectLiteral();
   for (NameValue<AstNode> prop : props) {
     object.addElement(objectProperty(prop.getName(), prop.getValue()));
   }
   return object;
 }
コード例 #2
0
 @Override
 public AstNode variableDeclaration(boolean statement, Iterable<NameValue<AstNode>> vars) {
   VariableDeclaration varDecl = new VariableDeclaration();
   varDecl.setIsStatement(statement);
   for (NameValue<AstNode> v : vars) {
     VariableInitializer var = new VariableInitializer();
     var.setTarget(name(v.getName()));
     var.setInitializer(v.getValue());
     varDecl.addVariable(var);
   }
   return varDecl;
 }