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

Issue 10834061: Resolve typedefs. (Closed)

Created:
8 years, 4 months ago by Johnni Winther
Modified:
8 years, 4 months ago
Reviewers:
ahe, karlklose
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Resolve typedefs.

Patch Set 1 #

Total comments: 18

Patch Set 2 : Updated scope handling and type resolution #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+2361 lines, -1742 lines) Patch
M lib/compiler/implementation/compiler.dart View 1 2 chunks +4 lines, -4 lines 0 comments Download
M lib/compiler/implementation/elements/elements.dart View 1 10 chunks +130 lines, -33 lines 6 comments Download
M lib/compiler/implementation/resolver.dart View 1 43 chunks +322 lines, -217 lines 7 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 1 chunk +5 lines, -4 lines 0 comments Download
M lib/compiler/implementation/ssa/ssa.dart View 1 1 chunk +11 lines, -8 lines 0 comments Download
M lib/compiler/implementation/tree/nodes.dart View 1 1 chunk +19 lines, -0 lines 0 comments Download
M lib/compiler/implementation/typechecker.dart View 1 10 chunks +445 lines, -55 lines 0 comments Download
M lib/compiler/implementation/warnings.dart View 1 3 chunks +6 lines, -0 lines 0 comments Download
M lib/dartdoc/mirrors/dart2js_mirror.dart View 1 1 chunk +1370 lines, -1371 lines 0 comments Download
M tests/co19/co19-leg.status View 1 7 chunks +4 lines, -6 lines 0 comments Download
M tests/compiler/dart2js/mirrors_test.dart View 1 2 chunks +32 lines, -31 lines 0 comments Download
M tests/compiler/dart2js/mock_compiler.dart View 1 2 chunks +4 lines, -4 lines 0 comments Download
M tests/compiler/dart2js/resolver_test.dart View 1 7 chunks +8 lines, -8 lines 0 comments Download
M tests/language/language_dart2js.status View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
Johnni Winther
This is a merge of http://codereview.chromium.org/10628007/ on top of http://codereview.chromium.org/10826045/. I'm landing this CL since ...
8 years, 4 months ago (2012-07-30 07:53:03 UTC) #1
ahe
Comments so far. As we discussed, perhaps we should fix scope handling before we move ...
8 years, 4 months ago (2012-07-30 10:30:05 UTC) #2
Johnni Winther
PTAL http://codereview.chromium.org/10834061/diff/1/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): http://codereview.chromium.org/10834061/diff/1/lib/compiler/implementation/elements/elements.dart#newcode204 lib/compiler/implementation/elements/elements.dart:204: || e.kind === ElementKind.TYPEDEF) return e; On 2012/07/30 ...
8 years, 4 months ago (2012-08-01 10:12:28 UTC) #3
ahe
8 years, 4 months ago (2012-08-02 06:43:14 UTC) #4
I think we need to sit down and go through these changes and get them submitted
in smaller chunks. The stacking of this change upon the substitution changes is
making it really hard to make progress on this.

I'm pretty comfortable making such changes with git myself, so I would be more
than happy to sit down and cherrypick changes with you today.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
File lib/compiler/implementation/elements/elements.dart (right):

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/elements/elements.dart:225: * enclosing element will
be the parent scope.
Could you explain what the difference between these two scopes is?

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/elements/elements.dart:457:
createTypeVariables(this, node.typeParameters);
How about adding:

assert(cachedType === null);

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/elements/elements.dart:903: 
Extra line.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/elements/elements.dart:909: InterfaceType supertype;
Eventually an interface may extend a typedef. So I would prefer to use Type
here.

Generally, I would prefer everything but "type" remained loosely typed. It would
be useful to have an erroneous later, so flexibility is good.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/elements/elements.dart:953: Link<TypeVariableType>
get typeVariables() => type.typeArguments;
Same applies here, so I would prefer Link<Type>.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/elements/elements.dart:1288: String toString() =>
"${enclosingElement.toString()}.${name.slowToString()}";
This change is fine, but am I the only one thinking this return type is a bit
redundant?

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

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:755: inScope =
inClass.buildScope();//new ClassScope(inClass, inClass.getLibrary());
Remove comment.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:778:
compiler.resolver.toResolve.add(cls);
Please add a comment to explain why it is safe to not resolve the class
immediately.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:828: if (typeArgument is
TypeAnnotation) {
typeArgument.asTypeAnnotation() !== null

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:833: } else if (typeArgument is
TypeVariable) {
asTypeVariable

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:834: // This happens in default
clauses!
This case is really not making any sense to me.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:838: onFailure(node,
MessageKind.CANNOT_RESOLVE_TYPE, [typeArgument.name]);
Doesn't the spec say that the type variables must be identical? So if I have:

interface Foo default Bar<X> {} 

class Bar<Y> {}

The error is that X is not Y. So what you need to do here is run through the
type parameters of the class and the default clause and compare them. I don't
think this is the right place to do so. In other words, we shouldn't treat a
default clause as regular TypeAnnotation.

http://codereview.chromium.org/10834061/diff/6001/lib/compiler/implementation...
lib/compiler/implementation/resolver.dart:1823: // TODO(johnniwinther): Handle
the variables in default clauses separately
I don't think the code you have here is working at all, so I'd prefer if you
just replace lines 1822-1829 with a TODO.

Powered by Google App Engine
This is Rietveld 408576698