<commit_before>// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// IrNodes are kept in a separate library to have precise control over their
// dependencies on other parts of the system.
library dart2js.ir_nodes;

import '../dart2jslib.dart' show Constant;
import 'ir_pickler.dart' show Pickler;

/**
 * A pair of source offset and an identifier name. Identifier names are used in
 * the Javascript backend to generate source maps.
 */
class PositionWithIdentifierName {
  final int offset;
  final String sourceName;
  PositionWithIdentifierName(this.offset, this.sourceName);
}

abstract class IrNode {
  final /* int | PositionWithIdentifierName */ position;

  const IrNode(this.position);

  int get offset => (position is int) ? position : position.offset;

  String get sourceName => (position is int) ? null : position.sourceName;

  List<int> pickle() => new Pickler().pickle(this);

  accept(IrNodesVisitor visitor);
}

class IrFunction extends IrNode {
  final List<IrNode> statements;<commit_msg>incremental hash codes for ir nodes<commit_after>// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// IrNodes are kept in a separate library to have precise control over their
// dependencies on other parts of the system.
library dart2js.ir_nodes;

import '../dart2jslib.dart' show Constant;
import 'ir_pickler.dart' show Pickler;

/**
 * A pair of source offset and an identifier name. Identifier names are used in
 * the Javascript backend to generate source maps.
 */
class PositionWithIdentifierName {
  final int offset;
  final String sourceName;
  PositionWithIdentifierName(this.offset, this.sourceName);
}

abstract class IrNode {
  static int hashCount = 0;
  final int hashCode = hashCount = (hashCount + 1) & 0x3fffffff;

  final /* int | PositionWithIdentifierName */ position;

  const IrNode(this.position);

  int get offset => (position is int) ? position : position.offset;

  String get sourceName => (position is int) ? null : position.sourceName;

  List<int> pickle() => new Pickler().pickle(this);

  accept(IrNodesVisitor visitor);
}

class IrFunction extends IrNode {
  final List<IrNode> statements;
{'fraction_non_alphanumeric': 0.08549432739059967, 'fraction_numerical': 0.006482982171799027, 'mean_word_length': 4.154488517745302, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '4041430', 'n_tokens_mistral': 704, 'n_tokens_neox': 671, 'n_words': 287}