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

Side by Side Diff: pkg/compiler/lib/src/resolution/variables.dart

Issue 1363993004: Report info messages together with their error, warning, or hint. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.resolution.variables; 5 library dart2js.resolution.variables;
6 6
7 import '../compiler.dart' show 7 import '../compiler.dart' show
8 Compiler; 8 Compiler;
9 import '../diagnostics/messages.dart' show 9 import '../diagnostics/messages.dart' show
10 MessageKind; 10 MessageKind;
(...skipping 28 matching lines...) Expand all
39 ResolutionRegistry get registry => resolver.registry; 39 ResolutionRegistry get registry => resolver.registry;
40 40
41 Identifier visitSendSet(SendSet node) { 41 Identifier visitSendSet(SendSet node) {
42 assert(node.arguments.tail.isEmpty); // Sanity check 42 assert(node.arguments.tail.isEmpty); // Sanity check
43 Identifier identifier = node.selector; 43 Identifier identifier = node.selector;
44 String name = identifier.source; 44 String name = identifier.source;
45 VariableDefinitionScope scope = 45 VariableDefinitionScope scope =
46 new VariableDefinitionScope(resolver.scope, name); 46 new VariableDefinitionScope(resolver.scope, name);
47 resolver.visitIn(node.arguments.head, scope); 47 resolver.visitIn(node.arguments.head, scope);
48 if (scope.variableReferencedInInitializer) { 48 if (scope.variableReferencedInInitializer) {
49 compiler.reportError( 49 compiler.reportErrorMessage(
50 identifier, MessageKind.REFERENCE_IN_INITIALIZATION, 50 identifier, MessageKind.REFERENCE_IN_INITIALIZATION,
51 {'variableName': name}); 51 {'variableName': name});
52 } 52 }
53 return identifier; 53 return identifier;
54 } 54 }
55 55
56 Identifier visitIdentifier(Identifier node) { 56 Identifier visitIdentifier(Identifier node) {
57 // The variable is initialized to null. 57 // The variable is initialized to null.
58 registry.registerInstantiatedClass(compiler.nullClass); 58 registry.registerInstantiatedClass(compiler.nullClass);
59 if (definitions.modifiers.isConst) { 59 if (definitions.modifiers.isConst) {
60 compiler.reportError(node, MessageKind.CONST_WITHOUT_INITIALIZER); 60 compiler.reportErrorMessage(
61 node, MessageKind.CONST_WITHOUT_INITIALIZER);
61 } 62 }
62 if (definitions.modifiers.isFinal && 63 if (definitions.modifiers.isFinal &&
63 !resolver.allowFinalWithoutInitializer) { 64 !resolver.allowFinalWithoutInitializer) {
64 compiler.reportError(node, MessageKind.FINAL_WITHOUT_INITIALIZER); 65 compiler.reportErrorMessage(
66 node, MessageKind.FINAL_WITHOUT_INITIALIZER);
65 } 67 }
66 return node; 68 return node;
67 } 69 }
68 70
69 visitNodeList(NodeList node) { 71 visitNodeList(NodeList node) {
70 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { 72 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) {
71 Identifier name = visit(link.head); 73 Identifier name = visit(link.head);
72 LocalVariableElementX element = new LocalVariableElementX( 74 LocalVariableElementX element = new LocalVariableElementX(
73 name.source, resolver.enclosingElement, 75 name.source, resolver.enclosingElement,
74 variables, name.token); 76 variables, name.token);
75 resolver.defineLocalVariable(link.head, element); 77 resolver.defineLocalVariable(link.head, element);
76 resolver.addToScope(element); 78 resolver.addToScope(element);
77 if (definitions.modifiers.isConst) { 79 if (definitions.modifiers.isConst) {
78 compiler.enqueuer.resolution.addDeferredAction(element, () { 80 compiler.enqueuer.resolution.addDeferredAction(element, () {
79 element.constant = 81 element.constant =
80 compiler.resolver.constantCompiler.compileConstant(element); 82 compiler.resolver.constantCompiler.compileConstant(element);
81 }); 83 });
82 } 84 }
83 } 85 }
84 } 86 }
85 } 87 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/typedefs.dart ('k') | pkg/compiler/lib/src/serialization/modelz.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698