<commit_before>/**
 * @license
 * Copyright 2017 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  refines: 'foam.core.Argument',
  flags: ['swift'],
  requires: [
    'foam.swift.Argument',
  ],
  properties: [
    {
      class: 'String',
      name: 'swiftLocalName',
      expression: function(name) { return name; },
    },
    {
      class: 'String',
      name: 'swiftExternalName',
      value: '_',
    },
    {
      class: 'String',
      name: 'swiftDefaultValue',
    },
    {
      class: 'StringArray',
      name: 'swiftAnnotations',
      preSet: function(_, n) {
        var i = n.indexOf('inout');
        if ( i != -1 ) {
          console.log('Warning: found "inout" in swiftAnnotations. Set swiftMutable instead.');
          n.splice(i, 1);
          this.swiftMutable = true;
        }
        return n;
      },
    },
    {
      class: 'Boolean',
      name: 'swiftMutable',
      expression: function(swiftAnnotations) {
        return swiftAnnotations.indexOf('inout') != -1;
      },
    },
    {
      class: 'String',
      name: 'swiftType',
      expression: function(of, optional) {
        of = foam.String.isInstance(of) ? foam.lookup(of, true) : of;
        return of ? of.model_.swiftName + (optional ? '?' : '') : 'Any?';
      },
    },
  ],
  methods: [
    function toSwiftArg() {
      var arg = this.Argument.create({
        localName: this.swiftLocalName,
        externalName: this.swiftExternalName,
        type: this.swiftType,
        annotations: this.swiftAnnotations,
        mutable: this.swiftMutable,
      });
      if (this.swiftDefaultValue) arg.defaultValue = this.swiftDefaultValue;
      return arg;
    },
  ]
});
<commit_msg>Remove unnecessary expression.<commit_after>/**
 * @license
 * Copyright 2017 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  refines: 'foam.core.Argument',
  flags: ['swift'],
  requires: [
    'foam.swift.Argument',
  ],
  properties: [
    {
      class: 'String',
      name: 'swiftLocalName',
      expression: function(name) { return name; },
    },
    {
      class: 'String',
      name: 'swiftExternalName',
      value: '_',
    },
    {
      class: 'String',
      name: 'swiftDefaultValue',
    },
    {
      class: 'StringArray',
      name: 'swiftAnnotations',
      preSet: function(_, n) {
        var i = n.indexOf('inout');
        if ( i != -1 ) {
          console.log('Warning: found "inout" in swiftAnnotations. Set swiftMutable instead.');
          n.splice(i, 1);
          this.swiftMutable = true;
        }
        return n;
      },
    },
    {
      class: 'Boolean',
      name: 'swiftMutable',
    },
    {
      class: 'String',
      name: 'swiftType',
      expression: function(of, optional) {
        of = foam.String.isInstance(of) ? foam.lookup(of, true) : of;
        return of ? of.model_.swiftName + (optional ? '?' : '') : 'Any?';
      },
    },
  ],
  methods: [
    function toSwiftArg() {
      var arg = this.Argument.create({
        localName: this.swiftLocalName,
        externalName: this.swiftExternalName,
        type: this.swiftType,
        annotations: this.swiftAnnotations,
        mutable: this.swiftMutable,
      });
      if (this.swiftDefaultValue) arg.defaultValue = this.swiftDefaultValue;
      return arg;
    },
  ]
});

{'fraction_non_alphanumeric': 0.15063253898205353, 'fraction_numerical': 0.005001471020888497, 'mean_word_length': 2.1192660550458715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3292096', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1056, 'n_words': 219}