Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Issue 851303002: dart2js: capture type variables in closures, if they are only used in literals. (Closed)

Created:
5 years, 11 months ago by floitsch
Modified:
5 years, 11 months ago
Reviewers:
asgerf, sra1
CC:
reviews_dartlang.org
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

dart2js: capture type variables in closures, if they are only used in literals. BUG= http://dartbug.com/22060 R=asgerf@google.com Committed: https://code.google.com/p/dart/source/detail?r=42989

Patch Set 1 #

Patch Set 2 : Fix test. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -0 lines) Patch
M pkg/compiler/lib/src/closure.dart View 1 chunk +12 lines, -0 lines 0 comments Download
A tests/language/type_variable_closure2_test.dart View 1 1 chunk +31 lines, -0 lines 1 comment Download

Messages

Total messages: 6 (2 generated)
floitsch
5 years, 11 months ago (2015-01-16 17:40:20 UTC) #2
asgerf
lgtm
5 years, 11 months ago (2015-01-19 10:01:52 UTC) #3
floitsch
Committed patchset #2 (id:20001) manually as 42989 (presubmit successful).
5 years, 11 months ago (2015-01-19 13:32:07 UTC) #4
sra1
5 years, 11 months ago (2015-01-20 20:25:30 UTC) #6
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/851303002/diff/20001/tests/language/ty...
File tests/language/type_variable_closure2_test.dart (right):

https://chromiumcodereview.appspot.com/851303002/diff/20001/tests/language/ty...
tests/language/type_variable_closure2_test.dart:20: }
Also add a function uses the type argument in an is-check

  check() {
    return (x) => x is T;
  }

and in type assertion positions.

  validate1() {
    return (x) { T y = x; }
  }

  validate2() {
    return (T x) { }
  }

  validate3() {
    T foo(x) => x;
    return foo;
  }

You would only use these in checked mode

bool get inCheckedMode {
  bool checked = false;
  assert(checked = true);
  return checked;
}

Powered by Google App Engine
This is Rietveld 408576698