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

Side by Side Diff: tools/gn/parse_node_value_adapter.cc

Issue 2095043005: Add GN split_list function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 5 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
« no previous file with comments | « tools/gn/parse_node_value_adapter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "tools/gn/parse_node_value_adapter.h"
6
7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/scope.h"
9
10 ParseNodeValueAdapter::ParseNodeValueAdapter() : ref_(nullptr) {
11 }
12
13 ParseNodeValueAdapter::~ParseNodeValueAdapter() {
14 }
15
16
17 bool ParseNodeValueAdapter::Init(Scope* scope,
18 const ParseNode* node,
19 Err* err) {
20 const IdentifierNode* identifier = node->AsIdentifier();
21 if (identifier) {
22 ref_ = scope->GetValue(identifier->value().value(), true);
23 if (!ref_) {
24 identifier->MakeErrorDescribing("Undefined identifier");
25 return false;
26 }
27 return true;
28 }
29
30 temporary_ = node->Execute(scope, err);
31 return !err->has_error();
32 }
33
34 bool ParseNodeValueAdapter::InitForType(Scope* scope,
35 const ParseNode* node,
36 Value::Type type,
37 Err* err) {
38 if (!Init(scope, node, err))
39 return false;
40 if (get().VerifyTypeIs(type, err))
41 return true;
42
43 // Fix up the error range (see class comment in the header file) to be the
44 // identifier node rather than the original value.
45 *err = Err(node, err->message(), err->help_text());
46 return false;
47 }
OLDNEW
« no previous file with comments | « tools/gn/parse_node_value_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698