コード例 #1
0
 private List<Variable> parseArguments(
     SimpleDartWithArraysParser.FunctionDeclarationContext function) {
   List<Variable> args = new ArrayList<>();
   SimpleDartWithArraysParser.VariableListContext variableListContext =
       function.functionParameters().variableList();
   if (variableListContext != null) {
     for (SimpleDartWithArraysParser.VariableContext argContext : variableListContext.variable()) {
       String argName = argContext.IDENT().getText();
       ValueType argValueType = ValueType.fromString(argContext.variableType().getText());
       Variable arg = new VariableImpl(argName, argValueType);
       args.add(arg);
     }
   }
   return args;
 }
コード例 #2
0
 private Function buildFunction(SimpleDartWithArraysParser.FunctionDeclarationContext function) {
   String name = function.IDENT().getText();
   ValueType returnValueType = ValueType.fromString(function.typeIdentifier().getText());
   List<Variable> args = parseArguments(function);
   return new FunctionImpl(name, returnValueType, args);
 }