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

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

Issue 1416253002: Remove requiredTypes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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 '../common.dart'; 7 import '../common.dart';
8 import '../compiler.dart' show 8 import '../compiler.dart' show
9 Compiler; 9 Compiler;
10 import '../elements/modelx.dart' show 10 import '../elements/modelx.dart' show
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (scope.variableReferencedInInitializer) { 47 if (scope.variableReferencedInInitializer) {
48 reporter.reportErrorMessage( 48 reporter.reportErrorMessage(
49 identifier, MessageKind.REFERENCE_IN_INITIALIZATION, 49 identifier, MessageKind.REFERENCE_IN_INITIALIZATION,
50 {'variableName': name}); 50 {'variableName': name});
51 } 51 }
52 return identifier; 52 return identifier;
53 } 53 }
54 54
55 Identifier visitIdentifier(Identifier node) { 55 Identifier visitIdentifier(Identifier node) {
56 // The variable is initialized to null. 56 // The variable is initialized to null.
57 registry.registerInstantiatedClass(compiler.nullClass); 57 registry.registerInstantiatedType(compiler.coreTypes.nullType);
58 if (definitions.modifiers.isConst) { 58 if (definitions.modifiers.isConst) {
59 reporter.reportErrorMessage( 59 reporter.reportErrorMessage(
60 node, MessageKind.CONST_WITHOUT_INITIALIZER); 60 node, MessageKind.CONST_WITHOUT_INITIALIZER);
61 } 61 }
62 if (definitions.modifiers.isFinal && 62 if (definitions.modifiers.isFinal &&
63 !resolver.allowFinalWithoutInitializer) { 63 !resolver.allowFinalWithoutInitializer) {
64 reporter.reportErrorMessage( 64 reporter.reportErrorMessage(
65 node, MessageKind.FINAL_WITHOUT_INITIALIZER); 65 node, MessageKind.FINAL_WITHOUT_INITIALIZER);
66 } 66 }
67 return node; 67 return node;
68 } 68 }
69 69
70 visitNodeList(NodeList node) { 70 visitNodeList(NodeList node) {
71 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { 71 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) {
72 Identifier name = visit(link.head); 72 Identifier name = visit(link.head);
73 LocalVariableElementX element = new LocalVariableElementX( 73 LocalVariableElementX element = new LocalVariableElementX(
74 name.source, resolver.enclosingElement, 74 name.source, resolver.enclosingElement,
75 variables, name.token); 75 variables, name.token);
76 resolver.defineLocalVariable(link.head, element); 76 resolver.defineLocalVariable(link.head, element);
77 resolver.addToScope(element); 77 resolver.addToScope(element);
78 if (definitions.modifiers.isConst) { 78 if (definitions.modifiers.isConst) {
79 compiler.enqueuer.resolution.addDeferredAction(element, () { 79 compiler.enqueuer.resolution.addDeferredAction(element, () {
80 element.constant = 80 element.constant =
81 compiler.resolver.constantCompiler.compileConstant(element); 81 compiler.resolver.constantCompiler.compileConstant(element);
82 }); 82 });
83 } 83 }
84 } 84 }
85 } 85 }
86 } 86 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/tree_elements.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698