Commit f2a78926 by Jamie Madill Committed by Commit Bot

Symbol Table: Error on duplicate group keys.

This prevents newer group keys from overwriting old ones. Prevents bugs from creeping in like happened during texture buffer development. Bug: angleproject:3573 Change-Id: Iea69cac988e2cf4802a9f64c54cb694d32f1d3e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2521238Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent b59437cb
......@@ -18,7 +18,7 @@
"src/compiler/translator/builtin_variables.json":
"98d347a6ed181eca3d89bfd73193d787",
"src/compiler/translator/gen_builtin_symbols.py":
"a538e53475983ae9643afd5b36056347",
"03bdb7260ac347f4be968229a6a97aab",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"359670b3327789b173bb961e3c66a19f",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
......
......@@ -1036,7 +1036,6 @@ def get_parsed_functions(functions_txt_filename, essl_only):
default_metadata = {}
for line in lines:
fun_match = fun_re.match(line)
if line.startswith('GROUP BEGIN '):
group_rest = line[12:].strip()
group_parts = group_rest.split(' ', 1)
......@@ -1054,6 +1053,8 @@ def get_parsed_functions(functions_txt_filename, essl_only):
group_stack.pop()
is_top_level_group = (len(group_stack) == 0)
if is_top_level_group:
if current_group['name'] in parsed_functions:
raise Exception('GROUP END: Duplicate group name "%s"' % current_group['name'])
parsed_functions[current_group['name']] = current_group
default_metadata = {}
else:
......@@ -1062,24 +1063,26 @@ def get_parsed_functions(functions_txt_filename, essl_only):
elif line.startswith('DEFAULT METADATA'):
line_rest = line[16:].strip()
default_metadata = json.loads(line_rest)
elif fun_match:
return_type = fun_match.group(1)
name = fun_match.group(2)
parameters = fun_match.group(3)
function_props = {
'name': name,
'returnType': TType(return_type),
'parameters': parse_function_parameters(parameters)
}
function_props.update(default_metadata)
if essl_only:
# Skip GLSL-only functions
if 'essl_level' in function_props:
else:
fun_match = fun_re.match(line)
if fun_match:
return_type = fun_match.group(1)
name = fun_match.group(2)
parameters = fun_match.group(3)
function_props = {
'name': name,
'returnType': TType(return_type),
'parameters': parse_function_parameters(parameters)
}
function_props.update(default_metadata)
if essl_only:
# Skip GLSL-only functions
if 'essl_level' in function_props:
group_stack[-1]['functions'].append(function_props)
else:
group_stack[-1]['functions'].append(function_props)
else:
group_stack[-1]['functions'].append(function_props)
else:
raise Exception('Unexpected function input line: ' + line)
raise Exception('Unexpected function input line: ' + line)
return parsed_functions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment