<commit_before>class Stage extends core.DisposableImpl implements IElementParent {
  final CanvasElement _canvas;
  final PElement _element;
  final core.EventHandle<core.EventArgs> _updatedEventHandle;
  CanvasRenderingContext2D _ctx;

  Stage(this._canvas, this._element) :
    _updatedEventHandle = new core.EventHandle<core.EventArgs>()
  {
    _element.claim(this);
  }

  core.Size get size() => new core.Size(_canvas.width, _canvas.height);

  core.EventRoot<core.EventArgs> get updated() => _updatedEventHandle;

  PElement get rootElement() => _element;

  CanvasRenderingContext2D get ctx(){
    if (_ctx == null) {
      _ctx = _canvas.getContext('2d');
    }
    return _ctx;
  }

  bool draw(){
    if (_ctx == null) {
      _ctx = _canvas.getContext('2d');
    } else {
      this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
    }

    return this._element.draw(this._ctx);
  }

  void childInvalidated(PElement child){
    _updatedEventHandle.fireEvent(this, const core.EventArgs());
  }

  void disposeInternal(){
    super.disposeInternal();
    _updatedEventHandle.dispose();
  }

  core.AffineTransform getTransformToRoot() => new core.AffineTransform();<commit_msg>Stage: turns out there is a canvas2d member on CanvasElement<commit_after>class Stage extends core.DisposableImpl implements IElementParent {
  final CanvasElement _canvas;
  final PElement _element;
  final core.EventHandle<core.EventArgs> _updatedEventHandle;
  CanvasRenderingContext2D _ctx;

  Stage(this._canvas, this._element) :
    _updatedEventHandle = new core.EventHandle<core.EventArgs>() {
    _element.claim(this);
  }

  core.Size get size() => new core.Size(_canvas.width, _canvas.height);

  core.EventRoot<core.EventArgs> get updated() => _updatedEventHandle;

  PElement get rootElement() => _element;

  CanvasRenderingContext2D get ctx() {
    if(_ctx == null) {
      _ctx = _canvas.context2d;
    }
    return _ctx;
  }

  bool draw(){
    if (_ctx == null) {
      _ctx = _canvas.context2d;
    } else {
      this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
    }

    return this._element.draw(this._ctx);
  }

  void childInvalidated(PElement child){
    _updatedEventHandle.fireEvent(this, const core.EventArgs());
  }

  void disposeInternal(){
    super.disposeInternal();
    _updatedEventHandle.dispose();
  }

  core.AffineTransform getTransformToRoot() => new core.AffineTransform();
{'fraction_non_alphanumeric': 0.11685116851168512, 'fraction_numerical': 0.005330053300533005, 'mean_word_length': 3.959349593495935, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4590344', 'n_tokens_mistral': 768, 'n_tokens_neox': 743, 'n_words': 157}