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

Issue 10920089: Generate a warning and a runtime error for calls to nonexistent static calls, getters and setters. (Closed)

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

Description

Generate a warning and a runtime error for calls to nonexistent static calls, getters and setters. R=ngeoffray@google.com BUG=3086, 3089, 3095 Committed: https://code.google.com/p/dart/source/detail?r=12011

Patch Set 1 #

Total comments: 6

Patch Set 2 : Add missing test. #

Patch Set 3 : Address comments. #

Total comments: 4

Patch Set 4 : Remove case for variable == null in handling of ForIn. #

Total comments: 22

Patch Set 5 : Warnings and runtime errors are not used for toplevel statics. #

Patch Set 6 : #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -57 lines) Patch
M lib/compiler/implementation/compiler.dart View 1 2 3 4 1 chunk +3 lines, -0 lines 3 comments Download
M lib/compiler/implementation/dart_backend/placeholder_collector.dart View 1 2 3 4 3 chunks +6 lines, -1 line 0 comments Download
M lib/compiler/implementation/elements/elements.dart View 1 2 3 4 8 chunks +14 lines, -11 lines 2 comments Download
M lib/compiler/implementation/resolved_visitor.dart View 1 2 3 4 1 chunk +8 lines, -4 lines 1 comment Download
M lib/compiler/implementation/resolver.dart View 1 2 3 4 14 chunks +33 lines, -20 lines 0 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 4 6 chunks +58 lines, -18 lines 2 comments Download
M lib/compiler/implementation/typechecker.dart View 1 2 3 4 3 chunks +3 lines, -3 lines 0 comments Download
A tests/language/call_nonexistent_static_test.dart View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
M tests/language/language.status View 1 2 3 4 2 chunks +4 lines, -0 lines 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 4 1 chunk +7 lines, -0 lines 1 comment Download

Messages

Total messages: 9 (0 generated)
karlklose
8 years, 3 months ago (2012-09-05 09:17:04 UTC) #1
kasperl
DBC: https://chromiumcodereview.appspot.com/10920089/diff/1/lib/compiler/implementation/resolver.dart File lib/compiler/implementation/resolver.dart (right): https://chromiumcodereview.appspot.com/10920089/diff/1/lib/compiler/implementation/resolver.dart#newcode1419 lib/compiler/implementation/resolver.dart:1419: ResolutionWarning warning = This looks ripe for refactoring. ...
8 years, 3 months ago (2012-09-05 09:29:45 UTC) #2
karlklose
Thanks Kasper. https://chromiumcodereview.appspot.com/10920089/diff/1/lib/compiler/implementation/resolver.dart File lib/compiler/implementation/resolver.dart (right): https://chromiumcodereview.appspot.com/10920089/diff/1/lib/compiler/implementation/resolver.dart#newcode1419 lib/compiler/implementation/resolver.dart:1419: ResolutionWarning warning = On 2012/09/05 09:29:45, kasperl ...
8 years, 3 months ago (2012-09-05 11:10:47 UTC) #3
kasperl
I think the refactoring made the code much easier to understand. Thanks! Two more comments ...
8 years, 3 months ago (2012-09-05 11:16:01 UTC) #4
ngeoffray
LGTM http://codereview.chromium.org/10920089/diff/10001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): http://codereview.chromium.org/10920089/diff/10001/lib/compiler/implementation/elements/elements.dart#newcode321 lib/compiler/implementation/elements/elements.dart:321: ErroneousElement(this.errorMessage, Element enclosing) As discussed, you might want ...
8 years, 3 months ago (2012-09-05 11:46:44 UTC) #5
karlklose
PTAL. Unresolved static calls, gets and sets without a receiver are still compile time errors, ...
8 years, 3 months ago (2012-09-05 14:53:42 UTC) #6
ngeoffray
LGTM https://chromiumcodereview.appspot.com/10920089/diff/10001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://chromiumcodereview.appspot.com/10920089/diff/10001/lib/compiler/implementation/elements/elements.dart#newcode334 lib/compiler/implementation/elements/elements.dart:334: getLibrary() => enclosingElement.getLibrary(); On 2012/09/05 14:53:42, karlklose wrote: ...
8 years, 3 months ago (2012-09-07 08:12:46 UTC) #7
karlklose
https://chromiumcodereview.appspot.com/10920089/diff/10001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://chromiumcodereview.appspot.com/10920089/diff/10001/lib/compiler/implementation/elements/elements.dart#newcode334 lib/compiler/implementation/elements/elements.dart:334: getLibrary() => enclosingElement.getLibrary(); It does not check for the ...
8 years, 3 months ago (2012-09-07 09:24:01 UTC) #8
ahe
8 years, 3 months ago (2012-09-07 12:18:53 UTC) #9
LGTM!

https://chromiumcodereview.appspot.com/10920089/diff/6004/lib/compiler/implem...
File lib/compiler/implementation/compiler.dart (right):

https://chromiumcodereview.appspot.com/10920089/diff/6004/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:827: if
(Element.isErroneousElement(element)) {
I don't think you're supposed to call spanFromElement if it is erroneous. If the
element is erroneous, there's no need to report an error.

https://chromiumcodereview.appspot.com/10920089/diff/6004/lib/compiler/implem...
File lib/compiler/implementation/resolved_visitor.dart (right):

https://chromiumcodereview.appspot.com/10920089/diff/6004/lib/compiler/implem...
lib/compiler/implementation/resolved_visitor.dart:21: if
(Element.isUnresolved(element)) {
If the element is unresolved, I think you should call visitUnresolved.

Also, I think this is clearer:

if (element === null) {
  return visitDynamicSend(node);
} else ...
....
} else if (Element.isUnresolved(element)) {
  return visitUnresolvedSend(node);
} else {
...

https://chromiumcodereview.appspot.com/10920089/diff/6004/tests/language/lang...
File tests/language/language_dart2js.status (right):

https://chromiumcodereview.appspot.com/10920089/diff/6004/tests/language/lang...
tests/language/language_dart2js.status:47: class_literal_test/03: Fail # Calling
a nonexistent static is not a compile time error anymore.
Fail, OK

Powered by Google App Engine
This is Rietveld 408576698