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

Issue 1514173002: New Mojom parser: Don't allow enum variables to be assigned int values. (Closed)

Created:
5 years ago by rudominer
Modified:
5 years ago
Reviewers:
azani
CC:
mojo-reviews_chromium.org, gregsimon, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

New Mojom parser: Don't allow enum variables to be assigned int values. Thus far the new Mojom parser has allowed variables of enum type to be assigned integer values. This used to be allowed in .mojom files but that was changed a few months back and the new parser never picked up that change. This patch corrects that. - Because IsAssignmentCompatible() now returns false in the case of assigning an int to an enum, it is necessary to not use IsAssignmentCompatible() in the case that a user-defined constant that resolves to an int is being used as an enum value initializer (because that is allowed). That explains the reorganization in UserValueRef.validateAfterResolution(). - We changed how assignments of literals to user-defined-types is handled. Previously we did some validation during parsing (for example we would check that the literal was not of type float) but left other validation for the later validation phase. We now due all validation during the later validation phase. BUG=#46 R=azani@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/e27aa4fef1a5e79ca8caa433e86945f808452fa0

Patch Set 1 : working on stuff #

Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -74 lines) Patch
M mojom/mojom_parser/mojom/types.go View 3 chunks +21 lines, -18 lines 0 comments Download
M mojom/mojom_parser/mojom/types_test.go View 2 chunks +5 lines, -4 lines 0 comments Download
M mojom/mojom_parser/mojom/user_defined_types.go View 1 chunk +0 lines, -11 lines 0 comments Download
M mojom/mojom_parser/mojom/user_defined_types_test.go View 1 chunk +1 line, -1 line 0 comments Download
M mojom/mojom_parser/parser/parser_test.go View 2 chunks +0 lines, -39 lines 0 comments Download
M mojom/mojom_parser/parser/resolution_test.go View 3 chunks +45 lines, -1 line 0 comments Download

Messages

Total messages: 7 (4 generated)
rudominer
Hi Alex, ptal.
5 years ago (2015-12-10 23:39:19 UTC) #3
azani
lgtm
5 years ago (2015-12-10 23:59:17 UTC) #5
rudominer
5 years ago (2015-12-11 00:00:16 UTC) #7
Message was sent while issue was closed.
Committed patchset #1 (id:20001) manually as
e27aa4fef1a5e79ca8caa433e86945f808452fa0 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698