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

Issue 9431029: Implement interface types. (Closed)

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

Description

Implement interface types. Committed: https://code.google.com/p/dart/source/detail?r=6514

Patch Set 1 #

Patch Set 2 : Remove debug function. #

Total comments: 30

Patch Set 3 : Update #

Patch Set 4 : #

Patch Set 5 : Add test. #

Total comments: 27
Unified diffs Side-by-side diffs Delta from patch set Stats (+239 lines, -88 lines) Patch
M frog/tests/leg/src/ResolverTest.dart View 1 2 3 4 1 chunk +44 lines, -0 lines 6 comments Download
M lib/compiler/implementation/compiler.dart View 1 2 3 5 chunks +10 lines, -12 lines 1 comment Download
M lib/compiler/implementation/resolver.dart View 1 2 3 4 6 chunks +132 lines, -47 lines 13 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 4 2 chunks +8 lines, -7 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 2 3 4 1 chunk +5 lines, -2 lines 3 comments Download
M lib/compiler/implementation/ssa/nodes.dart View 1 2 3 4 2 chunks +3 lines, -4 lines 1 comment Download
M lib/compiler/implementation/ssa/optimize.dart View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M lib/compiler/implementation/typechecker.dart View 1 2 3 4 5 chunks +26 lines, -7 lines 3 comments Download
M tests/co19/co19-leg.status View 1 2 3 3 chunks +9 lines, -6 lines 0 comments Download
M tests/language/language-leg.status View 1 2 3 4 2 chunks +0 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
karlklose
8 years, 10 months ago (2012-02-22 13:32:12 UTC) #1
karlklose
8 years, 10 months ago (2012-02-24 11:29:18 UTC) #2
ngeoffray
LGTM! https://chromiumcodereview.appspot.com/9431029/diff/2001/frog/leg/resolver.dart File frog/leg/resolver.dart (right): https://chromiumcodereview.appspot.com/9431029/diff/2001/frog/leg/resolver.dart#newcode975 frog/leg/resolver.dart:975: // Register class of this type to be ...
8 years, 10 months ago (2012-02-24 13:36:15 UTC) #3
ahe
I have some questions, but I think it works. Let talk f2f. https://chromiumcodereview.appspot.com/9431029/diff/2001/frog/leg/resolver.dart File frog/leg/resolver.dart ...
8 years, 9 months ago (2012-02-29 12:49:15 UTC) #4
karlklose
Thanks for the comments, Peter and Nicolas. PTAL. https://chromiumcodereview.appspot.com/9431029/diff/2001/frog/leg/resolver.dart File frog/leg/resolver.dart (right): https://chromiumcodereview.appspot.com/9431029/diff/2001/frog/leg/resolver.dart#newcode947 frog/leg/resolver.dart:947: if ...
8 years, 8 months ago (2012-03-30 11:56:40 UTC) #5
karlklose
Adding Paul.
8 years, 8 months ago (2012-04-11 10:28:25 UTC) #6
ahe
8 years, 8 months ago (2012-04-12 15:05:23 UTC) #7
LGTM!

I suggest you submit as is and address comments in a follow-up CL.

Cheers,
Peter

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
File frog/tests/leg/src/ResolverTest.dart (right):

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
frog/tests/leg/src/ResolverTest.dart:61: // testVarSuperclass(); // The parser
crashes with 'class Foo extends var'.
Really?

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
frog/tests/leg/src/ResolverTest.dart:62: // testOneInterface(); // The parser
does not handle interfaces.
Really?

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
frog/tests/leg/src/ResolverTest.dart:63: // testTwoInterfaces(); // The parser
does not handle interfaces.
Really?

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
frog/tests/leg/src/ResolverTest.dart:75: testTypeResolving(visitor, text, name,
expectedElements) {
I think it is confusing when a helper function starts with "test".

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
frog/tests/leg/src/ResolverTest.dart:83: while (!arguments.isEmpty()) {
Expect.isTrue(index < expectedElements.length);

http://codereview.chromium.org/9431029/diff/16001/frog/tests/leg/src/Resolver...
frog/tests/leg/src/ResolverTest.dart:93: visitor.visit(parseStatement('Foo
foo;'));
What is the purpose of this?

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
File lib/compiler/implementation/compiler.dart (right):

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/compiler.dart:225: dynamicClass =
types.dynamicType.element;
I'd prefer getting the original to work.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
File lib/compiler/implementation/resolver.dart (right):

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:630: useElement(annotation,
type.element);
Long term, could we avoid setting the element?

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:808: if (node == null) {
===

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1023: typeName.source.stringValue ==
"var") {
Is it necessary to test for "var"? Also, it shouldn't be necessary to test for
Dynamic if you can use the definition in js_helper.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1036: error(send.receiver,
MessageKind.CANNOT_RESOLVE);
Shouldn't this be a warning if typeRequired is false?

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1059: if (element ==
compiler.types.voidType.element) {
===

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1060: type = compiler.types.voidType;
Why not just:

type = element.type;

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1061: } else if (element ==
compiler.types.dynamicType.element) {
===

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1064: // TODO(ngeoffray): Should we
also resolve typedef?
I think this TODO is obsolete.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1074: }
I don't think you're validating that the number of type arguments match the
number of parameters.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1075: type = new
InterfaceType(element.name, element, arguments.toLink());
This means you create a new object every time you see a type annotation for
plain types like "int" and "string".

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1079: type = new
SimpleType(element.name, element);
Why not:

type = element.type;

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1081: type =
element.computeType(compiler);
I'm not sure about this.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1710: // Find the correct member
context to perform the lookup in.
This method was a temporary wrapper around calling the ResolverVisitor. Now that
you have added this code, this is no longer the case.

Also, why is this not needed in resolveExpression and get:currentClass?

Why is this needed?

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
File lib/compiler/implementation/ssa/codegen.dart (right):

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/ssa/codegen.dart:1449: Type type = node.typeName;
I don't see how typeName is an improvement over typeExpression. I'd expect the
type of something called fooName to be a String, Identifier, or SourceString.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/ssa/codegen.dart:1452:
compiler.unimplemented("visitIs for type variables");
Please add this argument: "instruction: node"

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/ssa/codegen.dart:1454:
compiler.unimplemented("visitIs for typedefs");
Ditto.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
File lib/compiler/implementation/ssa/nodes.dart (right):

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/ssa/nodes.dart:2084: final Type typeName;
Thank you! The name is not optimal, if you have an alternative, it would be
nice.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
File lib/compiler/implementation/typechecker.dart (right):

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/typechecker.dart:64: final SourceString name;
This field seems redundant.

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/typechecker.dart:75: arguments.printOn(sb);
Add argument: ', '

http://codereview.chromium.org/9431029/diff/16001/lib/compiler/implementation...
lib/compiler/implementation/typechecker.dart:126: dynamicType = new
SimpleType(VOID, new ClassElement(DYNAMIC, library));
VOID?

Powered by Google App Engine
This is Rietveld 408576698