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

Issue 9616058: Implement parsing and resolving of type-variables. (Closed)

Created:
8 years, 9 months ago by karlklose
Modified:
8 years, 9 months ago
Reviewers:
ahe, ngeoffray
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement parsing and resolving of type-variables. Committed: https://code.google.com/p/dart/source/detail?r=5572

Patch Set 1 #

Patch Set 2 : Complete the implementation. #

Patch Set 3 : Refactor. #

Patch Set 4 : Rebase #

Patch Set 5 : Fix merge error. #

Total comments: 21

Patch Set 6 : Fix merge error. #

Total comments: 22

Patch Set 7 : Address review comments. #

Patch Set 8 : Address comments. #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+231 lines, -92 lines) Patch
M frog/leg/elements/elements.dart View 1 2 3 4 5 6 7 chunks +25 lines, -0 lines 2 comments Download
M frog/leg/resolver.dart View 1 2 3 4 5 6 9 chunks +110 lines, -27 lines 8 comments Download
M frog/leg/scanner/listener.dart View 1 2 3 4 5 6 7 chunks +24 lines, -11 lines 0 comments Download
M frog/leg/scanner/parser.dart View 1 2 3 4 2 chunks +1 line, -17 lines 0 comments Download
M frog/leg/scanner/token.dart View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M frog/leg/ssa/builder.dart View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 1 comment Download
M frog/leg/ssa/codegen.dart View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 1 comment Download
M frog/leg/tree/nodes.dart View 1 2 3 6 chunks +30 lines, -3 lines 0 comments Download
M frog/leg/tree/unparser.dart View 1 2 3 2 chunks +9 lines, -1 line 0 comments Download
M frog/leg/tree/visitors.dart View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M frog/leg/typechecker.dart View 1 2 3 4 5 6 2 chunks +10 lines, -0 lines 0 comments Download
M frog/leg/warnings.dart View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
M frog/tests/leg/src/mock_compiler.dart View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M tests/co19/co19-leg.status View 1 2 3 4 5 6 7 chunks +3 lines, -31 lines 0 comments Download
M tests/language/language-leg.status View 1 2 3 4 5 6 2 chunks +0 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
karlklose
8 years, 9 months ago (2012-03-15 10:57:16 UTC) #1
ahe
Initial comments. https://chromiumcodereview.appspot.com/9616058/diff/9001/frog/leg/elements/elements.dart File frog/leg/elements/elements.dart (right): https://chromiumcodereview.appspot.com/9616058/diff/9001/frog/leg/elements/elements.dart#newcode687 frog/leg/elements/elements.dart:687: Element lookupTypeParameter(SourceString parameterName) { As far as ...
8 years, 9 months ago (2012-03-15 11:17:33 UTC) #2
ngeoffray
http://codereview.chromium.org/9616058/diff/9001/frog/leg/elements/elements.dart File frog/leg/elements/elements.dart (right): http://codereview.chromium.org/9616058/diff/9001/frog/leg/elements/elements.dart#newcode902 frog/leg/elements/elements.dart:902: TypeVariableElement(name, Element enclosing, this.node, this.type, I prefer having enclosing ...
8 years, 9 months ago (2012-03-15 11:47:40 UTC) #3
ahe
Everything but the resolver changes, LGTM! Please address Nicolas comments before submitting, otherwise, the checked ...
8 years, 9 months ago (2012-03-16 13:37:11 UTC) #4
karlklose
Thanks for the comments, PTAL. http://codereview.chromium.org/9616058/diff/9001/frog/leg/elements/elements.dart File frog/leg/elements/elements.dart (right): http://codereview.chromium.org/9616058/diff/9001/frog/leg/elements/elements.dart#newcode687 frog/leg/elements/elements.dart:687: Element lookupTypeParameter(SourceString parameterName) { ...
8 years, 9 months ago (2012-03-16 14:58:47 UTC) #5
ahe
LGTM! https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/elements/elements.dart File frog/leg/elements/elements.dart (right): https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/elements/elements.dart#newcode907 frog/leg/elements/elements.dart:907: toString() => "${enclosingElement.toString()}.${name.slowToString()}"; $kind(...) https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.dart File frog/leg/resolver.dart (right): ...
8 years, 9 months ago (2012-03-16 15:29:21 UTC) #6
ngeoffray
8 years, 9 months ago (2012-03-18 13:40:56 UTC) #7
LGTM!

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/elements/e...
File frog/leg/elements/elements.dart (right):

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/elements/e...
frog/leg/elements/elements.dart:689: return result;
No need for a temporary variable.

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.dart
File frog/leg/resolver.dart (right):

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.d...
frog/leg/resolver.dart:461: return labels.lookup(label);
Why this change?

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.d...
frog/leg/resolver.dart:1219: // Create types and elements for type variable.
Please explain why you are doing two loops instead of one.

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.d...
frog/leg/resolver.dart:1276: if (interfaceType !== null &&
interfaceType.element.impliesType()) {
A type parameter should imply a type. I think Peter fixed this bug in another
CL, so you should be able to remove the call to impliesType.

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.d...
frog/leg/resolver.dart:1681: class TypeVariablesScope extends Scope {
I'm not sure why you need to create a special scope for type variables. In which
context do you require one? Please add a comment.

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.d...
frog/leg/resolver.dart:1682: TypeVariablesScope(parent, ClassElement element) :
super(parent, element);
Scope parent

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/resolver.d...
frog/leg/resolver.dart:1742: return library.find(name);
Why this change?

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/ssa/builde...
File frog/leg/ssa/builder.dart (right):

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/ssa/builde...
frog/leg/ssa/builder.dart:2504:
compiler.internalError('SsaBuilder.visitTypeVariable');
For something like if (a is T) { } the builder would see a type variable right?
If yes, then scratch my first comment on this CL, and you can change this to
unimplemented.

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/ssa/codege...
File frog/leg/ssa/codegen.dart (right):

https://chromiumcodereview.appspot.com/9616058/diff/11034/frog/leg/ssa/codege...
frog/leg/ssa/codegen.dart:975: compiler.unimplemented("visitIs for type
variables");
Do we actually end up here if the builder says unimplemented? Maybe add a
comment.

Powered by Google App Engine
This is Rietveld 408576698